Memory & Knowledge
Two complementary systems — one for session memory, one for code-linked notes.
code_memory — cross-session persistence
Section titled “code_memory — cross-session persistence”Survives everything. Per-project Knowledge Base. Semantic search. See the full reference.
code_memory(action="save", text="processPayment must use idempotency key — caused double charge incident")code_memory(action="recall", text="payment gotchas")code_memory(action="browse", page=1, limit=10)All 14 actions: save, recall, chat, browse, update, delete, history, status, task_status, kb_create, kb_upload, kb_files, kb_delete, kb_delete_file
code_knowledge — graph-linked notes
Section titled “code_knowledge — graph-linked notes”Stored as nodes in the project graph, linked to code via edges. Auto-surfaces in code_related, code_context, and code_impact.
code_knowledge(action="save", subject="auth flow", note="JWT from /auth/login → localStorage → Authorization header → AuthGuard validates", links=["AuthController", "AuthService", "AuthGuard"], tags=["architecture", "pattern"])
code_knowledge(action="search", subject="auth")code_knowledge(action="list")code_knowledge(action="read", subject="auth flow")code_knowledge(action="delete", subject="old note")When you call code_related("AuthService"), knowledge saved with links=["AuthService"] appears automatically.
code_annotate
Section titled “code_annotate”Attach a persistent note directly to a function node.
code_annotate(name="processPayment", note="Never call without idempotency key")code_annotate(name="AuthGuard", note="Validates JWT and attaches user to request context")Annotations appear in code_get, code_context, and code_related output.
When to use which
Section titled “When to use which”code_memory | code_knowledge | code_annotate | |
|---|---|---|---|
| Survives graph rebuild | Yes | No | No |
| Linked to code nodes | No | Yes | Yes (directly) |
| Auto-surfaces in queries | On recall | Yes | Yes |
| Use for | Preferences, decisions, gotchas | Architecture notes | Function-level reminders |