graph-memory
Skill1 starsChanged 3 months agoMITView on GitHub
Maintain and query the persistent knowledge graph at ~/.config/opencode/graph/ (Extract -> Resolve -> Assemble -> Query with provenance and temporal validity). Use when a durable fact emerges (constraint, lesson, decision, relationship between tools/repos/orgs), when recording session learnings for future sessions, or when answering questions that need multi-hop connections across projects ("which lesson blocks which deploy path", "what does X depend on"). Also use before starting work related to previously recorded topics.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- ai-sdkSkill
- anti-slopSkill
- architecture-auditSkill
- browseSkill
- cavemanSkill
- context-budgetSkill
- design-mdSkill
- e2e-testingSkill
- error-handlingSkill
- find-skillsSkill
- fresh-context-reviewSkill
- frontend-designSkill
- grill-meSkill
- listenSkill
- manual-qa-planSkill
- next-best-practicesSkill
- nextjs-app-router-patternsSkill
- prd-to-issuesSkill
- project-feedbackSkill
- project-memorialSkill
- scrollcraftSkill
- sequential-afk-runnerSkill
- shadcnSkill
- tddSkill
- vercel-react-best-practicesSkill
- write-prdSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
When a durable fact emerges from any source (session outcome, doc, article), write an episode JSON to episodes/<date>-<slug>.json.
- Very specific: line 32
Before assembling, reconcile new names against resolve.json clusters:
- Distinctive: line 75
Use these when recording significant work:
- Very specific: line 78
After any architectural choice, record: context, decision made, alternatives rejected, and consequences.
- Very specific: line 83
After any bug, failure, or unexpected behavior that taught something durable, record: what broke, why, root cause, and what to do instead.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Graph Memory
Store: ~/.config/opencode/graph/ — private GitHub repo, zero-dependency
JSONL triple store. Schema/contracts/guards: read README.md there first if
unsure about file formats.
Operating loop
1. Extract (LLM stage — you)
When a durable fact emerges from any source (session outcome, doc, article),
write an episode JSON to episodes/<date>-<slug>.json. Contract in README.
Rules:
- Entities central to the content only; one-line grounded description each.
- Relations connect two declared entities; predicates are short verb phrases.
- Include
source+date; provenance is mandatory — no receipt, no entry. - Unverified/hearsay facts stay out until verified.
2. Resolve (LLM stage — you)
Before assembling, reconcile new names against resolve.json clusters:
- Same real-world thing, different surface form -> add alias to the existing cluster. Require contextual evidence, not string similarity; use the stored descriptions as disambiguation context.
- Genuinely distinct -> do nothing (self-cluster is automatic).
- Watch errors.log after assemble for DANGLING-REF (silent-loss guard) and OVER-MERGE-RISK (>4 aliases).
3. Assemble (deterministic)
node ~/.config/opencode/graph/scripts/graph-assemble.mjsRebuilds nodes/edges projections idempotently. Read its summary line; fix any new guards it reports.
4. Invalidate contradicted facts (manual overlay)
New information that contradicts an existing edge -> append to
invalidations.json keyed "subject|predicate|object" with invalid_at,
optionally superseded_by, then rerun assemble. Never delete edges.
5. Query (deterministic)
node ~/.config/opencode/graph/scripts/graph-query.mjs "<seed or alias>" --hops=2 [--all]Paste the (s) --[p]--> (t) lines into context and answer citing specific
edges. Use --all for historical "what did we believe then" questions.
Quality habits (the compounding part)
- Log every resolution mistake/false merge you catch to
errors.logwith what fixed it — this log outvalues any single project. - Revisit week-old resolution errors once more of the system exists around them; patterns surface late.
- Occasionally red-team your own store: plant a bad triple, confirm a guard catches it, log the result.
When NOT to use
- Ephemeral session details (file paths being refactored right now, scratch values). If it won't matter next week, it doesn't belong in episodes.
- Anything already captured verbatim by a repo's own docs — link it via an episode instead of duplicating content.
Episode templates
Use these when recording significant work:
Decision episodes
After any architectural choice, record: context, decision made, alternatives
rejected, and consequences. Use type: "DECISION" for entities. Include
rationale and alternatives_rejected fields in the episode JSON.
Lesson episodes
After any bug, failure, or unexpected behavior that taught something durable,
record: what broke, why, root cause, and what to do instead. Use
type: "LESSON" for entities. Include a lesson field with the one-sentence
takeaway.
Both templates are documented with examples in graph/README.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

