feat: auto-discover agent context sidecars#540
Open
alleneubank wants to merge 1 commit into
Open
Conversation
Make agent review notes appear in `hunk diff` with no flags: when a repo has a `<repoRoot>/.hunk/agent-context.json` sidecar, hunk auto-loads it as agent context. - Auto-discover the conventional sidecar (best-effort: a missing or malformed conventional sidecar is silently skipped and never breaks a review). - Add an `agent_context` config key (path resolved against the repo root) and a `--no-agent-context` opt-out. Precedence: `--no-agent-context` > `--agent-context <path>` > config `agent_context` > conventional `.hunk/agent-context.json`. Explicit paths stay strict. - Show agent notes by default when a sidecar loads (`--no-agent-notes` / `agent_notes` still win). - Resolve discovery in a single config seam so it flows to both loading and the `--watch` signature; re-resolution is idempotent so watched reloads stay best-effort. - Exclude hunk's own `.hunk/` metadata from untracked working-tree review noise (git + sl). - Docs (README, agent-workflows, hunk-review skill) and a changeset. Sidecar schema is unchanged (range-based `oldRange`/`newRange`).
alleneubank
marked this pull request as ready for review
July 14, 2026 16:41
Contributor
|
PR author is not in the allowed authors list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<repoRoot>/.hunk/agent-context.jsonacross Hunk review inputs, including watch reloads--no-agent-context, and exclude.hunk/metadata from Git and Sapling working-tree review contentWhy
Agent context is most useful when it is already present when a review opens. Requiring an agent or human to remember
--agent-contexton every invocation adds friction, especially in longer sessions and stacked reviews.This keeps the existing range-based sidecar schema unchanged and adds a conventional repo-local filename. Explicit CLI/config paths still fail loudly; only zero-opt-in discovery is tolerant of a missing or stale file.
User impact
Bare review commands automatically load
.hunk/agent-context.jsonwhen it exists. Loaded notes are visible by default, existingagent_notes/--no-agent-notespreferences still win, and--no-agent-contextdisables loading entirely.Verification
bun run format:checkbun run lintbun run typecheckbun run test:theme-contrast(3 passed)bun run changeset:status -- --since=upstream/mainbun run test:integration(52 passed)bun run test(1,089 passed; 14 local process-level failures in Sapling and session-daemon tests; representative failures reproduce at the merge base)bun run test:tty-smoke(local BSDscriptrejects the harness's-fflag; reproduced at the merge base)