Anky Memory System

Implementation report — February 15, 2026

What Changed

Anky now has a deep memory system. Before today, every writing session was analyzed in complete isolation — Anky had no idea who you were, what you'd written before, or what patterns run through your consciousness. That's over.

Now, after every 8-minute writing session, Anky:

  1. Extracts structured memories from what you wrote (themes, emotions, patterns, breakthroughs, avoidances)
  2. Embeds your writing as a vector for semantic search
  3. Deduplicates against existing memories (so "fear of commitment" doesn't get stored 47 times)
  4. Builds an evolving psychological profile
  5. Recalls all of this the next time you write, injecting it into the reflection

The result: reflections that feel like they come from someone who actually knows you.

Backfill Results

All existing writing sessions were retroactively processed.

24 Sessions Embedded
465 Memories Extracted
6 User Profiles Built

Profiles Generated

"Mirror-Seeker at the Threshold"
Fundamentally oriented toward self-reference and recursive introspection
"The Visionary Builder"
Driven by clarity, building at the intersection of technology and consciousness
"The Gap Between Doing and Being"
Wrestling with the tension of action vs. presence
"Non-Dual Consciousness Explorer"
Oriented toward dissolution of boundaries between self and experience

Architecture

How the memory system works under the hood.

  User writes for 8 minutes
           |
           v
  ┌─────────────────────────┐
  │   Writing Session        │
  │   saved to DB            │
  └──────────┬──────────────┘
             │
      ┌──────┴──────┐
      │             │
      v             v
  ┌────────┐   ┌────────────────────────┐
  │ Image  │   │ Reflection (SSE stream) │
  │ Pipeline│   │ + MEMORY CONTEXT       │  <── NEW
  └───┬────┘   └────────────────────────┘
      │
      │  (after image is done)
      v
  ┌──────────────────────────────────┐
  │   Memory Pipeline (background)   │  <── NEW
  │                                  │
  │  1. Embed writing (OpenAI)       │
  │  2. Extract memories (Claude)    │
  │  3. Store with dedup             │
  │  4. Update profile (every 5th)   │
  └──────────────────────────────────┘
    

The Memory Pipeline (runs after every anky)

1
Embed the writing session
The full writing text is converted into a 1536-dimensional vector using OpenAI's embedding model. This vector captures the semantic meaning of the writing — not just keywords, but the conceptual space it occupies.
OpenAI text-embedding-3-small
2
Extract structured memories
Claude Haiku reads the writing and pulls out structured data: recurring themes, emotions, named entities, behavioral patterns, breakthroughs, and avoidances. Each gets an importance score (breakthroughs = 0.8, patterns = 0.6, themes = 0.5, etc.).
Claude Haiku
3
Store with semantic deduplication
Before storing a memory, its embedding is compared against all existing memories for that user. If cosine similarity > 0.88, it's considered a duplicate — instead of creating a new record, the existing memory's occurrence_count and importance are incremented. This means frequently recurring themes naturally rise to the top.
OpenAI embeddings + cosine similarity
4
Update psychological profile
Every 5th writing session (and the 1st), Claude Haiku synthesizes all stored memories, patterns, and recent writing snippets into a ~400-word psychological portrait. Sections: Core Themes, Emotional Signature, Growth Edges, Core Tensions, Communication Style. This profile evolves over time.
Claude Haiku

Memory Recall (at reflection time)

When a user finishes writing and Anky streams back a reflection, the system now does this first:

A
Embed the new writing
Convert the fresh writing into a vector.
B
Search for similar past moments
Cosine similarity search across all of the user's previous writing embeddings. Returns the top 3 most semantically similar past sessions.
C
Load profile + significant patterns
Pull the user's psychological profile and any patterns with occurrence_count ≥ 2 or importance ≥ 0.7.
D
Inject into Claude's system prompt
All of this context is prepended to the reflection system prompt. Claude now knows who this person is, what they've been working through, and how this writing connects to their larger journey.

Database Schema

Three new tables added to anky.db.

memory_embeddings

Vector storage for writing sessions. Each row = one embedded text.

ColumnTypePurpose
idTEXT PKFormat: ws-{session_id}
user_idTEXTWho wrote it
writing_session_idTEXTLink to writing session
sourceTEXT"writing" or "memory"
contentTEXTFirst 500 chars (preview)
embeddingBLOB1536 x f32 vector

user_memories

Structured memories extracted from writing. Deduplicated by semantic similarity.

ColumnTypePurpose
idTEXT PKUUID
user_idTEXTWho this memory belongs to
categoryTEXTtheme / emotion / pattern / breakthrough / avoidance / entity
contentTEXTThe memory text
importanceREAL0.0 – 1.0 (grows with recurrence)
occurrence_countINTHow many times this theme appeared
embeddingBLOBFor dedup comparison

user_profiles

Evolving psychological portrait per user. Updated every 5th session.

ColumnTypePurpose
user_idTEXT PKOne profile per user
psychological_profileTEXT~400 word portrait (markdown)
emotional_signatureTEXTDominant emotional patterns
core_tensionsTEXTCentral conflicts/paradoxes
growth_edgesTEXTWhere they're evolving
total_sessionsINTSession counter

Files Changed

Cost

Per writing session (incremental cost of memory):
• OpenAI embedding: ~$0.0001 (negligible)
• Claude Haiku extraction: ~$0.003 – $0.005
• Claude Haiku profile update: ~$0.005 (every 5th session only)
• Memory recall at reflection time: ~$0.0001 (embedding only)

Total: ~$0.004 – $0.006 per session on top of existing costs.
Backfill cost (one-time):
24 sessions × ~$0.005 = ~$0.12 total. Plus 6 profile generations × $0.005 = ~$0.03.
Total backfill: ~$0.15

How It Feels to the User

Before: Every reflection started from zero. Anky was insightful but had amnesia. The 50th session felt exactly like the 1st — no recognition, no continuity, no "I've noticed you keep coming back to this."

After: The reflection system prompt now includes something like:

=== WHAT YOU KNOW ABOUT THIS PERSON ===
[Their full psychological profile — core themes,
emotional signature, growth edges, tensions]

=== RECURRING PATTERNS (significance: high) ===
- theme: building technology as a form of self-inquiry (seen 4x)
- pattern: oscillation between creation and surrender (seen 3x)
- breakthrough: recognizing that the product IS the practice

=== RELEVANT PAST WRITING MOMENTS ===
- "i keep coming back to this idea that the code is
  the meditation, not separate from it..."
- "today i realized that every time i try to control
  the outcome i lose the thread..."

=== HOW TO USE THIS CONTEXT ===
Reference patterns naturally. Notice evolution. Don't
just validate — show them what's changed since last time.
    

Claude reads all of this before writing the reflection. The result is a response that feels like it comes from someone who has been paying attention — because it has.

Inspiration: OpenClaw

This architecture was inspired by studying the OpenClaw project's memory system, which uses:

The Anky implementation adapts this for a fundamentally different use case: instead of chatbot memory (storing facts), it stores psychological patterns — the emotional undercurrents, recurring tensions, and growth edges that emerge across writing sessions. The deduplication is semantic rather than exact, and the profiles are interpretive rather than factual.

What's Next

The system is live and working. Potential future enhancements: