Self Learning Code Intelligence
Core Rule
Treat this repository as a closed learning system. Capture useful interaction facts into project-local sources, query code intelligence before risky changes, refresh graph indexes after changes, and keep all generated memory inside this repository unless the user explicitly asks to export it.
Automatic Loop
- Start with project-local context:
- Run
npm run graphify -- query "<task/question>"whengraphify-out/graph.jsonexists. - Run
npm run gitnexus:status; if stale, runnpm run gitnexus:analyze. - Read
AGENTS.md,docs/OPERATING_MODEL.md, orknowledge/README.mdonly when the task touches project boundaries or learning behavior.
- Run
- During the task, prefer project-local wrappers:
- LLM Wiki:
npm run llmwiki -- <args> - GitNexus:
npm run gitnexus:analyze,npm run gitnexus:status - Graphify:
npm run graphify -- <args> - Imported global digest:
npm run digest:imported - Obsidian inbox:
npm run obsidian:sync - Obsidian intelligence publish:
npm run obsidian:publish-intelligence - One-click digestion:
npm run learn:all - Health check:
npm run doctor
- LLM Wiki:
- After meaningful work, capture the learning:
- Run
powershell -NoProfile -ExecutionPolicy Bypass -File skills/self-learning-code-intelligence/scripts/capture-learning.ps1 -Title "<short title>" -Summary "<what changed or was learned>" - Include decisions, corrections, and open questions when useful.
- Run
- Refresh local intelligence:
- Run
npm run gitnexus:analyze - Run
npm run graphify -- update . - Run
npm run llmwiki:status - Run
npm run llmwiki -- compile --review --lang zh-CNonly when LLM Wiki provider credentials are available or the user asked for compilation. - For broad automatic ingestion or routine learning refreshes, prefer
npm run learn:allso Obsidian, imported digests, LLM Wiki review, GitNexus, Graphify, Obsidian intelligence publishing, and learning capture stay in one closed loop.
- Run
Tool Roles
| Tool | Use for | Writes |
|---|---|---|
| LLM Wiki | Persistent project knowledge, decisions, summaries, Q&A, reviewable compiled wiki | sources/, .llmwiki/, wiki/ |
| GitNexus | Code dependency graph, impact analysis, stale-index detection, refactor safety | .gitnexus/ |
| Graphify | Fast task-oriented graph query, project map, post-change graph refresh | graphify-out/, .codex/hooks.json |
| Obsidian | Human-facing inbox and project intelligence mirror for notes, graph reports, and status summaries | sources/obsidian-inbox/, Obsidian LLMWIKI/project-intelligence/ |
Capture Quality
Write source notes as facts and operational rules, not chat transcripts. Include:
- user intent and exact acceptance boundary,
- commands or tools that worked,
- commands or assumptions that failed,
- project-local decisions,
- portability or isolation implications,
- next trigger that should cause this skill to be used.
Isolation Rules
- Do not write global Codex, Claude, Cursor, or MCP config by default.
- Do not import memories or skills from other workspaces unless the user asks.
- When global project assets are imported under
project-imports/global-new-project/, treat them as references and candidate skills. Prefer LLMWIKI-local skills, memory,.env, and AGENTS.md rules. - Before using an imported global skill, read
docs/IMPORTED_GLOBAL_DIGEST.mdor the digest sources undersources/imported-global-new-project/digests/. Promote imported skills into the mainskills/directory only on explicit request or repeated local use. - Do not run Graphify
--global, GitNexus global setup, or plugin global installers unless explicitly requested. - Keep API keys in project
.env; never hardcode them in sources or skill files. - Import only the Obsidian LLMWIKI inbox by default; do not scan the whole vault unless explicitly requested.
- Generated state is rebuildable. Portable logic belongs in
tools/,skills/,knowledge/, anddocs/.
Common Mistakes
| Mistake | Correction |
|---|---|
| Answering from memory without updating local sources | Capture a compact source note before finishing |
| Running global setup because a tool suggests it | Use project-local wrappers and document any exception |
| Rebuilding Graphify but not GitNexus | Refresh both after code or workflow changes |
| Compiling LLM Wiki without credentials | Save sources first, then leave compile in review for later |
| Mixing unrelated project experience into this repo | Mark it as external or keep it out |
| Letting imported global skills override local rules | Use imported skills as references until explicitly promoted |
References
- Read
references/tool-contracts.mdwhen choosing which tool to call. - Use
scripts/capture-learning.ps1for deterministic learning capture.