graph-memory
Skill1 starsChanged 3 months agoMITView on GitHub
Maintain and query the persistent knowledge graph at /workspaces/graph-memory/ (Extract -> Resolve -> Assemble -> Query, with provenance, temporal validity, confidence, and contradiction detection). 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 ("what does X depend on", "what did we decide about Y"). Also use before starting work related to previously recorded topics.
- Reads credentials
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
3 rules. About 0 are common, 1 is distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
When a durable fact emerges, either:
- Very specific: line 25
call graph_add_episode with a well-formed episode (preferred), or
- Very specific: line 36
Before assembling, reconcile names against resolve.json clusters:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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: /workspaces/graph-memory/ — JSONL triple store with provenance and
temporal validity. Schema/contracts: README.md there. MCP tools:
graph_query, graph_search, graph_add_episode, graph_invalidate,
graph_stats (wired via ~/.config/opencode/opencode.jsonc).
Operating loop
1. Capture (LLM stage — you)
When a durable fact emerges, either:
- call
graph_add_episodewith a well-formed episode (preferred), or - draft it via
node scripts/capture.mjs <file>and ask the user to approve the candidate (moves fromepisodes/candidates/intoepisodes/).
Episode rules:
- Entities central to the content only; one-line grounded description each.
- Relations connect two declared entities; predicates are short verb phrases.
source+datemandatory — no receipt, no entry.schema_version: "1".- Unverified/hearsay stays out until verified.
2. Resolve (LLM stage — you)
Before assembling, reconcile names against resolve.json clusters:
- Same real-world thing, different surface form -> add alias to the existing cluster. Use stored descriptions for disambiguation context.
- Genuinely distinct -> do nothing.
- Watch
errors.logafter assemble for DANGLING-REF and OVER-MERGE-RISK.
3. Assemble (deterministic)
node /workspaces/graph-memory/scripts/graph-assemble.mjsRebuilds nodes/edges from scratch every run (no stale merges). Read the
summary line — it reports episodes, nodes, edges, self-loops dropped, dangling
refs, invalidations, contradictions, superseded-by issues. A nonzero exit or
new entries in errors.log means fix before trusting output.
Safety rails in place: malformed episodes are rejected (never crash), output
writes are atomic, a lockfile prevents concurrent assembles, errors.log is
rewritten per run, and contradictions between currently-active facts are
flagged. Every node/edge gets a confidence score (0.5 base, +0.2 for 2+
supporting episodes, +0.2 for explicit valid_at).
4. Invalidate contradicted facts (manual overlay)
Contradiction -> graph_invalidate tool, or append to
invalidations.json keyed "subject|predicate|object" with invalid_at
and optional superseded_by, then rerun assemble. Never delete edges.
SUPERSEDED-BY-MISSING and SUPERSEDED-BY-CYCLE are validated.
5. Query / search
node /workspaces/graph-memory/scripts/graph-query.mjs "<seed or alias>" --hops=2 [--all] [--as-of=YYYY-MM-DD]
node /workspaces/graph-memory/scripts/graph-search.mjs "<text>" --top=10Or via MCP: graph_query / graph_search. --as-of filters to facts true
on that date; --all includes invalidated/future facts (marked [inactive]).
6. Health checks
graph_statsfor counts + errors.log statuserrors.logfor anything logged this run- Approval digest: pending candidates in
episodes/candidates/are printed after every assemble and emailed whenGRAPH_RESEND_API_KEY+GRAPH_EMAIL_TOare set.
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. - Occasionally red-team the store: plant a bad triple, confirm a guard catches it, log the result.
- Candidates awaiting approval are drafts — nothing in
episodes/candidates/is live until the user approves it.
When NOT to use
- Ephemeral session details (scratch values, file paths being refactored right now). 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.
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.

