Keep agent state in init.d-style files to survive compaction
Instead of one PROGRESS.md, ordered runlevel-style state files plus fork/wait subagents survived two 230k-token compactions.
Prompt for your agent
Goal: Stop long agent sessions from losing their place after context compaction. Setup: agents used in source: Claude, Cursor, Gemini CLI, Antigravity. Steps: 1. Don’t trust the auto-summary after compaction; keep state on disk. 2. Avoid a single TODO.md/PROGRESS.md scratchpad; it gets stale or overwritten. 3. Use ordered, lexically numbered state files per step, like SysV /etc/init.d runlevels, that the agent re-reads to resume. 4. Push heavy work into forked subagents and wait on results, so the main context stays small. Rules: ask me before anything irreversible (sending, posting, paying, deleting); don’t invent data, results or tools I haven’t given you; tell me what you couldn’t verify. Based on: Randal L. Schwartz — https://dev.to/gde/surviving-the-200k-token-lobotomy-how-unix-initd-and-memento-made-my-ai-coding-agent-immune-to-2f74 (summarised from source; the source has no explicit step list)
Steps are our summary of the source (it has no explicit step list). Includes a “Based on” credit line.
I tried this
Tell the next builder. One anonymous answer each; click again to undo.
Agents, models and tools only what the source states
- Agents
- Claude Cursor Gemini CLI Antigravity
Sources & credit
- Randal L. Schwartz @randalschwartz primaryDEV post · 10 Oct 2026https://dev.to/gde/surviving-the-200k-token-lobotomy-how-unix-initd-and-memento-made-my-ai-coding-agent-immune-to-2f74