Install
Install with PiG
pig install npm:@agimon-ai/po-autostopInstall with Pi
pi install npm:@agimon-ai/po-autostopPackages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.
README
Written by the package's publisher, shown as published in version 0.0.0-alpha.197 (README.md). PiG does not review it.
@agimon-ai/po-autostop
Shuts a Po 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() |
An 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. Supervised Runner
processes (po-runner) hold while running or awaiting asynchronous completion admission
(published without a status). Running commands stop holding after five minutes of settled
background-work waiting. A new turn resets that clock. Shutdown uses Runner's existing
cleanup to stop the commands. A runner listed as completed or failed no longer counts.
Owned subagents (team-direct-runs, po-task), pending completion admission and holding-provider
errors still hold after the deadline. The holding rule is shared with inline workflow step
supervision through core's background-work predicates. Workflow runs (workflow-mcp) do not
hold a session open.
Each wait is recorded as po_autostop.waiting_on_background_work telemetry naming the work
holding the session, along with po_autostop.stood_down and po_autostop.shutdown_requested.
The idle shutdown watch adds the authoritative background-work gate before the policy may stop the session.
License
MIT. See LICENSE.