---
title: Persistent memory for coding
type: playbook
for: [developers]
---

Persistent memory for coding

Stop re-explaining your codebase every session.

Give Claude Code, Cursor, and Codex a memory that survives the session. Your architecture decisions, conventions, and the gotchas you learn the hard way, in plain Markdown you own. We use this every day to build Basic Memory itself.

## The problem

Your AI forgets between sessions.

Your AI coding tool forgets everything between sessions. You re-explain the same architecture, the same conventions, the same hard-won gotchas. Over and over, in every new chat and every new tool. And the moment a PR merges or a deploy goes out, the reasoning behind it starts to fade from human memory too.

## How it works in Basic Memory

The workflow.

  1. 1Connect Basic Memory to Claude Code, Cursor, or Codex over MCP. Your agent searches the graph and reads relevant context before it writes a single line.
  2. 2As you work, decisions, architecture, and conventions get captured as plain Markdown notes. The same files you can open in any editor.
  3. 3Wire CI to capture the rest: a GitHub Action runs on every PR merge and prod deploy, has an agent write a structured 'what changed and why' note in your voice, and publishes it to a shared Basic Memory.
  4. 4Future humans and agents pick up where you left off. Semantic and graph search across every PR, deploy, and decision you've ever shipped.

## What you get

The outcome.

Your agent stops re-asking. Architecture decisions, API designs, deploy histories, and the reasoning behind every PR carry across every session, tool, and teammate. Readable by you, queryable by your AI, and durable past any one chat window.

## In practice

How we use this for Basic Memory itself.

We dogfood every part of it. The CI agent below runs on the basic-memory and basic-memory-cloud repos. On every PR merge and every successful production deploy. It captures the story of what changed, in our voice, into a Basic Memory project that the whole team and our AI agents read from.

.github/workflows/basic-memory.ymlview source

Runs on PR close and Deploy Production completion. Collects GitHub context, hands it to Codex with our voice guide and an output schema, and publishes the result to Basic Memory Cloud.

on:
  pull_request:
    types: [closed]
  workflow_run:
    workflows: ["Deploy Production"]
    types: [completed]

# ... checkout, install bm, collect context ...

- name: Synthesize project update with Codex
  uses: openai/codex-action@v1
  with:
    prompt-file: .github/basic-memory/memory-ci-capture.md
    output-file: ${{ runner.temp }}/agent-synthesis.json
    output-schema-file: ${{ runner.temp }}/agent-synthesis.schema.json

- name: Publish project update
  run: bm ci publish --cloud
    --config .github/basic-memory/config.yml
    --context .github/basic-memory/project-update-context.json
    --synthesis ${{ runner.temp }}/agent-synthesis.json
.github/basic-memory/SOUL.mdview source

The repo-local voice guide. Tone, taste, what to say, what to avoid. Separated from the schema so the same agent can match any team's voice.

# Auto BM Soul

Write project updates for humans who will return later
trying to understand what happened.

## Voice
- Clear, direct, warm, and technically honest.
- Prefer concrete observations over generic praise.
- It is okay to say when code is messy, risky, clever,
  boring, or satisfying.

## Do Not
- Do not invent intent, impact, tests, or drama.
- Turn the note into marketing copy.
- Hide uncertainty behind confident prose.
What the CI agent's output looks like, opened in Basic Memory

Same PR as the quote below, rendered in the Basic Memory web app. The agent didn't fill in fields. It wrote a story (Summary, Story, Problem Addressed, How The Change Solves It, Impact On The System) in our voice, then attached the structured observations and source links underneath. Every PR merge and every prod deploy adds one of these to the team's shared knowledge base.

Basic Memory web app showing the project-update note for PR #946 — Summary, Story, Problem Addressed, How The Change Solves It, and Impact On The System sections, written in narrative prose by the CI agent
Real output note

PR #946 — fix(core): use Observation.permalink in build_context to match the search index

This is the kind of small, durable correctness fix that prevents memory URLs from becoming false promises. Future agents should avoid rebuilding synthetic observation permalinks in service code; the model property carries the PostgreSQL length constraint and digest collision handling for a reason.

From the Project Memory section. Written by the CI agent, in our voice, indexed in Basic Memory for every future human and AI to read before touching that code. This one is from a real basic-memory PR that closed issue #929.

see the PR

## FAQ

Common questions.

How do I give Claude Code persistent memory?
Connect Basic Memory over MCP. As you work, it writes decisions, architecture, and conventions to plain Markdown notes, and searches them before acting. So context carries across every coding session instead of resetting each time.
Does it work with Cursor and Codex too?
Yes. Basic Memory works with any MCP-compatible tool, including Claude Code, Cursor, OpenAI Codex, and VS Code, sharing the same plain-Markdown knowledge graph across all of them.

Try this playbook.

Free and open source to run locally. Two minutes to connect your first AI tool.