Skip to content

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.

ActionDescription
saveStore a memory
recallRetrieve relevant memories
chatConversational query with auto-memory
browsePaginated listing of all memories
updateCorrect an existing memory
deleteRemove a memory by ID
statusCheck connection and project KB
code_memory(action="save", text="processPayment must never be called without a valid idempotency key — caused a double-charge incident in prod")
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.id

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.

  • 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”