cd /news/artificial-intelligence/phoenix-v2-persistent-memory-emotion… Β· home β€Ί topics β€Ί artificial-intelligence β€Ί article
[ARTICLE Β· art-124071] src=github.com β†— pub= topic=artificial-intelligence verified=true sentiment=Β· neutral

Phoenix V2: persistent memory, emotional state, self-model for AI (MIT)

MIT-licensed Phoenix V2, a local-first AI assistant with persistent memory, emotional state, and self-model, has been released as a companion codebase to Cleverson Santos's book 'Building Persistent AI: Designing an Assistant That Remembers, Learns and Belongs to You'. The architecture uses a multi-agent pipeline with five specialized agents, a blackboard system, an emotion engine based on the PAD model, and a SQLite database to store memories and emotional state, ensuring continuity across model swaps and restarts. The companion paper, published on Zenodo in September 2026, formally characterizes the amnesia problem and positions Phoenix V2 against Mem0, MemGPT/Letta, Zep, and Generative Agents.

read6 min views2 publishedSep 9, 2026
Phoenix V2: persistent memory, emotional state, self-model for AI (MIT)
Image: Michielbdejong (auto-discovered)

The companion codebase for the book Building Persistent AI: Designing an Assistant That Remembers, Learns and Belongs to You by Cleverson Santos.

| πŸ“„ Companion paper | Phoenix V2: A Cognitive Architecture for Persistent, Emotionally-Aware AI Assistants on Consumer Hardware β€” Zenodo, September 2026 | | πŸ“– Book | Building Persistent AI: Designing an Assistant That Remembers, Learns and Belongs to You β€” Complete implementation guide, 26 chapters, 7 appendices | | πŸ’» Repository | This repository β€” MIT License |

The paper formally characterizes the amnesia problem, describes the full architecture with equations and a system diagram, and positions Phoenix V2 against Mem0, MemGPT/Letta, Zep, and Generative Agents. The book explains every design decision in detail, chapter by chapter, alongside this codebase.

Phoenix V2 is a local-first AI assistant with a persistent cognitive architecture. It does not rely on the LLM to maintain memory, identity, or emotional state β€” those live in a local SQLite database and survive any model swap, restart, or conversation reset.

This repository contains the complete, working source code described chapter by chapter in the book. Every file you see here is explained in detail in the text.

Concept What It Means in Phoenix
Persistent Memory Conversations are stored in SQLite and retrieved by semantic similarity across sessions
Multi-Agent Pipeline Five specialized agents (Memory β†’ Planning β†’ Action β†’ Reflection β†’ Personality) process each input in sequence
Blackboard Architecture Agents communicate through a shared in-memory workspace β€” no direct coupling between them
Emotion Engine PAD model (Pleasure-Arousal-Dominance) tracks emotional state continuously based on interaction history
Daydream Engine Background process that generates reflective thoughts when Phoenix is idle
Subconscious Cycle Runs during rest periods to consolidate memories and update beliefs
RLHF Feedback User feedback (+/βˆ’) is captured and applied to an internal reinforcement scoring system
User Input
    β”‚
    β–Ό
[ server.ts β€” Express API Gateway ]
    β”‚
    β–Ό
[ brain.ts β€” Central Orchestrator ]
    β”‚
    β”œβ”€β”€β–Ά [ MemoryAgent ]     β€” retrieves relevant past context
    β”œβ”€β”€β–Ά [ PlanningAgent ]   β€” generates a raw response draft
    β”œβ”€β”€β–Ά [ ActionAgent ]     β€” decides if a real-world tool is needed
    β”œβ”€β”€β–Ά [ ReflectionAgent ] β€” reviews the draft for coherence and safety
    └──▢ [ PersonalityAgent ]β€” applies Phoenix's voice to the final output
              β”‚
              β–Ό
    [ Blackboard ] ←─── shared working memory (volatile, per-request)
              β”‚
              β–Ό
    [ EmotionEngine ]   β€” updates PAD state after every interaction
              β”‚
              β–Ό
    [ SQLite Database ] β€” persists memories, emotional state, self-model
              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚                    β”‚
[ DaydreamEngine ]  [ SubconsciousEngine ]
  (idle background)   (rest-cycle processing)

Full architecture diagram with all connections: docs/architecture.md

