Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions handoff/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# trident · handoff — the session AI-log

A **handoff doc** lets a brand-new Claude session resume a prior one without
A **handoff doc** lets a brand-new Claude session continue a prior one without
re-reading the whole transcript — it's the single biggest context-restore
token saver in the stack. The goal: a cold session should *feel like it never
left*, reconstructing not just **what changed** but **the flow of how you were
Expand All @@ -21,13 +21,13 @@ reasoning.

### 1. Deterministic skeleton (`generate-handoff.py`) — instant, free, always on
The facts that must never be wrong, regardless of any model:
- **Boot block** — task, resume pointer, git state, verify command, ruled-out list.
- **Boot block** — task, continuation pointer, git state, verify command, ruled-out list.
- **Order Ledger** — the CASTER KITCHEN board scraped as the complete order list
(queued work included; on the board ⇒ in the handoff).
- **Last message (not yet processed)** — the unprocessed tail of your intent.
- **Where We Left Off** — now up to 2 recent substantive turns (was 1, capped at 480c).
- **Recent Exchange** — *new*: the verbatim tail of the last ~6 real turns. The
cheapest thing that makes a resume feel continuous: the next session reads the
cheapest thing that makes a subsequent session feel continuous: the next session reads the
actual end of the dialogue, not a summary of it.

Widened caps + a slash-command-template guard (so `/loop`/`/goal` scaffolding
Expand Down Expand Up @@ -57,7 +57,7 @@ narrator is **gated hard** in `handoff-writer.sh`:
| Fail-open | if it's skipped or errors, the skeleton handoff stands on its own |

Net effect: a handful of narrations a day (one per *materially-changed* session),
not 29. Each ~48s / a few cents on haiku, saving a full transcript re-read on resume.
not 29. Each ~48s / a few cents on haiku, saving a full transcript re-read before continuation.

## Files

Expand Down
22 changes: 18 additions & 4 deletions tests/test_wave234.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import tempfile
import time
import unittest
from unittest import mock

ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SHAPER_PROMPT = os.path.join(ROOT, "shaper", "shaper-prompt.sh")
Expand Down Expand Up @@ -197,19 +198,32 @@ def setUp(self):
import antibodies
importlib.reload(antibodies)

def test_waste_mints_and_stays_observe_first_month(self):
def test_waste_stays_observe_before_observe_period_ends(self):
stats = os.path.join(self.dir, "session-stats.jsonl")
with open(stats, "w") as f:
f.write(json.dumps({"kind": "spawn", "session_id": "s1",
"model": "claude-opus-4-8", "output": 120}) + "\n")
settlement = {"planned": {"fanout_max": 3}, "actual": {"spawns": 8}}
for i in range(5):
antibodies.observe(f"s{i}", settlement, stats)
with mock.patch.object(antibodies.time, "strftime", return_value="2026-07-04"):
for i in range(5):
antibodies.observe(f"s{i}", settlement, stats)
store = json.load(open(os.path.join(self.dir, "antibodies.json")))
self.assertIn("fanout_waste:over2x", store)
ab = store["fanout_waste:over2x"]
self.assertGreaterEqual(ab["confirmations"], 3)
self.assertEqual(ab["state"], "observe") # hard-coded until OBSERVE_UNTIL
self.assertEqual(ab["state"], "observe")

def test_waste_graduates_after_observe_period_ends(self):
stats = os.path.join(self.dir, "session-stats.jsonl")
with open(stats, "w") as f:
f.write(json.dumps({"kind": "spawn", "session_id": "s1",
"model": "claude-opus-4-8", "output": 120}) + "\n")
settlement = {"planned": {"fanout_max": 3}, "actual": {"spawns": 8}}
with mock.patch.object(antibodies.time, "strftime", return_value="2026-07-05"):
for i in range(5):
antibodies.observe(f"s{i}", settlement, stats)
store = json.load(open(os.path.join(self.dir, "antibodies.json")))
self.assertEqual(store["fanout_waste:over2x"]["state"], "block")

def test_tolerance_suppresses(self):
with open(os.path.join(self.dir, "antibody-tolerance.json"), "w") as f:
Expand Down
Loading