@agimon-ai/doompi-autostop
Shuts a DoomPi session down once the agent settles and stays idle.
Package details
Install @agimon-ai/doompi-autostop from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@agimon-ai/doompi-autostop- Package
@agimon-ai/doompi-autostop- Version
0.0.1-alpha.53- Published
- Sep 18, 2026
- Downloads
- 6,489/mo · 1,015/wk
- Author
- agiflow-ai
- License
- MIT
- Types
- extension
- Size
- 94.6 KB
- Dependencies
- 2 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./dist/extensions/pi.mjs"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
@agimon-ai/doompi-autostop
Shuts a DoomPi session down once the agent settles and stays idle.
A scripted run wants the session to exit on its own when the work is done. Waiting for
agent_settled alone is not enough: the agent can settle and immediately pick up a queued
message, and it can settle while the last response is still streaming. So this package settles,
waits, looks again, and only then stops.
The policy
| Moment | Session state | Outcome |
|---|---|---|
agent_settled |
messages queued | stand down |
agent_settled |
queue empty | look again in 5s |
| the scheduled look | messages queued | stand down |
| the scheduled look | background runner or agent active | look again in 5s |
| the scheduled look | still streaming | look again in 100ms |
| the scheduled look | idle, queue and background empty | context.shutdown() |
Any input or agent_start event disarms a pending stop. The cooldown is the grace period;
the 100 ms recheck waits out a stream that has not finished draining. Active work and provider
errors reported through DoomPi's background-work service keep the session alive. This includes
supervised Doom Runner processes and Team subagents owned by the current session.
decideOnSettled and decideOnRecheck handle the plain Pi session state. The idle shutdown
watch adds the authoritative background-work gate before the policy may stop the session.
What it registers
| Entry | Surface |
|---|---|
./extensions/pi |
input, agent_start and agent_settled hooks, plus the shutdown that disarms them |
The extension owns a Cordis fiber; session_shutdown disposes it, which cancels any armed stop.
That matters because Pi reloads extensions in process. A timer left armed by the previous load
would stop the session it was reloaded into.
Installation
DoomPi depends on this package and activates it when a run asks for --auto-stop. It is not
selectable from .doom/modes.yaml.
License
MIT