Local-first memory

PMB Local-First Memory for AI Coding Agents

A practical guide to using PMB-style local memory with Claude Code, Codex, Cursor, Zed, and repo instruction files without leaking project context.

最后更新: 2026年6月30日

功能对比

Memory layerBest forWhere it livesMain riskUse with
PMB local-first memoryReusable facts across coding-agent sessionsLocal app or local database such as SQLiteStale or over-broad memory can mislead future agentsClaude Code, Codex, Cursor, Zed
CLAUDE.mdStable Claude Code project instructionsRepo root or package rootCan become too long or outdatedClaude Code
AGENTS.mdPortable instructions across coding agentsRepo root or package rootGeneric guidance may miss tool-specific behaviorCodex, Claude Code, other agents
Cursor RulesEditor-scoped coding rules and file globs.cursor/rules/*.mdcRules can conflict or drift by packageCursor
Repo docs and READMEHuman-readable setup, architecture, and commandsRepository documentationAgents may need a shorter operational summaryEvery tool

Direct Answer

PMB local-first memory is useful when AI coding agents need to remember project facts across sessions without sending every detail to a hosted memory service. Treat it as a local recall layer, not a replacement for committed repo instructions.

PMB Setup Checklist

Start with a minimal local memory scope. The first setup should remember stable engineering facts, not private customer data or temporary task notes.

  • Create a local workspace for the repository and name the project clearly.
  • Store durable facts such as package manager, test commands, architecture boundaries, and recurring review preferences.
  • Keep secrets, tokens, production logs, customer data, and private messages out of long-term memory.
  • Connect one coding tool first, then test whether retrieved memory improves a real bug fix or refactor.
  • Add an owner and review cadence so stale memory can be pruned.
Memory seed:
project = ai-coding-tools-guide
package_manager = npm
build = npm run build
seo_check = npm run check:seo
safe_default = inspect files before editing; report skipped checks

PMB Vs CLAUDE.md Vs Repo Memory

Use each memory layer for a different job. CLAUDE.md and AGENTS.md should describe what the repo expects. PMB-style memory should remember useful context that changes less often than a chat but may not belong in committed files.

  • Put team-approved commands and rules in CLAUDE.md or AGENTS.md.
  • Put editor-specific globs and patterns in Cursor Rules.
  • Put reusable but personal workflow context in local-first memory.
  • Put product decisions and architecture references in docs that humans can review.

Claude Code, Codex, Cursor, And Zed

A local memory layer should adapt to the way each coding tool starts work. Claude Code benefits from explicit project memory and terminal commands, Codex benefits from portable task context, Cursor benefits from rules near the edited files, and Zed-style editor workflows benefit from concise project summaries.

  • Claude Code: keep CLAUDE.md authoritative and let local memory add recurring repo facts.
  • Codex: mirror stable constraints into AGENTS.md so delegated tasks start with portable instructions.
  • Cursor: keep .cursor/rules focused on file-level editing behavior and use memory for broader project preferences.
  • Zed or other editors: keep memory summaries short enough to paste or retrieve without flooding the prompt.

Local SQLite Memory Pattern

SQLite is a practical local-first store because it is file-based, inspectable, and easy to back up. Keep the schema boring so developers can audit what the agent remembers.

tables:
  projects(id, name, repo_path, created_at)
  memories(id, project_id, scope, summary, source, updated_at)
  reviews(id, memory_id, action, reviewer, reviewed_at)

scopes:
  command | architecture | style | testing | release | personal

Security And Privacy Checklist

Long-term memory changes the trust boundary. Review memory writes the same way you review agent tool access.

  • Do not store API keys, session cookies, tokens, passwords, or raw credentials.
  • Do not store private customer data, production incidents, or proprietary logs unless the team has approved that local retention.
  • Keep memory files outside public repos unless they are intentionally committed project instructions.
  • Add a delete and review workflow before sharing memory across machines.
  • Prefer summaries with source pointers over pasted raw files.

常见问题

Is PMB a replacement for CLAUDE.md?

No. CLAUDE.md should remain the reviewed project instruction file for Claude Code. PMB-style memory is better as a local recall layer for reusable context.

Should local AI agent memory be committed to Git?

Usually no. Commit stable team instructions such as CLAUDE.md, AGENTS.md, or Cursor Rules, but keep personal local memory outside the repository unless the team explicitly reviews it.

What should AI coding memory remember first?

Start with commands, package manager, architecture boundaries, test habits, and recurring review preferences. Avoid secrets and sensitive operational data.

Can Codex use the same memory as Claude Code?

The same facts can help both tools, but Codex should also have portable repo instructions such as AGENTS.md so task context is not locked to one client.

Why use SQLite for local memory?

SQLite keeps memory local, inspectable, easy to back up, and simple enough for developers to audit before sharing.