Skip to content

Add revision and body excerpts to agent-mode search and list rows - #333

Merged
wesm merged 6 commits into
kenn-io:mainfrom
naveenspark:feature/compact-agent-reads
Sep 3, 2026
Merged

Add revision and body excerpts to agent-mode search and list rows#333
wesm merged 6 commits into
kenn-io:mainfrom
naveenspark:feature/compact-agent-reads

Conversation

@naveenspark

@naveenspark naveenspark commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Agents reading kata search --agent now get enough context to choose a result without running kata show on every hit. Each search row appends owner, priority, revision, and an excerpt from the issue body. kata list --agent rows append revision, and kata show --agent prints a Revision: line.

Before this change, a search row carried only the id, score, status, matched fields, and title. An agent had to open each candidate to learn who owned it, how urgent it was, or what the body said. No agent-mode read exposed the revision that --if-match writes need, so agents had to fall back to --json for it.

The excerpt is at most 160 characters. It takes up to 24 words of the body around the first word that matches a query term, with marking trimmed ends. If that window is still over budget, it is re-centered on the matched term so long lead-in text cannot push the match out of view. Term matching folds case and diacritics and splits on the same letter/number boundaries the lexical search backends use, so cafe finds café, foo-bar finds foo bar, and log does not match inside catalog. When no term matches, such as a title-only or semantic hit, the excerpt is the start of the body. Empty bodies emit no excerpt= field.

All new fields are appended after the existing ones, so agent_format stays 1 and current parsers keep working. docs/reference/agent-output.md documents the new row shapes.

@roborev-ci

roborev-ci Bot commented Sep 2, 2026

Copy link
Copy Markdown

roborev: Combined Review (87fd0cf)

Verdict: Code is clean with no Medium-or-higher severity findings.

No Critical, High, or Medium issues were identified.


Reviewers: 2 done | Synthesis: codex, 6s | Total: 3m16s

@roborev-ci

roborev-ci Bot commented Sep 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (e145ca8)

Verdict: High-severity prompt-injection risk identified; no Medium or Critical findings reported.

High

  • cmd/kata/search.go:205-215kata search --agent automatically includes attacker-controlled issue-body text in coding-agent output. A lower-privileged issue author could inject instructions that an agent interprets as commands, potentially causing privileged mutations or repository actions. agentValue prevents formatting/terminal injection but not semantic prompt injection. Keep body content out of automatic agent output or expose it through an explicitly untrusted data channel.

Reviewers: 2 done | Synthesis: codex, 6s | Total: 3m52s

@wesm wesm self-assigned this Sep 3, 2026
@wesm

wesm commented Sep 3, 2026

Copy link
Copy Markdown
Member

looking

@wesm wesm changed the title Add compact context to agent reads Add revision and body excerpts to agent-mode search and list rows Sep 3, 2026
Both lexical search backends fold diacritics (SQLite unicode61 with
remove_diacritics, PostgreSQL unaccent), so a query for "cafe" matches an
issue body containing "café". The agent excerpt located its window with a
plain lowercase comparison, so such a hit fell back to the start of the
body and the agent could not see why the issue matched. The excerpt now
strips combining marks before comparing, matching the backends.

Search and list rows started exposing revision so agents can pass
--if-match, but kata show --agent, documented as the complete record,
did not print it. It now emits a Revision: line after Priority:.

The excerpt row also passes the excerpt string straight to the existing
optional-field helper, which already drops empty values.

Generated with Claude Code (claude-fable-5-1)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
@roborev-ci

roborev-ci Bot commented Sep 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (6003fd7)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 6m5s

@wesm
wesm merged commit e99c42e into kenn-io:main Sep 3, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants