Skip to content

explore: tell the agent which repositories the graph holds parsed - #1758

Merged
Evanfeenstra merged 1 commit into
mainfrom
feature/explore-graph-repos
Oct 10, 2026
Merged

Evanfeenstra merged 1 commit into
mainfrom
feature/explore-graph-repos

Conversation

@Evanfeenstra

Copy link
Copy Markdown
Collaborator

Why

An explore run with repositories checked out never touched the graph. Swarm38 run 1791645592048 made 15 fulltext_search calls, 13 file views and 0 graph calls. Meanwhile runs without repos did search, and a typed graph-search (Function,File,Endpoint) went straight to verifySphinxToken and getUserId with their descriptions. The prompt only said "Repositories checked out in your working directory", and nothing told the agent the graph holds those same repositories, parsed.

What

  • New seeded step explore/repositories: repo_agent's prependRepoInfo (mcp/src/repo/index.ts) as a step. It runs MATCH (r:Repository), normalizes source_link || name to owner/name the way normalizeRepoRef does, and compares against the checkouts case-insensitively. It returns { graph: [{ repo, ref_id }], checkedOut, note }. The note says, per repository:

    • In the graph and checked out: search the graph first with code node types, then open the files it points to for exact lines.
    • Checked out only: use fulltext_search and the file tool.
    • In the graph only: searchable in the graph, but the files aren't on disk.

    Each graph repository carries its Repository ref_id, whose documentation is an overview.

    • It never fails the run. If the graph can't be read, it returns error, and the note says the list couldn't be read (not that the graph holds none).
    • It is self-contained (imports only strut), with strut's graphCtx inlined so it shares the graph steps' cached backend.
  • explore.yaml: the step runs after checkouts, fed the checkouts' canonical names, and {{ repositories.note }} replaces the repo line in the prompt. The system prompt's graph sentence now names the code node types.

  • No default checkouts. A graph may hold 10 repos while one matters, so the graph-only ones are only named.

  • Strut bumped to a54eb43 (stakwork/strut#136): graph-search no longer describes itself as searching strut metadata only, and names the code types plus the type filter.

Tests

  • explore/seed.test.ts: the skeleton includes the new step; the prompt's note in each case (none, files only, both, graph only); repoRef and repoNote unit tests. A fake stands in for the step there, because the real one opens a backend on whatever Neo4j is at localhost:7687.
  • seeded-steps.test.ts: the step loads from a materialized workspace.
  • The real step against a throwaway Neo4j with a Repository node returned the expected note, and against an unreachable Neo4j returned error without failing.
  • npm run test:node: 890 pass, 0 fail. tsc --noEmit clean.

An explore run with repositories checked out never searched the graph
(swarm38 explore 1791645592048: 15 fulltext_search, 0 graph calls), though
the swarm's graph holds those repositories parsed. New seeded step
explore/repositories — repo_agent's prependRepoInfo as a step: MATCH
(r:Repository), normalized to owner/name, compared with the checkouts —
whose note replaces the prompt's repo line: search the graph first for an
ingested repository, read the files for one only on disk, and name what the
graph holds that was not checked out. No default checkouts. Bumps strut to
a54eb43 (strut#136: graph read step descriptions).
@Evanfeenstra
Evanfeenstra merged commit 0666e51 into main Oct 10, 2026
3 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.

1 participant