code_memory
code_memory gives your AI agent a persistent brain. Decisions, gotchas, architectural notes, and fix patterns survive across sessions — the agent picks up exactly where it left off.
Actions
Section titled “Actions”| Action | Description |
|---|---|
save | Store a memory |
recall | Retrieve relevant memories |
chat | Conversational query with auto-memory |
browse | Paginated listing of all memories |
update | Correct an existing memory |
delete | Remove a memory by ID |
status | Check connection and project KB |
Saving a memory
Section titled “Saving a memory”code_memory(action="save", text="processPayment must never be called without a valid idempotency key — caused a double-charge incident in prod")Recalling memories
Section titled “Recalling memories”code_memory(action="recall", text="payment gotchas")→ processPayment must never be called without a valid idempotency key...→ Stripe webhook retries can fire up to 3 times — always check event.idProject isolation
Section titled “Project isolation”Each project gets its own Knowledge Base, automatically created on first save. Memories from one project never appear in another project’s recall.
The KB ID is cached in .gl/kb_id. No manual management needed.
What to save
Section titled “What to save”- User preferences: “always use X over Y”
- Gotchas discovered: “this function has a race condition under concurrent writes”
- Decisions made: “we chose approach A because of constraint B”
- Fix patterns: “when error X happens, the fix is Y”
- Left-off notes: “TODO: finish token refresh logic in auth middleware”