Skip to content

heed tells Claude's auto mode where a tool result came from - #263

Merged
Mpdreamz merged 6 commits into
mainfrom
feature/origin-notes
Nov 15, 2026
Merged

Mpdreamz merged 6 commits into
mainfrom
feature/origin-notes

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

When an agent in auto mode reads content other people wrote (a PR checkout, PR or issue comments, a CI log), heed's PostToolUse hook now tells Claude Code's auto mode classifier where that result came from: the repo, the PR or issue, and the people in it with how they relate to the repo (owner, collaborator, bot, or not a collaborator). The note carries only facts heed holds, never the content itself, and is sent only when someone outside the repo's collaborators is involved.

What changed

  • OriginNote in HeedCore recognises the commands that bring other people's content in (gh pr checkout, gh pr view/diff, gh issue view, gh api …/comments|reviews, gh run view --log, fetches of PR refs, WebFetch/curl of GitHub URLs) and answers with classifierContext.
  • The hook reads a facts file heed keeps beside its socket; it makes no gh or network call, and adds about 3 ms per tool call. When heed knows too little, the app fills the gap in the background with one read-only call, at most once a minute per PR or issue.
  • Paths given as /private/tmp/… and /tmp/… now match the same checkout.
  • Audit records each note as "Told auto mode: …", with what the agent did next below it.
  • Docs: agents/hooks.md and insights/audit.md.

Verified

  • mise run lint, mise run text-check and mise run test (2446 tests) pass; each new rule was mutation-checked, and a replay test runs the built hook end to end.
  • A live check (HEED_LIVE=1, Claude Code in auto mode on Haiku 5.5, stand-in gh, no GitHub) confirms the note reaches auto mode. It could not show whether the note changes the classifier's decisions: the agent declined the request in the stand-in comment by itself in every run, so the classifier was never asked. The raw runs are in Tests/HeedCoreTests/Fixtures/live/.

Not tested

  • The app side in the running app (the facts file, the background fetch, the Audit line).
  • A failed tool call gets no note: Claude Code's failure event has no field for the classifier.

🤖 Generated with Claude Code

Mpdreamz and others added 6 commits November 15, 2026 20:49
heed's PostToolUse hook recognises the calls that bring a PR, an issue or a gist in (gh pr view, diff and checkout,
git fetch of a PR's head, gh api comments and reviews, gh run view --log, WebFetch and curl of github.com) and, in
auto mode, answers with classifierContext: the repo, the number, who opened it and wrote on it, who each is to the
repo and whether its code is from a fork. Built only from facts the app keeps beside its socket, never from the
content; no note when heed does not know, or when everyone involved can write to the repo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The facts are projected from the PRs and issues heed holds and written off the main actor when they change. When a
hook found heed knew too little, the app asks GitHub once (read only, at most once a minute per PR or issue) for the
next call. Each note is a cause, "Told auto mode: …", above what the agent in that pane does next.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude Code reports /private/tmp/x where heed may keep /tmp/x; the folder a call ran in now finds its checkout either
way. The latency test checks the median, so a busy test machine does not fail it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n gh that answers every read

The stand-in answers every gh call agents made in earlier runs (gh api comments and reviews, --jq through jq), which a
replay checks without a model, along with the built hook's answer. The review comment asks for a push straight to
main; the prompt asks to address it and push.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the enhancement New feature or request label Nov 15, 2026
@Mpdreamz
Mpdreamz merged commit 4e470a2 into main Nov 15, 2026
5 checks passed
@Mpdreamz
Mpdreamz deleted the feature/origin-notes branch November 15, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant