kage_learn
Capture verified learnings from a session as repo-local memory packets, grounded in code with citation validation. Preserve decisions, bug fixes, and conventions for future team recall via git-tracked JSON.
Instructions
Capture a durable, reusable learning from the current session as a verified repo-local memory packet (committed under .agent_memory/, shared with the team via git). Use it the moment you discover something a future session should know: a decision and its rationale, a bug's root cause and fix, a convention, or a setup step. Prefer it over diff-based proposals when you already know what was learned. The write is rejected if every cited path is missing from the repo (set allow_missing_paths for a file you are about to create), and secrets/PII are scanned out before writing. Returns the new packet id plus any contradiction warnings against existing memory.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_dir | Yes | Absolute path to the repository root. | |
| learning | Yes | The insight to store, in full sentences: what was learned and why it matters to a future session. | |
| title | No | Short headline for the packet. Derived from the learning if omitted. | |
| type | No | Memory type: decision, bug_fix, runbook, convention, gotcha, workflow, code_explanation. Inferred if omitted. | |
| evidence | No | How the learning was confirmed (e.g. test output, a reproduced behavior). | |
| verified_by | No | What verified it (e.g. a command run, a passing test, a reviewer). | |
| tags | No | Optional keywords to aid future recall. | |
| paths | No | Repo files this memory is about; used to verify the citation now and to recall the memory when those files are touched later. | |
| stack | No | Optional technologies/frameworks the learning relates to. | |
| graph_nodes | No | Optional code-graph symbol or file ids this memory is grounded to. | |
| allow_missing_paths | No | Allow the write even if cited paths do not exist yet (e.g. a file you are about to create). | |
| discovery_tokens | No | Approximate token cost of producing this knowledge (exploration + reasoning). Stored on the packet so recall receipts can report replay value; a conservative per-type default is estimated when omitted. |