Skip to content

docs(examples): kill -9 → resume without re-spending (the flagship) - #62

Merged
prashar32 merged 1 commit into
mainfrom
examples/kill-9-resume
Jun 5, 2026
Merged

docs(examples): kill -9 → resume without re-spending (the flagship)#62
prashar32 merged 1 commit into
mainfrom
examples/kill-9-resume

Conversation

@prashar32

Copy link
Copy Markdown
Owner

The flagship demo

The crash-resumable moat, made into a recordable, reproducible demo (examples/kill-9-resume/). A checkpointing agent runs under a governed run; the daemon is kill -9’d mid-run; on restart it reloads the run with the budget it had already spent, and re-running the agent (via resume_run, #61) picks up from its last checkpoint and finishes — without redoing the paid steps.

The proof is one number: across the crash the governor’s loop counter ends at 10, not 15.

./demo.sh — the money shot, in one command

Scripts it deterministically: start daemon → 5 of 10 steps → kill -9 the daemon → restart (resumed runs from store count=1) → resume from cursor 5 → finish → runs list shows LOOPS=10.

↻ RESUMING run 4e25ad71-…
  the governor already counts 5 spent steps — resuming at cursor 5, not redoing them.
  step  6/10 … step 10/10 done
✅ governor loop counter = 10 — exactly one per step of work … neither redone nor re-paid.

Contents

  • agent.py — the resumable agent (create-or-resume via a run-id file; checkpoints each step; prints a clear “the daemon is gone — restart and re-run to resume” message when it can’t reach the daemon).
  • demo.sh — the reproducible orchestrator (uses the binary so it can kill -9 the process).
  • README.md — one-command run, the by-hand flow for a live recording, how it works, and the “$ not double-counting” note (Reload restores spent dollars/tokens too — shown via the proxy).
  • Linked prominently from the main README (the checkpoints row + an examples pointer).

Verification

Ran demo.sh end-to-end against the built binary + the SDK: 5 steps → kill -9 → restart → resume → finish, LOOPS=10 (not 15). Also verified the daemon-crash-mid-run path prints the recovery message. py_compile + bash -n clean.

Key-free. No model call, no API key — the loop counter is the proof.

The crash-resumable moat, made into a recordable, reproducible demo. A
checkpointing agent runs under a governed run; the daemon is kill -9'd mid-run; on
restart it reloads the run with the budget it had already spent, and re-running the
agent (via resume_run) picks up from the last checkpoint and finishes — without
redoing the paid steps.

demo.sh scripts the whole money shot deterministically: 5 of 10 steps -> kill -9
the daemon -> restart -> resume -> finish, then proves the governor's loop counter
is 10, not 15. Key-free: the loop counter is the proof; the README shows the dollar
counter behaves identically (Reload restores spent dollars/tokens too).

agent.py is the resumable agent — create-or-resume via a run-id file, checkpoint
each step, and a clear "the daemon is gone, restart and re-run to resume" message
when it can't reach the daemon. Linked prominently from the README as the moat.
@prashar32
prashar32 merged commit bffa399 into main Jun 5, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant