Skip to content

core, backends: evaluate bounded multi-root link traversal #3646

Closed

Description

@schlessera

Part of #3640.

Context

Following related evidence for several documents currently requires one brain_graph root per request. A multi-root traversal might share work and deduplicate returned nodes/edges, but it could also produce a larger, less useful neighbourhood. Evaluate it against parallel existing calls before committing to a new interface.

Read (walkLinks, packages/core/src/lib/link-walk.ts:39-124), (brainGraphTool, packages/ui-backend-pi/src/brain-tools.ts:259-294), core MCP graph registration inside (registerReadTools, packages/core/src/mcp-server.ts:212-414) and the parent. walkLinks already deduplicates edges within one walk and reads edges/nodes inside one transaction; this is not missing node metadata or a graph-engine replacement.

Scope

  • Compare independent parallel walks with one bounded multi-root traversal over overlapping and disjoint Odysseus project graphs.
  • Specify candidate root/direction/depth limits, global node/edge/serialized-output/work bounds, root-to-result provenance and truncation/continuation behavior.
  • Assess whether shared traversal improves useful evidence per returned byte and call, preserving each root's reachability semantics and a coherent index snapshot.

Out of scope

Shipping a production API, graph visualization/layout changes, new storage/seams, changed single-root behavior and inferred relationships that are not in the link graph. A smaller tool count alone is not success.

Acceptance criteria

  • Reproducible offline fixtures cover shared neighbours, disconnected roots, cycles, unresolved links, duplicate/missing roots, both directions, depth bounds and concurrent index updates. Use the pinned date.
  • The proposal states how roots map to returned paths/edges and prevents one large neighbourhood from silently erasing another root's coverage.
  • Returned edges retain necessary endpoint metadata; deduplication preserves associations and unresolved links, and partial results are distinguishable from a complete union.
  • Equivalent comparisons report traversal work, elapsed time, serialized bytes, duplicate content and task evidence coverage; real-model usability and token/cost claims require their own evidence rather than inference from local runtime results.
  • A written go/no-go/inconclusive decision explains whether the complexity is justified and, if positive, supplies a scoped implementation brief and contract impact. A documented no is an acceptable completion.

Verification

Exercise the actual local traversal and existing graph/MCP/Pi paths keylessly, reusing the transaction consistency test seam without relaxing it. Keep harness-only tests in experiments/ and run through bun run test. Record source/fixture/runtime identities and exact commands. Do not require external services or a private corpus.

Contract impact

None for a written spike/private prototype. A later additive root-array or new tool/result schema requires its own supported-contract update, CONTRACT: commit and changeset. No release milestone is assigned.

Triage 2026-11-08 at main 1619741f291f525d17cde4970a5ada40644117c1: Verified the cited shared operations and concrete Pi adapters. The independent brief is complete; p2 reflects wanted unscheduled work. External model evidence is optional and does not block the specified keyless work.

Activity

  1. added
    type: spike
    area: core
    area: mcp
    area: backends
    on Nov 6, 2026
  2. added
    priority: p2
    agent-ready
    on Nov 8, 2026
  3. self-assigned this
    on Nov 8, 2026
  4. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Claimed as part of the #3640 epic run (claim token c3640-ec699b9a-3646).

    • Branch: spike/3646-multi-root-graph, PR targeting the epic integration branch epic/3640-bounded-retrieval; the epic lands on main as one batch.
    • Readiness check (2026-11-08, origin/main 1619741): every code citation in this body still points at its named anchor.
    • Collision check over the cited files: no path collisions with open PRs; only shared test-category closure overlaps.
  5. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Spike result (2026-11-08): no-go — keep parallel single-root brain_graph calls.

    Delivered in #3670, merged into epic/3640-bounded-retrieval as 0ce2256. The record is docs/decisions/multi-root-graph.md, and the harness is experiments/multi-root-graph.test.ts.

    The harness ran five scenarios on an Odysseus project fixture of 172 notes dated 2026-07-12. Each scenario went through the real CLI index, the core MCP server over stdio and the Pi tool.

    • Work: shared traversal saved at most 9% of statements (56→51).
    • Bytes: deduplication saved at most 9% (62,541→56,668). Per-edge root provenance cut that to 2% (61,230). When roots barely overlap, the multi-root result was 12–17% larger than the independent calls.
    • Latency: every elapsed time was a few milliseconds, and the in-process prototype was never faster than running the single walks one after another.
    • Coverage: one call has one output budget. Cutting in root order dropped task-evidence coverage to 0.22. Taking edges from each root in turn restored it to 0.89, the same as the independent Pi calls, but only by fitting four roots into one call's budget.

    Two genuine advantages turned up: one consistent index snapshot across roots, and telling a missing root from an isolated one. Neither justifies a new contract. Tokens, cost and model usability were not measured: no paid or real-model trial was authorized.

    Reopen only with real-model or provider-usage evidence; a lower call count is not enough. The record lists the rules any future proposal must start from: per-edge roots[], global bounds on edges, nodes, characters and work, edges taken from each root in turn, an explicit partial flag, and one snapshot.

    All seven mutation checks failed their named tests when applied and passed again after restoring; the receipts are in #3670. This issue stays open until the epic lands on main. Follow-ups for the single-root tool are filed separately.

  6. schlessera commented on Nov 8, 2026

    @schlessera
    OwnerAuthor

    Follow-ups for the single-root tool, filed from this spike: #3677 (bound the MCP result), #3678 (depth cap differs: 5 over MCP, 4 over Pi), #3679 (a missing root looks like an isolated one).

  7. added this to the 0.45.0 milestone on Nov 8, 2026
  8. removed their assignment
    on Nov 8, 2026
  9. added a commit that references this issue on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: backendsarea: corearea: mcppriority: p2type: spike

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions