DEV Community

YuhaoLin2005
YuhaoLin2005

Posted on

I Open-Sourced the Protocol That Keeps My AI From Forgetting Who I Am

Every morning, my AI assistant wakes up as a stranger.

It doesn't remember what we built yesterday. It can't tell me what I was working on, who helped me, or which mistakes I swore I'd never make again.

I spent 50 sessions fixing this. Today I'm open-sourcing the result.

The Problem No One Talks About

AI agents have a continuity problem. Not "what was the last conversation about" — that's solved by chat history. The deeper problem is identity: who did this agent become through our conversations?

Every session reset wipes what was learned, what improved, what failed. Vector databases and RAG can retrieve similar conversations. They can't tell you who the agent became. That requires a protocol — not a database.

What I Built

Imprint is a file-system identity continuity protocol. No databases. No cloud. No API keys. Files, hooks, and a closed loop.

Session N (end)                  Session N+1 (start)
─────────────────                ────────────────────
quality-gate detects             health-check reads
stale identity → writes          stale flag → triggers
.stale flag (exit 2)             identity regeneration
        └──────────────────────────┘
              the loop closes
Enter fullscreen mode Exit fullscreen mode

Three components in one pipeline:

① Pre-task calibration. Before any edit, three mandatory questions force the agent to verify it's solving the right problem. Wrong answer → exit 2, tool call blocked.

② Adversarial review. A pool of 9 sourced personas (Hickey on simplicity, Carmack on edge cases, Norman on cognitive load) cross-review output. Two reviewers flagging the same issue → auto-escalated. No fabricated citations.

③ Delivery verification. Step 0 reads back every claimed output file. Steps 1-4 audit the reasoning in damage-severity order: Honesty → Completeness → Consistency → Groundedness. Fail → session can't end.

The Loop

The core insight: 4 of 5 steps are mechanical.

  • quality_gate.py: compares file mtimes. If self-model is older than latest growth-log → stale → writes flag → exit 2.
  • health_check.py: SessionStart reads flag → emits REGENERATE_NEEDED → AI synthesizes new self-model.
  • log_regeneration.py: writes JSONL audit (fsync), then deletes flag.

Only content synthesis needs AI. Everything else is os.path.getmtime and exit codes.

Proven

Two components validated by ecosystem maintainers:

  • Adversarial review — merged with Co-authored-by attribution. Maintainer: "core idea is genuinely valuable and filled a real gap."
  • Delivery verification — approved and merged. Reviewer: "useful delivery-gate skill that focuses on thinking quality."

50+ sessions. Zero identity collapse.

Why Files

Conventional Imprint
Vector DB + embeddings Markdown + grep
Cloud-dependent Offline. Your disk.
50 pip packages Python stdlib only
"What did I say?" "Who did I become?"

If your identity protocol depends on a cloud service, your identity isn't yours. Files are forever.

Try It

git clone https://github.com/YuhaoLin2005/imprint
cd imprint && python scripts/install.py
Enter fullscreen mode Exit fullscreen mode

Restart Claude Code. Your agent remembers.

github.com/YuhaoLin2005/imprint

Top comments (0)