Persistent AI Memory Layer
Developer ToolingObsidianZshAI WorkflowKnowledge Management

Persistent AI Memory Layer

Obsidian-Backed Memory for AI Coding Agents

Introduction

AI coding agents forget everything when a session ends — the decisions, the PRD, the architectural choices. I built a persistent memory layer in a plain Obsidian vault, wired into every CLI through zsh helpers, so Claude Code, Codex, and Gemini inherit durable project context across sessions.

Details
Project NamePersistent AI Memory Layer
Timeframe2025 — Present
RoleCreator & Sole Engineer
ClientPersonal Tooling
The Problem

Every AI coding session starts from zero. Claude Code, Codex, Gemini CLI — the moment a session ends, the agent forgets what was built, the decisions that were made, the PRD, every architectural and codebase choice. The context that mattered most evaporates with the chat thread, and the next run begins blind.

Global Profile note in the Obsidian AI memory vault
_Global_Profile — long-lived preferences and universal rules loaded into every AI session
Per-project context template in the AI memory vault
Memory That Lives Outside the Chat

Instead of stuffing context back into prompts each time, I built a persistent memory layer in a plain Obsidian vault. The notes live as markdown on disk — outside any single chat thread, editable by hand, and durable across every agent and every session. The vault is the source of truth; the chat is disposable.

Session log template in the AI memory vault
Session log template — durable decisions, blockers, and the next step, written per AI run
How It's Structured

A _Global_Profile and _Standards note hold the long-lived preferences and repo-agnostic working rules injected into every run. _projects/<repo> keeps one durable note per repository — purpose, architecture, constraints, and the decisions already made and why. _session_logs/<repo>/<timestamp> captures one timestamped summary per AI run: what changed, durable decisions, blockers, and the next step.

How It Connects

A set of zsh helpers in my dotfiles wire the vault into every AI CLI. AI_MEM_ROOT points at the vault, and ai-start, ai-note, and ai-context load context, append timestamped session bullets, and emit a ready-to-paste context block. Per-client wrappers — claude-start, codex-start, gemini-start, cursor-start — inject the global profile, the active project note, and the latest prior session log straight into the launch prompt, so a fresh run inherits short-term continuity automatically.

Guardrails

A path guard refuses to touch anything outside the memory root, so an agent can never scribble beyond the vault. Git hooks enforce the rest: pre-push blocks direct pushes to main, and commit-msg requires the shell to have loaded vault context before any commit lands — memory and discipline travel together.

Scope
Obsidian vault as a persistent memory layer for AI coding agents01
Shared global profile + standards injected into every session02
Per-repo project notes capturing purpose, architecture & durable decisions03
Timestamped session logs for cross-session continuity04
zsh helpers (ai-start, ai-note, ai-context) wiring the vault into any CLI05
Per-client launch wrappers for Claude Code, Codex, Gemini & Cursor06
Path guard + git hooks enforcing safe, context-aware commits07
Graphify integration turning repos into a queryable knowledge graph08
Roadmap: open-source module so any developer can adopt the same memory layer09
The Details

Machine-portable through a single AI_MEM_ROOT env var. A caveman or standard session style toggles a terse instruction block at launch. Layered on top, Graphify turns any repo into a queryable knowledge graph across code, docs, and diagrams — the global context-reduction layer for everything I build.

Where It's Headed

Right now this memory layer is my own — tuned to my vault, my dotfiles, my workflow. The next step is to lift it off my machine and package it as an open-source module any developer can drop into their own setup. Same persistent memory, same per-repo notes and session continuity, same guardrails — but portable, documented, and configurable, so anyone running Claude Code, Codex, Gemini, or Cursor can give their agents a second brain without rebuilding the wiring from scratch. The goal is simple: persistent AI memory shouldn’t be a personal hack — it should be something the whole community can install.

Want to see more?