[FEATURE] Plugin: knowledge-graph — Persistent memory layer with zero-interrupt architecture
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Claude Code is stateless. Every clear, every compact, every new session starts from zero. Users repeatedly re-explain what they're working on, which modules matter, and what pitfalls to avoid.
There is no built-in mechanism to:
- Remember which modules a developer was actively editing
- Preserve prohibitions and pitfalls across sessions
- Predict which related modules Claude will need before errors happen
- Survive
compactwithout losing working context
I built knowledge-graph (https://github.com/hilyfux/knowledge-graph) to solve this — a pure bash+jq persistent memory layer that works through Claude Code's existing hooks, skills, and MCP interfaces. Zero external dependencies.
Proposed Solution
Consider including knowledge-graph in the official Claude Code plugin directory or community showcase.
What it does:
- Tracks every file operation via hooks (Read/Write/Edit/Failure/Stop/SessionStart/Compact)
- Mines co-change patterns with a pure bash+jq inference engine (zero LLM cost)
- Generates distributed
CLAUDE.mdknowledge nodes (≤20 lines each) with evidence-based rules - Predicts related modules on first access and pre-loads their prohibitions
- Saves working state on session end; restores it after
clearorcompact - Never interrupts coding (v1.2 zero-interrupt architecture)
What makes it different from other memory tools:
| Aspect | knowledge-graph | Typical approaches |
|--------|----------------|-------------------|
| Dependencies | jq only | Vector DB, Python, Docker |
| Runtime cost | ~5ms per hook, 0 LLM tokens for analysis | Embedding costs, API calls |
| Learns over time | Yes (inference engine) | Static indexing |
| Predicts context | Yes (co-change history) | No |
| Survives clear/compact | Yes (snapshot + @include) | No |
| Interrupts coding | Never | Often |
| Team sharing | git push | Manual DB export |
Plugin compatibility:
plugin.jsonmanifest included- MCP Server: 4 tools (kg_status, kg_query, kg_predict, kg_cochange)
- 9 hooks covering the full lifecycle
- 15 automated tests, all passing
- MIT license
Repository: https://github.com/hilyfux/knowledge-graph
Alternative Solutions
Existing alternatives and why they don't fully solve the problem:
- Claude Code auto-memory: relies on LLM judgment for what to remember — inconsistent, no prediction, no structured rules
- mcp-knowledge-graph: requires Neo4j + Node.js + Docker — heavy dependencies, no learning
- Memento: requires Python + ChromaDB — embedding costs, no compact survival
- Caveman: token compression only — no persistence, no cross-session memory
knowledge-graph is the only solution that is zero-dependency, zero-interrupt, and verified against Claude Code's actual hook/compact/include mechanisms.
Priority
Low - Nice to have
Feature Category
MCP server integration
Use Case Example
- Developer works on a React + Node.js project with 20+ modules
- During session 1: edits
src/auth/,src/api/,src/middleware/— hits XSS issue, fixes it - Runs
/knowledge-graph update— system generates CLAUDE.md nodes with prohibition: "Raw token in localStorage → XSS" - Session 2 (or after
clear): Claude immediately knows the developer was editing auth/api/middleware (from work snapshot), and when readingsrc/auth/files, automatically pre-loads the XSS prohibition - Developer never re-explains the pitfall. Claude avoids the same mistake.
Measured results:
- clear recovery: Claude knows task context without re-explanation
- Prediction cache: same-directory re-reads go from ~200ms to ~5ms
- Token overhead: <0.5% of context window (~500-900 tokens baseline)
- 15/15 automated tests passing (performance, resilience, i18n)
Additional Context
Stats: 1599 lines of bash, 0 external dependencies beyond jq, MIT license
Version: v1.2.0 (just released)
Install: bash <(curl -fsSL https://raw.githubusercontent.com/hilyfux/knowledge-graph/main/standalone/install.sh) /path/to/project
The project was built on deep study of Claude Code internals — every hook behavior, @include mechanism, and compact/clear lifecycle is verified against the actual implementation. See: https://github.com/hilyfux/knowledge-graph/blob/main/docs/architecture-notes.md
I'd love for this to be considered for the official plugin directory or community showcase. Happy to adapt to any plugin submission requirements.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