Skip to content

docs(skill): guide agents through seeding comments correctly - #680

Merged
agavra merged 1 commit into
agavra:mainfrom
martintrojer:docs/skill-agent-seeding
Sep 7, 2026
Merged

agavra merged 1 commit into
agavra:mainfrom
martintrojer:docs/skill-agent-seeding

Conversation

@martintrojer

@martintrojer martintrojer commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

This targets the second workflow the skill already names — agent review of a patch — where the agent files its findings into tuicr with review add and the human then opens the TUI to read them. The review lands on the diff, anchored to the lines it is about, instead of arriving as a wall of chat text the human has to map back onto the code themselves. They page through it with j/k, mark hunks reviewed, reply, delete the findings they disagree with, and export what survives. The human is reviewing the review, in the tool they already use for reviewing. That flow only works if the agent anchors comments to the right lines, and today nothing in the skill tells it how.

Three failure modes on that path. Each succeeds silently, so nothing steers away from it.

Reconstruct The Diff (new section). An agent needs the same diff the user sees before it can pick line numbers, and the slug says which one. Adds the scope-per-slug-segment table and the <base>~1 detail: range endpoints are inclusive, so diffing from <base> silently drops the first commit. Get this wrong and every line number is off, which is exactly how findings end up anchored to unrelated code.

--repo caveat (into Attach To A Session). [] with exit 0 also means "not a repo root" — a subdirectory returns it too. Read as "nothing open", an agent gives up while a session is running.

Verify seeded comments (into Add Agent Comments, next to the --input shape it depends on). A line past the end of the diff stores, prints back, and exits 0, but never renders — so the agent reports success on a review the human cannot see. Also: review comments reports no author, so the ids from add are the only way to tell agent comments from the user's later.

Test plan

  • Field shapes read off src/review_cli.rs and exercised against the built binary: the documented flat --input form round-trips, an array is a parse error, path is not an alias for file
  • Range recipe measured here. For commits/82e9508..b55e218, <base>~1..<head> gives 15 files / 306 insertions; <base>..<head> gives 9 / 155 — short by exactly commit 82e9508 (6 files / 151)
  • [] exit 0 reproduced for repo root, subdirectory, and nonexistent path
  • Out-of-range line reproduced: line 9999 in a 3-line file returns the stored comment, exit 0

Three failure modes an agent hits when it reviews a patch through the
CLI rather than reading the user's comments. Each one succeeds silently,
so nothing in the current skill steers away from it.

Reconstruct The Diff, a new section: an agent needs the same diff the
user is looking at before it can pick line numbers, and the slug says
which one. Adds the scope-per-slug-segment table and the `<base>~1`
detail, since range endpoints are inclusive and diffing from `<base>`
silently drops the first commit's changes.

`--repo` returning `[]` with exit 0 covers a subdirectory of a real
checkout as well as a genuinely sessionless repo. An agent reading it as
"nothing open" gives up while a session is running.

Seeded comments need verifying: a line past the end of the diff stores
fine, prints back, and exits 0, but never renders. `review comments`
reports no author, so the ids from `add` are the only way to tell agent
comments from the user's later. Folded into Add Agent Comments rather
than given its own heading, next to the `--input` shape it depends on.

Test plan:
- Field shapes read off src/review_cli.rs (AddCommentPayload,
  JsonCommentTarget::into_comment_target) and exercised against the
  built binary: the documented flat --input form round-trips; an array
  is a parse error; `path` is not an alias for `file`
- Range recipe measured on this repo. For commits/82e9508..b55e218,
  `<base>~1..<head>` gives 15 files / 306 insertions; `<base>..<head>`
  gives 9 / 155, short by exactly commit 82e9508 (6 files / 151)
- `[]` exit 0 reproduced for a repo root, a subdirectory, and a
  nonexistent path
- Out-of-range line reproduced: line 9999 in a 3-line file returns the
  stored comment and exits 0

@agavra agavra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you @martintrojer for the contribution! This looks good to me.

@agavra
agavra merged commit 897bb22 into agavra:main Sep 7, 2026
5 checks passed
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.

2 participants