Skip to content

feat: show the Stop report as one line under the answer through the mod - #273

Merged
breferrari merged 20 commits into
feat/265-mod-session-contextfrom
feat/266-mod-stop
Oct 3, 2026
Merged

breferrari merged 20 commits into
feat/265-mod-session-contextfrom
feat/266-mod-stop

Conversation

@breferrari

@breferrari breferrari commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

What

With the mod loaded, the Stop report becomes one line under the answer, and the agent gets the full report with the next prompt the person sends. Stacked on #271; review only this diff.

Why

The settings hook's Stop channels are all visible or all lost: a block reason prints as "Stop hook error", additionalContext as "Stop hook feedback", and a systemMessage never reaches the model. The mod has one per reader: turn.complete draws a line for the person, prompt.submit context reaches the model unseen.

How

 classic.Stop
+  run stop-checklist.ts in report mode (5 s, as the hook); on failure drop the queue, throw
+  findings this session was not given ($.store) → queue { report, line, urgent }
 turn.complete (a completed main-loop answer)
+  draw the line after any set below; an urgent finding → the plugin's own prompt, once per person's prompt
 prompt.submit (the person's prompt, or ours)
+  take the record, hold the prompt as in flight, attach the report; put it back if the prompt never enters
 turn.start
+  the turn ran that prompt (whole lines): delivered, in $.store; another ran first: put it back
 classic.SessionStart
+  any start but a compaction drops the queue
Case What happens
Same findings Nothing queued
Resume in a new process Not repeated once delivered; a report that never reached the agent is queued again
A peer, notification, schedule, another plugin Passes without the report
Prompt blocked, failing, or pulled out of the queue unrun The report goes back
A report in flight across /clear Not put back into the new conversation
Mod's own run fails Its queue is dropped; the settings hook delivers
An urgent finding One plugin turn per prompt the person sends. The template defines none; a vault that does gets the turn

Verification

A turn starts inside its own prompt's next() (observed on 2.1.288), so the prompt is held as in flight before next is called. Held after it, the first live run re-delivered the report on every other prompt; the kit test now starts the turn inside next across six turns.

  • Live, 2.1.288, trusted vault, seven turns: the line drew under each changed report's answer, the next prompt quoted the report's first sentence, every later prompt said NONE. Across --resume in a new process: a delivered report is not sent again, a waiting one arrives once.
  • claude plugin test: 72 pass. npm test: 1649 pass, 0 fail. Demonstrated red: 41 mutations on the final code, all killed.

Merge danger

Door: two-way. The plugin's store holds one small map of session ids.
Blast radius: Claude Code sessions with the mod. Without the flag, the settings hook is unchanged.

Closes #266
Part of #262

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings October 2, 2026 23:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@breferrari breferrari changed the title Show the Stop report as one line under the answer when the mod is loaded feat: show the Stop report as one line under the answer through the mod Oct 2, 2026
@breferrari
breferrari added this pull request to stack #272 October 3, 2026 08:26
@breferrari
breferrari force-pushed the feat/266-mod-stop branch 2 times, most recently from f351e7a to 8ed922c Compare October 3, 2026 08:48
@breferrari
breferrari force-pushed the feat/266-mod-stop branch 2 times, most recently from 7d0f78c to c4374bd Compare October 3, 2026 09:56
breferrari and others added 16 commits October 3, 2026 12:26
… dropped prompts keep the report, line after a lower hook's

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hook

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s never lost or chained, one prompt takes the report, turn.complete tested at the hook

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… one urgent turn per prompt the person sends, any start but a compaction drops the queue

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gent turn per prompt, every start but a compaction drops it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gets what was shown, only an entered prompt renews the urgent allowance

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eached the agent; compaction keeps report, shown identity and allowance, each pinned

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… allowance a flag; the Stop run held to the hook's own 5s; the Stop suite on the shared test world

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a resume in a new process does not repeat it; a report in flight across a /clear is not put back; the line's wording matches the hook's, 'now' when urgent; the mod's timeouts held to settings.json by a test; docs and READMEs to match

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ue unrun goes back to the queue (turn.start confirms delivery)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t enters is not undone by the put-back

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p run drops the mod's queue so two reports never ride one prompt; a held prompt counts as run only as whole lines; the zh-CN README's garbled duplicate removed, and CI now refuses a second copy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
breferrari and others added 4 commits October 3, 2026 12:26
…e next (2.1.288) — every other prompt re-delivered the report; the store remembers delivered, so a report still waiting survives a resume in a new process

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rocess resume

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…turn.start, both redundant once delivery is remembered; the eviction test seeds delivered sessions so the cap matters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@breferrari
breferrari merged commit 8fabc05 into main Oct 3, 2026
11 checks passed
@breferrari
breferrari deleted the feat/266-mod-stop branch October 3, 2026 10:31
breferrari added a commit that referenced this pull request Oct 3, 2026
…rrived (#274)

## What

A delivery gate asks the model what session context it actually
received, rather than checking that a hook ran. Stacked on #273; review
only this diff.

## Why

From Claude Code 2.1.89 until #254, hook output past 10,000 characters
reached the model as a 2,000-character preview while every log said
success. Every check here confirmed a hook **ran**, never what
**arrived**, and the mod moves the context onto a young API.

## How

`.github/scripts/delivery-gate.ts` runs real sessions in throwaway
vaults. At each checkpoint the model quotes the context's last line
**and** a marker from its middle, so a cut anywhere fails.

| Session | Checkpoints |
|---|---|
| With the mod | startup; then after `/compact`, from a general-purpose
subagent, after a second `/clear` |
| Settings hooks alone | startup, after `/compact`, after `/clear` |

- **`--trusted-dir`** builds each vault in a folder trusted once, so the
mod is found as a user's is; otherwise `--plugin-dir`.
- **Shifts:** with the mod, each `/compact` and `/clear` first moves the
context's size and rewrites the marker; real compaction summaries repeat
the old size, and only a fresh delivery has the new one.
- **INVALID, never PASS:** any tool use, a summary or subagent prompt
carrying the size or marker, a missing compact or clear event, a
subagent that is not one general-purpose call reporting zero tools, a
settings hook that printed when the mod should have delivered, a failed
or extra turn.
- **`--self-test`** runs two broken mods; every checkpoint must FAIL
except a startup-only control. **`--file-issue`** files a failing run
with its exact flags.

## Evidence

Claude Code 2.1.288, Opus:

```
trusted folder        --plugin-dir          self-test (trusted)
PASS  7 of 7          PASS  7 of 7          FAIL 7 checkpoints, control PASS
exit=0                exit=0                exit=0 (the gate can fail)
```

The same 7 of 7 and self-test hold on Claude Code 2.1.287, the docs'
minimum, and from a vault copied from infrastructure alone (the gate
creates `brain/` itself).

One self-test FAIL read "stale: it quoted the context from before the
shift": the case the shift exists for. The judge: 40 tests on real
2.1.288 event shapes; 52 mutations, all killed.

## Merge danger

**Door:** two-way. Nothing runs it automatically: CI on a public
repository has no model credentials, so it runs before a release, as
CONTRIBUTING says.
**Blast radius:** contributors who run it: model turns on their account.

Closes #267
Part of #262

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move the Stop report to the mod: a quiet line, a turn only when urgent

2 participants