Repository navigation
Closed
Labels
enhancementNew feature or requestreleasedseverity:lowEnhancement, refactor proposal, decision record, docs polish
Description
Parent
Sub-task of EPIC #315; resolves the actionable half of #317 (see the two proof comments there, 2026-11-06).
Problem
runInit calls ensureGraph (src/init/run.ts:154), which spawns codebase-memory-mcp cli index_repository on the first-write critical path. Proven waste:
- Cost when it works: 11.5s in-process, ~26s end-to-end per init.
- Nothing consumes the graph.
codebase-memoryis referenced only insrc/init/*and tool descriptions; gate1 resolves refs against the live file tree. Gate evidence events are identical with the graph present or absent. - It usually fails anyway: across the interactive benchmark stores
graph=unavailable×29 vsgraph=indexed×3. The 3 successes were read by zero code paths.
So users pay ~25s on memory_init (part of the B1 cold-start tax) for an artifact no code path reads.
Change
Make graph indexing opt-in. Default OFF.
- Config flag (src/core/config/paths.ts, beside
cbmBin):graphEnabled()returning true only whenprocess.env.OPENCODE_MEMORY_GRAPH === "1". Default false. - runInit (src/init/run.ts): when
!graphEnabled(), skip theensureGraphcall entirely and setgraph = { action: "disabled", mode }. Keep the existing path intact for opt-in. Stamp content already carriesgraph=${graph.action}, so it will readgraph=disabled— no stamp format change. - GraphStatus type (src/init/detect.ts): add
"disabled"to theactionunion. - Tool description (src/tools/init.ts): drop the "Ensures the codebase-memory graph for this repo is indexed (one-shot
clispawn…)" promise; state that graph indexing is opt-in viaOPENCODE_MEMORY_GRAPH=1and that memory works without it. - init summary/format (src/init/format.ts): render
Graph: disabledcleanly (no error tone). - optionalDependency: KEEP
codebase-memory-mcp. Opt-in still uses it; removing it is a separate decision that would break anyone who set the flag. Note this in the PR.
Tests
test/init.test.ts: default run assertsgraph.action === "disabled"and that noclispawn occurs (spy onBun.spawn/run).- Opt-in test: with
OPENCODE_MEMORY_GRAPH=1,ensureGraphis reached (stub the binary; do not require the real one in CI). test/scenarios.test.ts/test/resolver.test.ts: update any assertion that expectsgraph=indexed/unavailableby default.
Docs
- README: where it mentions the knowledge graph, state it is opt-in and off by default, and that retrieval/gates never required it.
Acceptance
- Fresh repo, no env:
memory_initreturns in <1s,graph=disabled, zerocodebase-memory-mcpspawns (assert in test). OPENCODE_MEMORY_GRAPH=1: prior behavior preserved.- Gate evidence unchanged for a reference vs non-reference write pair (already identical today — this must stay true).
- No regression in existing gate/write tests.
Out of scope
Building a graph consumer. If a future gate wants the index, it files its own ticket and flips the default back on with evidence that it reads the artifact.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestreleasedseverity:lowEnhancement, refactor proposal, decision record, docs polish
Activity
abogartz-opencode-self-improvement commentedon Nov 8, 2026
🎉 This issue has been resolved in version 0.16.0 🎉
The release is available on:
Your semantic-release bot 📦🚀