Add loop detector, budgets, and live session control

Milestone 8: the loop detector alerts when test failures repeat, budget
caps limit context/cost/wall-time per session with compaction support,
and live control lets you interrupt, message, or kill a running session
from the TUI. Decisions can now be vetoed, which sends hx/message and
rewinds the session to code. All 82 tests pass.

- src/budget.rs: pure functions for active time, budgets and loop detect
- src/runner.rs: Ctl control object polls for commands ~100ms, handles
  interrupt/message/abort/stop at every blocking point, re-runs on
  hints, and compacts when context is high
- src/db.rs: commands table for TUI→runner control
- src/detail.rs, src/goal.rs, src/tui/: loop detector box, budget caps,
  session keys (i/m/s/k/r), goal keys (v for veto), state forcing
- tests/fake_acp_hx.py: slow mode and hx/message, hx/compact log
- examples/machines/task.toml: [budget] with wall_secs, cost, compact_at

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
johannesandClaude Haiku 4.5 committed 2026-11-14 12:55:44 +01:00
1 parent 7bf0986640
commit bf609c2e0e
16 files changed
+1694 -55

No files matched your search

+3
View File
@@ -25,6 +25,8 @@ pub struct DecisionView {
pub id: i64,
pub session: String,
pub text: String,
/// The state the decision was made in.
pub state: String,
/// `plan · 13:22`
pub whence: String,
pub vetoed: bool,
@@ -156,6 +158,7 @@ pub fn build(i: &Input) -> GoalView {
id: d.id,
session: d.session.clone(),
text: d.text.clone(),
state: d.state.clone(),
whence: format!("{} · {}", d.state, &hms(d.at)[..5]),
vetoed: d.vetoed,
})