Persistent memory for AI agents

Give your agent a memory that outlasts the session.

Every new session starts from zero — forgetting your preferences, decisions, and the bug you spent hours on yesterday. Cogni-Code fixes that with a persistent, inspectable knowledge graph that learns how you work across sessions.

$ npm install -g cogni-code

Works with the agent you already use

Claude Code </> Codex CLI OpenCode π pi

Provider & harness agnostic

Works with the agent you already use — on both ends.

Cogni-Code is two independent layers, and each is swappable. Run the coding agent you prefer in front, and pick the memory worker that powers the background pipeline behind it. Nothing locks you in.

Your coding agent — the one you chat with Claude Code Codex CLI OpenCode pi
Cogni-Code graph_memory · shared knowledge graph
Memory worker — the backend daemon LLM codex claude opencode pi

Switch your coding agent

Install into whichever harness you run — --claude, --codex, --opencode, or --all. Memory is shared, so switching is seamless.

Switch your memory worker

Set the daemon's LLM with --worker at install, or /memory-switch-harness anytime. Add a fallback for resilience.

How to configure both →

Why Cogni-Code

A fourth option for agent memory.

Most agent memory is built-in and opaque, locked in a vector database, or hand-written by you. Cogni-Code is something else: plain files on disk, maintained automatically, capturing behavior — not just facts.

Cogni-Code Built-in memory Vector-DB memory Hand-written files
Where it livesYour filesystemVendor cloudDatabase / SaaSYour repo
Can you read it?Yes — cat, grep, diffLimited UIPartialYes
Self-hostedYesNoSometimesYes
Maintained byBackground pipelineVendorAgent or appYou, manually
CapturesBehavior + factsMostly factsMostly factsWhatever you write
Decays when staleYesNoUsually noNo
Multi-agentYes — Claude, Codex, OpenCode, piNoSometimesManual
Writes its own toolsYes — SkillforgeNoNoNo
Git-backed historyYesNoRarelyIf you commit it

How it works

Capture, process, inject, evolve.

You just talk to your agent. Session hooks capture state into a local buffer. A separate background pipeline distills it into memory, and your next session starts already knowing who you are and where you left off.

Phase 01

Capture

Session hooks watch conversations and tool traces. Nothing is sent anywhere — hooks write to a local buffer.

Phase 02

Process

The scribe extracts deltas, the auditor finds stale nodes, the librarian applies judgment-heavy updates, the dreamer makes associations.

Phase 03

Inject

The next session starts layered: who you are, how this project works, what happened recently, what's most relevant. A few thousand tokens.

Phase 04

Evolve

Memory decays when unused, dreams surface unexpected connections, and Skillforge promotes frequently-recalled memories into commands.

See the full architecture →

The background pipeline

Watch a session flow through the pipeline.

It runs in the background, so your agent never manages memory mid-conversation. Each stage lights up as memory passes through — scribe to dreamer is the active chain.

scribecore

Reads the session buffer and extracts structured deltas — evolving opinions, frustrations, and contradictions, not just hard facts.

delta · session 2026-07-15
+ prefers blue-green deploys for prod   0.82
+ frustrated by silent deploy waits      0.61
~ decisions/deploys: canary-everywhere  stale
auditorcore

Mechanical triage — scans the whole graph for stale, contradictory, and noisy nodes.

triage · 412 nodes
✗ 6 stale      confidence < 0.3, 34d untouched
✗ 2 contradicts decisions/auth-strategy
~ 11 bloat     candidates flagged for prune
librariancore

Applies judgment-heavy updates with a prune-over-preserve philosophy, then regenerates the context files.

applied
3 upserts · 2 archived · 1 merged
→ regenerated MAP.md      174 entries
→ regenerated WORKING.md
commit a1f3c9e
dreamercore

Recombines distant nodes into speculative fragments for later validation.

fragment · emergence  0.57
“single-custody flows” — reminder
delivery, cron restore, and the token
cache all broke on shared custody.
→ linked 3 nodes
observeraux

Turns conversation patterns into structured observations, session logs, and node upserts.

observations
+ mind/observations.jsonl
  ships by vertical slice, not feature flags
+ sessions/cogni-code.jsonl
  shipped, decided, blocked, next
skillforgeaux

Promotes frequently-recalled nodes into executable slash-command skills.

recall heat
“ssh provisioning”  × 8 sessions
→ generated /provision-ssh
→ installed ~/.claude/commands
bootstrapaux

Auto-generates project docs from mental-model data.

lens · cogni-code
+ tech stack, conventions, active threads
→ wrote ./CLAUDE.md  4.2 KB
→ wrote ./AGENT.md   codex

Start in seconds

Your agent starts from zero every time.

Install, run one command, and your agent picks up where the last session left off instead of reconstructing the world from scratch.