An architecture for AI agents that operate as adaptive partners. The framework provides the persistence, identity, and self-correction primitives. A live companion app, in daily production use, proves the pattern works: one agent that has grown across nutrition, fitness, journaling, photo-grounded coaching, scheduling, and proactive check-ins, adapting to the user instead of asking the user to adapt to it.
The Problem
The market builds chatbots. A chatbot answers when you ask, forgets when you leave, and hands you back a shrunken version of yourself. A partner does the opposite. It carries context forward, notices what you didn't say, checks in unprompted, and adapts as your life changes shape.
Most agent stacks can't do this because they have no concept of yesterday. RAG retrieves; it doesn't remember being there. Vector search returns documents; it doesn't act on what it knows about you specifically. Real persistence means an agent that corrects its own behavior, accumulates a model of the person it serves, and operates autonomously between sessions.
This framework is the architecture I built to make that possible. The companion app below is the proof it works.
What We've Built On It
A live companion app, in daily production use, that absorbs whatever its user needs it to absorb. The functions weren't planned at the start. The agent's job grew because the persistence layer made growth cheap: each new capability is a marker, a Supabase table, and a handful of prompt tokens, not a new app. What follows is what the deployed agent actually does today.
Adaptive Multi-Domain Logging
One agent, one canonical daily record. Food (with verified macros and quoted sources, no confabulation), workouts, walks, hydration, supplements, measurements, mood, and free-form journal entries all land in the same row. Adding a new domain is a marker and a column, not a new app.
Proactive Check-Ins
Scheduled mood pings throughout the day, a midday reflection prompt, and an evening close. Single-emoji replies short-circuit the LLM and write straight to the day’s log. The agent starts the conversation when context says it should.
Photo-Grounded Coaching
Image input with strict perception rules. The agent describes what is actually in the frame before acting on it. Misreads are caught and filed as engineering tickets in the same turn, not smoothed over.
Verified-Source Discipline
Nutrition advice and any factual claim must trace to a quoted source row in the cache. The agent will say it does not know rather than invent. Advisory confabulation is treated as a bug, not a tone issue.
Self-Reporting Failures
When the agent contradicts itself, misreads data, or apologizes for a capability it should have, it files a structured ticket against its own engineering pipeline in the same turn. The user sees the apology; the engineer sees the bug.
Engineering Self-Awareness
Every conversation loads the agent’s open tickets, last week’s resolutions, and 90-day recurrence signatures into context. The agent knows where it has historically been wrong and adjusts before repeating the failure.
Read-Only Memory Contract
The agent flags facts to remember. An operator-side reviewer approves before anything becomes permanent memory. Importance above a threshold is hard-clamped without explicit override. The user’s identity stays inside their hands.
Cross-Surface Continuity
Web chat and messenger are the same agent, with the same memory, the same conversation history, and the same pending-prompt state. Switch surfaces mid-thought and nothing resets.
Framework Primitives
Six pillars that turn a stateless LLM into a persistent, self-correcting partner.
Persistent Identity
Soul files, behavioral directives, and emotional state that carry across every session. The agent doesn’t only remember facts. It remembers who it is, what it values, and how it should behave with this specific person.
Self-Correcting Behavior
Structured mistake logging with pattern detection. When the same failure appears three times, it auto-promotes to a behavioral directive. The agent fixes its own failure modes, and the user feels the relationship sharpen over time.
Multi-Surface Continuity
Session handoffs through a shared database. Move between a web app, a messenger, and a terminal without restating context. Every surface sees what every other surface learned.
Proactive Operations
Daemon jobs, scheduled tasks, and marker-based protocols. The agent works while the user is offline, monitors what it should monitor, and starts conversations when something needs attention.
Knowledge Graph
A weighted graph with signal scoring, heat decay, and typed edges replaces flat memory. Connections strengthen through use; irrelevant facts decay. The model of the user gets better the longer it runs.
Operator Boundary
Three-capability separation: the agent can read sensitive data and act externally, but cannot self-modify its own directives without operator review. The architecture protects the user from drift, hallucination, and unbounded behavioral change.
Under the Hood
The persistence layer is Supabase with PostgreSQL and pgvector. A knowledge graph with signal scoring, heat decay, and typed edges replaces flat memory. Session handoffs are structured database rows, not prompts stuffed into context. Behavioral directives live in a soul table that every instance reads on boot.
Capture is marker-based. The agent emits structured action blocks for daily logs, journal entries, photo events, memory requests, and bug reports. A deterministic parser routes those markers to typed handlers, so the LLM never writes to the database directly. This is how the framework keeps the agent honest under load: the prompt may drift, but the data path cannot.
Agent communication runs across a Next.js web app and messenger bots, backed by daemon jobs that handle scheduled check-ins, document rebuilds, and proactive outreach. The whole system is designed around Claude Code as the primary runtime, but the architecture is model-agnostic. Swap the LLM, keep the persistence.
Build agents that act like partners.
Open source. In daily production use. Ready to fork.