mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 09:20:03 +01:00
feat(autopilot): bidirectional self-throttle — forward continuation +
backward loop protection
Re-shapes the Self-throttle section of the next_best prompt into two
symmetric clauses sharing one anchor ("no real user message between
turns"). Closes the largest waste in autopilot today: re-deriving
the same answer the previous turn already wrote.
The change in one sentence: when `next:` from the prior handoff names
a specific actionable task and the human hasn't intervened since,
skip the entire Pick algorithm and just execute it.
Old structure (backward only):
- If no-op-count ≥ 2 OR same-dir-streak → status:blocked + stop.
New structure (bidirectional, parallel):
- Forward (continuation beats re-discovery): If last handoff's
`next:` names a specific actionable task (concrete verb + named
file/function/feature, not vague phrases) AND no real user msg
arrived between turns AND that task hasn't shipped (no commit
hash you can point to) — execute it directly. Skip Pick.
Open with "Continuing per session-next: <one-line restatement>"
+ the impact-triage sentence.
- Backward (loop protection): existing rule, unchanged.
Why this is the right architecture:
- Self-throttle was always the gate that decides whether to engage
Pick at all. It was just one-sided. Making it symmetric matches
the operational reality: SOMETIMES you stop because nothing's
working (backward), SOMETIMES you continue because the path is
clear (forward). Both bypass Pick — same gate.
- The "no real user message between turns" anchor is shared. Users
can intervene by sending any substantive message; that
immediately disables both Forward and Backward, surfacing rule 3
(unactioned ask).
- The "you cannot point to a commit hash that delivered it" test
mirrors rule 3's actioned-test, keeping conceptual symmetry across
rules.
- No DB migration, no new state field. Existing `next:` is now
load-bearing instead of buried as rule 7.
Combined impact: collapses the "memory between fires" gap (#2 from
today's user-eyes audit) AND the "backward-only self-throttle" gap
(#3) into one prompt edit. Doesn't reintroduce strategist
composition (#1) and doesn't require fire-quality measurement (#5)
to land first.
Renderer change auto-applies to Fleet Runner's autopilot path:
a7e08a1's SSOT collapse means renderTaskForAdapter looks up the
body from PROMPT_TEMPLATES, so updating prompt-library.ts is the
single edit. Also regenerated ~/.config/agent-prompts.json for any
legacy consumers; bash bridge is dead so this is belt-and-braces.
Body grew 4904 → 5677 chars. Token cost on the dispatch path is
negligible (the strategist composer that did pay for tokens was
deleted in Session 3).
Verification: tsc clean. Full test suite green: test:home 97/97,
test:dispatch-gates 11/11, test:autopilot-defaults 11/11,
test:prompt-history 4/4, test:control-presenter 19/19, test:digest
13/13. Dog-food check: this very session's `next:` would have
triggered the Forward branch (named "two T1 candidates — (a)
inline autopilot-fire surface; (b) poller timeout warning"), saving
re-discovery cost on the next autopilot fire.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ba90b405cc
commit
a973e1cc69
1 file changed
+5
-2
@@ -882,8 +882,11 @@ Setup (run, read outputs):
|
||||
ls ~/.claude/sessions/<P>.blockers/pending/ 2>/dev/null
|
||||
Read: last 10 user messages · ~/.claude/sessions/<P>.roadmap.md · ~/.claude/sessions/<P>.md
|
||||
|
||||
Self-throttle (read your own handoff state BEFORE picking):
|
||||
- If no-op-count ≥ 2 OR last 3 commits are all in the same dir with no real user message between turns → write status: blocked, block-reason: "low-value loop — need human direction" and STOP. Do not pick a task this turn. A loop that keeps firing into the same gravity well burns the founder's attention faster than any single bad pick. The autopilot is the founder's amplifier, not their replacement.
|
||||
Self-throttle (decides whether to engage Pick at all — both directions share the "no real user message between turns" anchor):
|
||||
|
||||
Forward (continuation beats re-discovery): If your last handoff's \`next:\` field names a specific actionable task (concrete verb + named file/function/feature/area, not vague phrases like "more cleanup" or "next step in sweep") AND no real user message has arrived between turns AND that task has NOT already shipped (you cannot point to a specific commit hash that delivered it) — execute it directly. Skip Pick entirely. The most common autopilot waste is re-deriving the same answer the previous turn already wrote. Make \`next:\` load-bearing. Open with "Continuing per session-next: <one-line restatement>" + the impact-triage sentence; everything below applies as usual once you're executing.
|
||||
|
||||
Backward (loop protection): If no-op-count ≥ 2 OR last 3 commits are all in the same dir with no real user message between turns → write status: blocked, block-reason: "low-value loop — need human direction" and STOP. Do not pick a task this turn. A loop that keeps firing into the same gravity well burns the founder's attention faster than any single bad pick. The autopilot is the founder's amplifier, not their replacement.
|
||||
|
||||
Pick (first matching wins):
|
||||
0. Pending blocker file in ~/.claude/sessions/<P>.blockers/pending/ → cat its contents to the user, do not pick a task this turn. When the user confirms the ask is resolved, mv the file from pending/ to applied/.
|
||||
|
||||
Reference in new issue
Block a user