phoenix-v2/
β”‚
β”œβ”€β”€ server.ts                      ← Express server + API routes
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.tsx                    ← React frontend (chat UI)
β”‚   β”œβ”€β”€ main.tsx
β”‚   └── server/
β”‚       β”œβ”€β”€ config/
β”‚       β”‚   └── settings.ts        ← Environment variables
β”‚       β”œβ”€β”€ core/
β”‚       β”‚   β”œβ”€β”€ brain.ts           ← Central orchestrator (Ch. 5)
β”‚       β”‚   β”œβ”€β”€ blackboard.ts      ← Shared working memory (Ch. 4)
β”‚       β”‚   β”œβ”€β”€ consolidation.ts   ← Memory consolidation engine (Ch. 12)
β”‚       β”‚   β”œβ”€β”€ backup.ts          ← Data export
β”‚       β”‚   β”œβ”€β”€ agents/
β”‚       β”‚   β”‚   β”œβ”€β”€ base_agent.ts       ← Abstract base class (Ch. 6)
β”‚       β”‚   β”‚   β”œβ”€β”€ memory_agent.ts     ← Memory retrieval (Ch. 6)
β”‚       β”‚   β”‚   β”œβ”€β”€ planning_agent.ts   ← Response drafting (Ch. 7)
β”‚       β”‚   β”‚   β”œβ”€β”€ action_agent.ts     ← Tool routing (Ch. 8)
β”‚       β”‚   β”‚   β”œβ”€β”€ reflection_agent.ts ← Draft validation (Ch. 9)
β”‚       β”‚   β”‚   └── personality_agent.ts← Voice and persona (Ch. 10)
β”‚       β”‚   β”œβ”€β”€ dreams/
β”‚       β”‚   β”‚   └── daydream_engine.ts  ← Idle background process (Ch. 15)
β”‚       β”‚   └── evolution/
β”‚       β”‚       β”œβ”€β”€ reinforcement.ts    ← RLHF scoring (Ch. 17)
β”‚       β”‚       └── incremental_learn.ts← Pattern learning (Ch. 18)
β”‚       β”œβ”€β”€ memory/
β”‚       β”‚   β”œβ”€β”€ memory_manager.ts   ← Retrieval with semantic + priority scoring (Ch. 11)
β”‚       β”‚   β”œβ”€β”€ storage.ts          ← SQLite persistence layer (Ch. 11)
β”‚       β”‚   └── priority.ts         ← Recency Γ— importance scoring (Ch. 11)
β”‚       β”œβ”€β”€ psychology/
β”‚       β”‚   β”œβ”€β”€ self_model.ts       ← Identity, traits, beliefs, goals (Ch. 16)
β”‚       β”‚   β”œβ”€β”€ emotion.ts          ← PAD emotion engine (Ch. 14)
β”‚       β”‚   └── subconscious.ts     ← Rest-cycle processing (Ch. 15)
β”‚       β”œβ”€β”€ scheduler/
β”‚       β”‚   β”œβ”€β”€ cron_tasks.ts       ← Timed tasks (Ch. 21)
β”‚       β”‚   └── background_jobs.ts  ← Batch processing (Ch. 21)
β”‚       β”œβ”€β”€ tools/
β”‚       β”‚   └── tool_registry.ts    ← Tool definitions for ActionAgent (Ch. 8)
β”‚       β”œβ”€β”€ users/
β”‚       β”‚   └── profile_manager.ts  ← Multi-user identity management (Ch. 23)
β”‚       └── utils/
β”‚           β”œβ”€β”€ llm_client.ts       ← Gemini API wrapper (Ch. 19)
β”‚           β”œβ”€β”€ embeddings.ts       ← Vector embedding client (Ch. 11)
β”‚           └── filters.ts          ← Output formatting helpers
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ architecture.md            ← Full architecture diagram
β”‚   β”œβ”€β”€ chapter-map.md             ← Which file = which chapter
β”‚   └── SETUP.md                   ← Detailed setup guide (all OS)
β”‚
β”œβ”€β”€ .env.example                   ← Copy this to .env and add your API key
β”œβ”€β”€ .gitignore
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── vite.config.ts

Prerequisites: Node.js 18 or higher Β· A free Gemini API key

git clone https://github.com/cleversonbrsantos-art/Phoenix.git
cd Phoenix

npm install

cp .env.example .env

npm run dev

For detailed setup instructions by operating system (Windows, Linux, macOS), see docs/SETUP.md.

  1. Go to https://aistudio.google.com/apikey
  2. Sign in with a Google account
  3. Click Create API key
  4. Copy the key into your .env file:
GEMINI_API_KEY="paste-your-key-here"

The free tier is sufficient to run Phoenix V2 for personal use.

The system starts four parallel processes:

  • Express server on port 3000 β€” serves the React UI and handles API calls
  • Vite dev server β€” compiles and hot-reloads the frontend
  • SubconsciousEngine β€” starts a background loop that runs memory consolidation every 5 minutes
  • DaydreamEngine β€” watches for idle periods and generates reflective thoughts after 2 minutes of inactivity

The SQLite database is created automatically at .data/vault/phoenix_neural_db.sqlite on first run. All memories, emotional state, and the self-model are persisted there across restarts.

This codebase maps directly to the book's structure:

Book Part Chapters Primary Files
Foundations 1–4 blackboard.ts , project setup
Cognitive Core 5–10 brain.ts , all agents
Persistence 11–13 memory/ ,consolidation.ts
Psychology 14–16 emotion.ts ,subconscious.ts ,self_model.ts
Learning 17–18 reinforcement.ts ,incremental_learn.ts
Integration 19–21 server.ts ,App.tsx ,scheduler/
Advanced 22–25 users/ , deployment, observability

For the complete file-to-chapter mapping: docs/chapter-map.md

This is the book version of Phoenix β€” the version described in the text, built on modest hardware (Intel Core i3, 8 GB RAM), without a GPU or cloud infrastructure.

It is intentionally designed to run on any modern laptop. It is not production-hardened, does not include authentication, and is not intended for multi-user deployment as-is.

The architecture, however, is built to evolve. Chapters 23 and 25 discuss how to extend it.

MIT β€” see LICENSE for details.

Cleverson Santos β€” Commercial Manager, Sinop, Brazil.

Architect of Phoenix. No formal programming background. Built this iteratively using Claude as a cognitive collaborator.

"The LLM is an external consultant, never the cognitive engine. Identity, memory, and personality live locally β€” and survive any model swap."

── more in #artificial-intelligence 4 stories Β· sorted by recency
── more on @cleverson santos 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/phoenix-v2-persisten…] indexed:0 read:6min 2026-09-09 Β· β€”