Skip to content

resources-graph: tracer bullet — single issues, PRs and repos served from memory - #470

Merged
antejavor merged 2 commits into
mainfrom
feat/resources-graph-tracer
Oct 8, 2026
Merged

antejavor merged 2 commits into
mainfrom
feat/resources-graph-tracer

Conversation

@antejavor

@antejavor antejavor commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #465. First slice of PRD: resources-graph: an agent reads a public GitHub issue, PR or repository; a later read is served from memory.

What's in it

New context-graph/resources-graph package:

  • Address parser (pure): WebFetch URLs, gh issue|pr|repo view, gh api repos/..., curl to api.github.com, GitHub MCP tools, prompt links and owner/repo#n → normalised Addresses. gh without -R is skipped (the repo would come from the cwd).
  • Connector: tool starts → FETCHED Touches, user prompts → PROMPTED Touches, finished resource calls → Cache Reads. No network in hooks.
  • Sweep (resources-graph sweep): pending Touches → Resources via GraphQL, public-only, items resolved by issueOrPullRequest(number), comments/files/review threads paged to the end; failures kept as Unresolved Touches (not_found / not_public / rate_limited). FETCHED Touches refetch; PROMPTED ones of stored Resources just resolve.
  • resource tool: served by agent-context-graph mcp; returns content + fetched_at + updated_at, never calls GitHub, writes nothing.

Credentials: the Sweep fetches with the user's own gh login (gh auth token) — the access the agent already reads GitHub with — so most users configure nothing. github.token in the config file is an optional override that wins when set (amends the capture-model decision, see #457).

agent-context-graph: github.token config key (secret, survives bootstrap), --connector resources-graph in the runner and schema setup, doctor check.

Decisions worth a look

  • Cache Reads are recorded by the connector, not the tool: the MCP tool can't see the session. The tool's answer starts [resource hit|miss] <address>; the connector records the Cache Read from the post-tool event.
  • Moved resources (renamed repo, transferred issue): the Touch resolves to the Resource's new Address; the old holder loses the Address.
  • An item's Repository is always fetched and stored with its README first — no content-less Repository nodes.
  • sessions-graph is a test-only dependency so privacy tests use the real owner of (:User)-[:HAD_SESSION].

Testing

  • 69 tests on a real Memgraph (./scripts/dev-memgraph.sh test resources-graph): unit tests for the parser and the GitHub source; e2e for read-twice, private Touches / shared Resources, PR via /issues/N, refetch dropping deleted comments, unresolved reasons, idempotent hook re-delivery; token resolution (gh login, override, logged out, no gh); the real hook run claude-code path. GitHub is replayed from responses recorded on memgraph/memgraph (tests/fixtures/record.py), plus one live test when GITHUB_TOKEN is set.
  • agent-context-graph: 167 pass.
  • Dogfooded against live GitHub with a throwaway config: hook payloads → Touches → resources-graph sweep → resource hit/miss through the MCP tool registry; and a Sweep with no github.token configured, fetching with the gh login.

The README links CONTEXT.md, which arrives with #461.

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.

resources-graph: tracer bullet — single issues, PRs and repos served from memory

1 participant