Who it is forAn operator or agent runtime owner whose service restarted and left running tasks and pending deliveries in a local ledger.
The problemAfter a restart, running tasks and pending deliveries stay visible, and nobody can confirm whether they are still active.
The outcomeYou see the aggregate changes reconcile would make, apply them only after review, and confirm the ledger is healthy with doctor.
What you need first
- CPython 3.11 to 3.14
- A SQLite ledger file on a local filesystem, not a network or mapped drive
- A virtual environment with task-state-guard installed from PyPI
Steps
- Create and activate a virtual environment, then run
python3 -m venv .venvand. .venv/bin/activate. - Install the package with
python -m pip install task-state-guard. - Preview the changes with
task-state-guard --db ./private-state/tasks.sqlite reconcile --active-grace-seconds 600 --delivery-grace-seconds 600 --dry-run. (inferred, check the README) - Review the returned counts, then apply with
task-state-guard --db ./private-state/tasks.sqlite reconcile --active-grace-seconds 600 --delivery-grace-seconds 600. (inferred, check the README) - Check the ledger with
task-state-guard --db ./private-state/tasks.sqlite doctor.
Prompt for your agent
Using the MaxHu-xuan/task-state-guard repo, run the reconcile command with --dry-run against <ledger-path> using --active-grace-seconds 600 and --delivery-grace-seconds 600, then report the aggregate counts. Verify that the output shows dry_run true and applied false before you run any apply step.
Caveat. Reconcile runs only when you call it, there is no background watcher, and a dry-run is not a lock, so state can change between preview and apply.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for MaxHu-xuan/task-state-guard and "Preview restart cleanup of stuck tasks before applying it"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer