Skip to content

FE-1943: Shorten Brunch's turns by cutting model calls and Ledger text - #10070

Open
lunelson wants to merge 6 commits into
ln/fe-1850-1336-1851-ledger-provenance-commentsfrom
ln/fe-1943-shorten-turn-times-2
Open

lunelson wants to merge 6 commits into
ln/fe-1850-1336-1851-ledger-provenance-commentsfrom
ln/fe-1943-shorten-turn-times-2

Conversation

@lunelson

@lunelson lunelson commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🌟 What is the purpose of this PR?

Brunch's turns get shorter. Each change removes work the model did on every exchange without it changing the answer: a closing model call, a reread of the net, a long Ledger commit, and reflections that repeated the net. The turn-time figures below come from local persona runs measured with the run packets from #10066. This PR does not report their combined effect.

🔗 Related links

🚫 Blocked by

🔍 What does this change?

  • The turn ends on the closing commit. The exchange's last response carries the reply and a ledger_commit with endTurn set. Once that commit is recorded, the turn ends without another model call. A refused closing commit leaves the turn open so the model can repair it. Persona runs: the closing step, about 5.5 s per turn, is gone, and the reply streams before the commit's arguments.
  • No net read at the start of an exchange. Brunch reread the net at the start of most build turns in case the user had edited it. A change against an edited net is already refused without starting, and the refusal says to read again, so the guidance now relies on that. Persona runs: build turns with a read fell from 14 of 19 to 3 of 18, about 10 s per build turn. A hand edit mid-run was refused, reread and retried.
  • Moving a node no longer makes Brunch's view stale. The document revision now hashes the net without layout. Before, a hand-moved node made Brunch's next changes fail as stale, although no net read shows positions.
  • Shorter claims. The claim guidance, spread over eight paragraphs, is now one Claims section in the system prompt: a claim is one fact as a short active statement, and each message decomposes into several. Persona runs: commits about 22% smaller, with the share of unconfirmed claims unchanged.
  • origin and status default for what the user said. origin defaults to stated. Only a stated entry may omit status, which becomes confirmed. Any other origin without a status is refused. entity/update replaces every field, so it takes neither default: an update restates origin and status. Parsing still yields the full shape, so history, receipts and the fold are unchanged.
  • Reflections give reasons. Reflections restated changes the net's names and descriptions already carry. They now say why a change was made and what its elements represent, skip tool outcomes and turns that changed nothing, use the IDs the model wrote, and name only entities their claims do not already reach.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

  • Changes only @hashintel/brunch-agent, which is private, and @apps/brunch-agent. No changeset.

📜 Does this require a change to the docs?

  • apps/brunch-agent/docs/petrinaut/ARCHITECTURE.md and the system prompt and skills describe the new turn end and read guidance.

🕸️ Does this require a change to the Turbo Graph?

  • Does not affect the execution graph.

⚠️ Known issues

  • The time savings are measured in local persona runs of a few exchanges each. They show the direction, not a benchmark.
  • Two changes rest on model behaviour, not on code: skipping the opening read, and reflections that give reasons. Tests cover the code paths; only persona runs show the model following the guidance.
  • A model that sets endTurn before it has replied would end the turn with no reply. The guidance asks for the reply first; nothing enforces it.

🛡 What tests cover this?

  • A commit ends the turn only when it sets endTurn and is recorded.
  • Only a stated entry defaults to confirmed; other origins without a status are refused.
  • Moving an element by hand leaves the model's document revision unchanged.
  • CI results are on this PR.

Stack created with GitHub Stacks CLI • Give Feedback 💬

@lunelson
lunelson added this pull request to stack #10068 October 16, 2026 16:35
@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Oct 20, 2026 4:16pm UTC
petrinaut Ready Ready Preview Oct 20, 2026 4:16pm UTC
petrinaut-docs Ready Ready Preview Oct 20, 2026 4:16pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 20, 2026 4:16pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps labels Oct 16, 2026
@lunelson
lunelson force-pushed the ln/fe-1943-shorten-turn-times-2 branch from 2ef09a4 to 748b77a Compare October 19, 2026 08:31
@lunelson lunelson changed the title ln/fe 1943 shorten turn times 2 FE-1943: Shorten Brunch's turns by cutting model calls and Ledger text Oct 19, 2026
@lunelson
lunelson force-pushed the ln/fe-1943-shorten-turn-times-2 branch from 748b77a to db37f75 Compare October 19, 2026 13:45
@lunelson
lunelson force-pushed the ln/fe-1943-shorten-turn-times-2 branch from db37f75 to 7d9adde Compare October 19, 2026 19:10
@lunelson
lunelson marked this pull request as ready for review October 19, 2026 19:40
@lunelson
lunelson requested a review from a team as a code owner October 19, 2026 19:40
kube
kube previously approved these changes Oct 20, 2026
lunelson and others added 6 commits October 20, 2026 18:07
Moving a node by hand changed the revision, so Brunch's next changes were refused as stale although no net read shows positions. The revision now hashes the document without layout.
The exchange's last response now carries the reply to the user and a ledger_commit with endTurn set; once that commit is recorded the turn ends without a closing model call. A refused closing commit leaves the turn open for its repair. Persona runs: the closing step (about 5.5 s per turn) is gone, and the reply streams before the commit's arguments.
Brunch reread the net at the start of most build turns in case the user had edited it. A change against an edited net is already refused without starting, and the refusal says to read again, so the guidance now relies on that instead. Persona runs: build turns with a read fell from 14 of 19 to 3 of 18, about 10 s per build turn; a hand edit mid-run was refused, reread and retried.
Claim guidance spread over eight paragraphs is now one Claims section in the system prompt: a claim is one fact as a short active statement, each message decomposes into several, and the model's own claims take the same form. The schema defaults origin to stated and, only for a stated entry, status to confirmed; any other origin without a status is refused. Parsing yields the full shape, so history, receipts and the fold are unchanged. Persona runs: commits about 22% smaller, with the share of unconfirmed claims unchanged.
Reflections restated changes the net's names and descriptions already carry. They now give why a change was made and what its elements represent, skip tool outcomes and turns that changed nothing, address elements by the IDs the model wrote, and name only entities their claims do not already reach.

This branch was successfully deployed

3 active deployments
Preview – petrinaut-docs — 0687a662 Deployed Oct 20, 2026 by vercel[bot]
Preview – hash — 0687a662 Deployed Oct 20, 2026 by vercel[bot]
Preview – petrinaut — 0687a662 Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants