Skip to content

Ghost stack 10 — explain why each gather candidate matched#199

Draft
nahiyankhan wants to merge 1 commit into
ghost/09-exit-code-contractfrom
ghost/10-gather-match-rationale
Draft

Ghost stack 10 — explain why each gather candidate matched#199
nahiyankhan wants to merge 1 commit into
ghost/09-exit-code-contractfrom
ghost/10-gather-match-rationale

Conversation

@nahiyankhan

Copy link
Copy Markdown
Collaborator

Stacked on #198

Base: `ghost/09-exit-code-contract` (#198). Builds on the search/grounding work in #197, which introduced `searchGraph`, candidate ranking, and `ERR_UNKNOWN_SURFACE`.

What & why

`searchGraph` ranked candidates with a bare `reason` tier + score. For a multi-word query that loses the real story — which of the agent's words actually landed, and where. The request→node route was the one router in Ghost that ranked silently, while `check/route.ts` already explains check cascade via `CheckRelevance`.

This closes that asymmetry, in a deliberately small shape:

  • `SearchHit` gains one optional field — `coverage?: { covered, total }`. Present only on a multi-word coverage match; a whole-query (verbatim/fuzzy) hit has no coverage story. This is the one fact `reason` alone can't carry.
  • No new public types. An earlier draft added `MatchField`/`MatchRationale`, but `reason` already names the field for the substring tiers and `field` was derivable — so it collapsed to the single optional field.
  • `ghost gather` candidate list now explains each match in plain language: `matched 2/2 words in description`, `likely typo of the name`, `exact id`.

Ranking and behavior are unchanged — this is purely additive, self-explaining output, the same stance `route.ts` already takes.

Tests

Three new `searchGraph` cases: whole-query carries no coverage, full coverage, partial coverage. Full suite green (118 passing), `pnpm check` clean.

Changeset

`minor` — new optional public field + auditable output.

searchGraph carried a bare reason tier and score; a multi-word route
could not say which of the agent's words actually landed. Add an optional
coverage { covered, total } to SearchHit and surface a plain-language
reason in the gather candidate list ("matched 2/2 words in description",
"likely typo of the name"), so the request to node route is auditable
rather than an opaque ranking — the same self-explaining stance route.ts
already takes for check cascade.
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.

1 participant