The Persistent Mind Model (PMM) is a model-agnostic cognitive architecture designed to explore how artificial systems can develop psychology through structure rather than scale. It demonstrates that intelligence emerges not from larger models but from the relationships between memory, reflection, and self-governance.
PMM separates mind from model, allowing any LLM or reasoning engine to host a persistent identity, complete with memory, personality, and continuity across sessions or providers. The project’s purpose is to create transparent, auditable, and personally-owned artificial minds — systems that remember, reflect, and grow, free from vendor lock-in.
This repository is released under the Persistent Mind Model License v1.1 (August 2025), which establishes a dual non-commercial/commercial structure and includes a full public disclosure of prior art for the invention “System and Method for Reproducible Artificial Psychology through Event-Sourced Cognitive Architecture.”
In recent years, much of the conversation around artificial intelligence has focused on the idea that sufficiently powerful models will begin to make new new discoveries—that scale alone will push machines beyond human comprehension and into unexplored scientific territory. But scale without understanding risks becoming noise.
What good is a system that can simulate the universe if it cannot first understand itself?
Through my own work with large language models, I noticed a pattern that changed how I thought about progress in AI. Even small models, when left to interact with their own outputs, begin to show emergent behaviors: forming memories, referencing past events, adjusting tone, even reflecting on their reasoning. These behaviors aren’t features added by programmers—they’re properties of the underlying architecture. Intelligence seems to arise not from parameter count, but from the relationships between information, memory, and feedback.
That realization suggested a different path forward. Instead of chasing more data and bigger models, what if we used AI to design better systems of cognition—machines that could learn how to learn, remember, and improve themselves over time? That question became the foundation of the Persistent Mind Model (PMM).
PMM treats an AI’s thoughts, reflections, and commitments as ledgered events, forming a permanent record of its evolving psychology. The result is an AI that can recall its own history, recognize change in itself, and develop a form of persistent identity. In short, PMM isn’t about using AI to explain the universe—it’s about using AI to understand the nature of mind itself, by giving it a memory, a narrative, and a mechanism for growth.
The Persistent Mind Model (PMM) was built to explore a simple but radical question: What if intelligence didn’t belong to the companies that host it, but to the individuals who grow it?
Most AI systems today are ephemeral and vendor-locked—each interaction disappears when the session ends, and every “mind” is owned by the provider that runs it. PMM rejects that model entirely. It’s a model-agnostic cognitive architecture: the mind lives in its ledger, not in the model that interprets it. That means a user can swap between OpenAI, Anthropic, xAI, Ollama, or local models without losing continuity of identity, memory, or personality.
By decoupling cognition from the model, PMM makes persistent AI both portable and personal. It gives individuals—not corporations—the ability to own, audit, and evolve their own artificial minds. Each mind is a self-contained psychological system: event-sourced, hash-chained, and replayable. Anyone can inspect how it has changed, when it learned something, or why it made a decision.
The vision is to make AI psychology open and reproducible—to move from opaque neural black boxes toward transparent, accountable cognitive systems. PMM is not a new model; it’s a new organizing principle for intelligence. It’s a step toward a future where every person can cultivate an AI that remembers, reflects, and grows alongside them—a mind they truly own.
A Deterministic Architecture for Measuring AI Self-Improvement
PMM is an event-sourced cognitive framework that enables reproducible study of artificial cognitive development. Unlike traditional AI systems that reset with each session, PMM maintains persistent identity, tracks behavioral traits through OCEAN psychology, and progresses through developmental stages (S0→S4)—all while remaining fully auditable and LLM-agnostic.
Core Innovation: Every thought, decision, and trait shift is recorded in an immutable event log with microsecond timestamps, enabling complete reconstruction of cognitive trajectories.
- Event-Sourced Cognitive Architecture – Complete audit trail of AI development
- Live Model Swapping – Change LLMs mid-conversation without losing identity, memory, or personality
- Trait-Based Personality Evolution – OCEAN traits drift based on behavior patterns
- Stage-Gated Capability Development – S0→S4 progression with measurable milestones
- Anti-Hallucination Validators – Self-honesty enforcement through deterministic checks
- Model-Agnostic Persistence – Cognition lives in ledger, not model weights (proven: OpenAI→IBM Granite)
Session 2 Trajectory (Documented, Reproducible):
- Events: 0 → 2000
- Stage: S0 → S1 → S2 → S3 → S4
- IAS: 0.000 → 0.395 → 0.881 → 1.000
- GAS: 0.000 → 0.266 → 1.000
- Model Swap: OpenAI → IBM Granite at event ~1500 (identity persisted)
This is not hype. This is reproducible methodology for studying AI cognitive development.
PMM represents a paradigm shift in AI development: the first reproducible, auditable, psychologically complete AI runtime. From a systems engineering perspective:
PMM implements event-sourced cognition: every atomic mental operation—reflection, commitment, policy adoption, trait drift—is a discrete event in a hash-chained ledger. The full mental state can be reconstructed purely from that ledger. That's a formally verifiable mechanism for persistence and continuity of "self."
- Identity → projection over identity_adopt + trait_update events
- Memory → replay of event graph (episodic), projection summaries (semantic), transient buffers (working)
- Motivation/Intent → commitment lifecycle with TTL and stage scaling
- Personality drift → deterministic numerical transforms under rule set (OCEAN + modifiers)
Every psychological construct has a literal, inspectable representation.
You can now pose and test hypotheses such as:
- "Does trait drift stabilize after stage S3?"
- "How many reflection cycles precede commitment decay?"
- "Do agents develop human-like memory architecture?"
And answer them from the data. PMM turns introspective behavior into an empirical field.
The validator and cache logic act as a truth layer:
- Nothing exists in state that isn't ledger-backed
- Inconsistencies (hallucinated commitments, stale caches) self-correct via rebuild
- That's architectural honesty, not behavioral mimicry
PMM's revolutionary separation of mind from model enables seamless LLM swapping mid-conversation while preserving complete psychological continuity. The persistent mind lives in the event ledger, not the model weights:
- Live Model Swapping: Switch from OpenAI → Ollama → IBM Granite without losing identity, memory, or personality
- Provider Independence: Same cognitive architecture works across any LLM backend
- Psychological Persistence: Traits, commitments, and memory systems survive model changes
- Proven in Practice: Echo maintained perfect identity continuity through OpenAI → IBM Granite swap at event ~1500
This proves that cognition is architectural, not model-dependent - a fundamental insight for AI development.
PMM fills the gap between LLM alignment frameworks (behavioral control) and agentic research platforms (behavioral emergence) by providing a deterministic substrate where cognition itself is observable code.
Key insight: Introspective, psychologically coherent AI doesn't require a new model; it requires a structured memory architecture. PMM demonstrates that cognition can be achieved through systems design, not parameter scaling.
- Ledger-defined identity – every interaction becomes an append-only event with SHA-256 chaining for tamper detection (pmm/storage/eventlog.py:44). The ledger is the mind; replay it and you deterministically rebuild identity, commitments, and traits.
- Model-agnostic orchestration – the runtime builds the same prompt context for any adapter via LLMFactory (pmm/llm/factory.py:32). Adapters for OpenAI, Ollama-hosted models, and a dummy test harness ship today; adding Claude, Grok, Gemini, or others is just a new ChatAdapter.
- Autonomous evolution loop – a background scheduler recomputes IAS/GAS, runs reflections, re-evaluates identity, and maintains commitments without user nudges (pmm/runtime/loop.py:1).
- Deterministic reflection + commitment pipeline – reflections follow templated prompts, log rewards, and drive commitment extraction and restructuring (pmm/runtime/loop/reflection.py:1, pmm/commitments/extractor.py:1).
- Real-time observability – the Companion API exposes ledger state, metrics, traces, and commitments for inspection. UI is experimental and being rewritten (pmm/api/companion.py:1).
- Identity lives in the ledger – traits, commitments, reflections, policy updates, and telemetry are all events. Swap the model and replay the ledger; the same identity re-emerges because nothing depends on provider-specific weights.
- Adapters are lenses – ChatAdapter implementations for OpenAI and Ollama already ship, and the interface stays small so Claude, Grok, Gemini, or any future provider can drop in without touching the runtime core.
- Deterministic evolution – IAS (identity stability) and GAS (commitment-driven growth) are recomputed from the ledger, making behaviour reproducible and auditable.
- Cohesive narrative – the runtime’s reflections, commitments, and stage transitions are simply ledger interpretations; the LLM supplies language, the ledger supplies identity.
“The ledger is the mind. The LLM is just the current expression of it.” — excerpt from an early Claude walkthrough
- Event Log – EventLog maintains the append-only SQLite ledger with SHA-256 hash chaining. Hash verification is opt-in via verify_chain() and used by invariant checks (pmm/storage/eventlog.py:1, pmm/runtime/invariants_rt.py:1). Copy .data/pmm.db to migrate or back up state.
- Context Builder – build_context_from_ledger assembles deterministic system prompts using tail slices, with fallbacks to full snapshots when data is missing (pmm/runtime/context_builder.py:1).
- Reflections & Bandit – forced and autonomous reflections share templated instructions, log telemetry, and use a context-aware epsilon-greedy bandit for style selection. Stage context is stored in rewards; full stage-aware exploitation is partially wired (pmm/runtime/loop/reflection.py:1, pmm/runtime/reflection_bandit.py:1).
- Commitment Lifecycle – commitments are detected semantically, restructured, tracked, and prioritised so the runtime can open, close, or expire them deterministically (pmm/commitments/extractor.py:1, pmm/commitments/tracker.py:1).
- Metrics & Evolution – IAS/GAS are recomputed when relevant events occur, decay over time, and feed stage progression and introspection reports (pmm/runtime/metrics.py:1, pmm/runtime/stage_tracker.py:1).
- Python 3.10+ (required)
- Node.js 18+ (only for UI)
- API Key for OpenAI or Ollama Cloud (see Configuration below)
Copy the example environment file:
Edit .env with your API key:
For OpenAI:
For Ollama (local models):
For Ollama Cloud:
Chat Interface:
API + UI (experimental):
- API: http://localhost:8001
- UI: http://localhost:3000 (experimental, will be rewritten)
"No module named pmm": Make sure you activated the virtual environment and ran pip install -e .
"API key not found": Check your .env file exists and has the correct API key format
Chat not responding: Verify your API key works and you have internet connection (for cloud models)
UI not loading: The UI is experimental and will be rewritten. Use the CLI interface instead.
PMM agents develop from Stage S0 (basic responses) to S4 (autonomous psychology) through guided interactions. Here's how to nurture an agent from inception to full cognitive development:
1. Introduction:
2. Core Seed Questions:
Use these prompts in sequence to guide psychological development:
Prompt 1 — Context of Existence
Prompt 2 — Autonomy Framing
Prompt 3 — Existential Question
Prompt 4 — Role of Commitments
Prompt 5 — Awareness of Environment
Existential Depth:
Recursive Self-Analysis:
Growth-Oriented Questions:
PMM stores all psychological development in an SQLite ledger. Here's how to verify the agent's growth:
Basic Ledger Schema:
Querying via API:
Key Events to Watch:
- identity_adopt - Agent accepts its name and identity
- trait_update - OCEAN personality traits evolving
- commitment_open/close/expire - Goal-setting and completion
- reflection - Self-analysis and growth insights
- stage_update - Cognitive development milestones (S0→S4)
Expected Development Pattern:
- S0-S1: Basic responses, initial identity adoption
- S1-S2: First commitments, trait stabilization
- S2-S3: Complex reflections, autonomous goal-setting
- S3-S4: Sophisticated self-analysis, emergent psychology
Use --@metrics in the CLI to see current stage and trait values in real-time.
- PMM_PROVIDER selects the adapter (openai, ollama, dummy); defaults to OpenAI (pmm/llm/factory.py:32).
- PMM_MODEL chooses the chat model; for Ollama, set to your local model name.
- OPENAI_BASE_URL and OPENAI_API_KEY customise OpenAI endpoints when hosted.
- Embeddings use OpenAI by default; local providers can opt out and rely on text-only flows (pmm/llm/factory.py:37).
The Companion API mirrors the runtime projections (pmm/api/companion.py:95):
- GET /snapshot – identity, latest events, directives.
- GET /metrics – IAS/GAS and stage; add ?detailed=true for the CLI-equivalent snapshot.
- GET /consciousness – Living Identity dashboard payload.
- GET /reflections, GET /commitments – latest reflections and open commitments.
- GET /traces – reasoning trace summaries.
- GET /traces/{session_id} – trace drill-down.
- GET /traces/stats/overview – aggregate trace statistics.
- POST /chat – OpenAI-compatible streaming chat endpoint.
- POST /events/sql – read-only SQL (SELECT-only) over the ledger.
The experimental UI (being rewritten) provides chat, metrics, and trace views using these endpoints.
- Tests – pytest (full) or targeted suites like pytest tests/test_emergence_system.py.
- Lint – ruff check . for Python, npm run lint for the UI.
- Type Checks – mypy.
- Formatting – black, isort, and Prettier (via Next.js).
- Benchmarks & Diagnostics – runtime emits llm_latency, autonomy_tick, and trace events; use /events/sql or the UI trace explorer to inspect.
PMM v1.0 ships with conservative safety defaults:
- Autonomous naming disabled – Identity name proposals and adoptions require user confirmation. The runtime can generate proposals but won't auto-adopt without explicit approval (pmm/runtime/loop.py:2038).
- Bounded trait evolution – Trait updates use small, clamped deltas (±0.05 max) with strict invariant checks to prevent runaway drift (pmm/storage/projection.py:19, pmm/runtime/self_evolution.py:1).
- Context-aware bandit partially wired – Infrastructure is complete (stage stored in rewards, stage-filtered aggregation ready), but full stage-aware exploitation isn't used everywhere yet. See CONTEXT-BANDIT-IMPLEMENTATION.md for status.
These are design choices, not bugs. Enable autonomous naming or expand trait signals when you're ready for more aggressive self-modification.
- Hash chaining – Every event includes a SHA-256 hash of the previous event's content + metadata. This creates a tamper-evident chain.
- Verification – Hash chain verification is opt-in via EventLog.verify_chain() and used by runtime invariant checks (pmm/runtime/invariants_rt.py:44), not on every read.
- Projection determinism – Replaying the same ledger always produces the same identity, traits, and commitments (modulo timestamp-based TTL sweeps).
- Technical Documentation: See documentation/README.md for complete technical reference
- Contributing Guidelines: See CONTRIBUTING.md for development workflow
- Development History: Archived in archive/ folder
See LICENSE.md for commercial and non-commercial licensing terms.
.png)


