Compact a waiting worker's session before its prompt cache expires #587

Merged
lilleman merged 12 commits from item-310 into main 2026-11-19 04:58:55 +01:00
Owner

While an interrupt waits on the human, loop-claude starts a timer 10 minutes short of the worker's hour-long prompt cache. If no answer has come when it fires, it compacts the session with claude -p /compact --resume, then keeps waiting. It skips the timer under 60k tokens of context, on a five-minute cache, and where claude opens on the terminal at once. A probe confirmed that a headless /compact on a resumed session compacts it (compact_result: success, a compact_boundary in the same session).

While an interrupt waits on the human, loop-claude starts a timer 10 minutes short of the worker's hour-long prompt cache. If no answer has come when it fires, it compacts the session with `claude -p /compact --resume`, then keeps waiting. It skips the timer under 60k tokens of context, on a five-minute cache, and where claude opens on the terminal at once. A probe confirmed that a headless `/compact` on a resumed session compacts it (`compact_result: success`, a `compact_boundary` in the same session).
lilleman added 1 commit 2026-11-17 13:00:42 +01:00
lilleman added 1 commit 2026-11-17 14:05:17 +01:00
Sort interrupt's imports by their first binding
CI / tests (pull_request) Successful in 3m21s
e5258525e7
lilleman added 2 commits 2026-11-19 04:22:46 +01:00
lilleman added 5 commits 2026-11-19 04:45:22 +01:00
lilleman added 2 commits 2026-11-19 04:48:01 +01:00
# Conflicts:
#	bin/agent_cycle/interrupt.py
#	bin/agent_cycle/run.py
#	bin/agent_cycle/states.py
#	docs/reading-cost.md
#	todo.md
File item 443: measure the compaction's saving
CI / tests (pull_request) Successful in 4m55s
d9875ee460
lilleman changed title from WIP: Compact a waiting worker's session shortly before its prompt cache expires to Compact a waiting worker's session before its prompt cache expires 2026-11-19 04:53:44 +01:00
lilleman added 1 commit 2026-11-19 04:53:53 +01:00
Finish item 310 in the plan
CI / tests (pull_request) Successful in 4m58s
e019a6b78c
lilleman merged commit e019a6b78c into main 2026-11-19 04:58:55 +01:00
lilleman deleted branch item-310 2026-11-19 04:58:55 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lilleman/claude-config#587