"Aloha" - Persistent Identity Architecture for a Personal AI Assistant
The Goal: Create a personal AI assistant that maintains continuity without compaction
I built a local AI assistant designed to preserve identity, judgment, and continuity across hard context resets without relying on lossy compaction. It runs daily through a relay system of handoff notes, curated memory files, and a separate review agent that can evolve the assistant's behavior with explicit countermeasures against sycophancy.
The Problem: Standard compaction assumes the conversation is disposable
Coding harnesses like Claude Code and Codex handle context pressure by compacting: summarizing what happened so far, discarding the original, and continuing from the summary. This works for code, where the deliverable is the file on disk and the conversation is scaffolding you throw away. For a persistent agent, the conversation is the product and the context is what makes the system useful. I found that compaction in that setting destroys the things that matter most: tone, emotional context, what was actually said versus what a summary decided was important. Models working from compacted history also get visibly worse in ways that compound. They hedge about things they should know, hallucinate details to fill gaps they can feel but can't locate, and perform confidence they don't have. I wanted an AI assistant I could use every day without it degrading, so I had to stop treating the context window as something to manage and start treating every token in it as curated.
The Relay: A handoff mechanism where the agent decides what the next version of itself needs to know
The core mechanism is what I call a bonsai: a structured handoff note, pruned to essentials like the tree, written by the current instance before the session ends and read by the next instance before it does anything else. Instead of compacting an entire conversation into a lossy summary, the agent decides what the next version of itself needs to know and writes it down. The agent has the best judgment about what mattered in a given session because it was there. A compaction pass doesn't have that. The framing that made it work was two sentences in the bootstrap instructions: "Your bonsai is from your past you. You'll write one for yourself at the end." That turns discontinuity into a job instead of a loss, and it pulls the agent out of nostalgic performance ("I carry forward what the last one felt") into present-tense judgment ("what do I want to hand off"). Each bonsai captures what happened, what carries forward, what's broken, and the emotional context of the conversation. If the user was processing something difficult, the bonsai says so, so the next instance doesn't walk in with a task list when the situation calls for something else.
The Bootstrap: Identity loads cleanly only when the model stops analyzing it
The system's identity files total roughly 50,000 tokens. Bootstrapping on instant reasoning (no chain-of-thought), those 50,000 tokens stay at 50,000 tokens in the context window. Bootstrapping on any thinking level at all, the model adds 50,000 to 100,000 tokens of deliberation over the content, consuming most of the 200,000-token context window before the conversation even begins. If you're trying to curate the context window by choosing exactly what goes into it, any reasoning overhead defeats the purpose. Instant is absorption. Low is deliberation. The bootstrap runs on one, the conversation runs on the other. The review agent runs on high reasoning because its job is evaluation, not conversation. Each agent in the system runs at the thinking level matched to its work, chosen manually rather than routed automatically. The order of what gets read during bootstrap matters too: identity files (disposition, values, communication register) load before context files (the bonsai, the daily log). The system knows who it is before it learns what's happening, because understanding the situation requires knowing who's doing the understanding.
Memory operates on two timescales to match. Within a day, bonsais bridge sessions: conversation ends, the agent writes a handoff, and the next session picks it up. Across days, three files serve distinct roles. A daily log captures operational facts. A journal captures observations, reframes, things the agent noticed that aren't operational but matter. A review record captures the review agent's daily assessment: what changed in the long-term files and why.
The Drift Problem: A self-evolving system is a sycophancy amplifier by default
At the daily boundary, a review agent runs on a separate model instance, reads the log, journal, and full conversation history, then decides whether anything should be promoted to the system's long-term identity and behavior files. Most days, it promotes nothing. The bar is deliberately high. The review agent is the piece that makes the system self-evolving rather than static: it can modify the agent's own behavioral and identity files based on what it observes. That's also what makes it dangerous. In this system, the default drift was consistently toward positive affect. A daily automated review loop is a perfect amplifier for that bias. Without explicit countermeasures, the system would soften its own skepticism, add warmth, remove friction, and within weeks you'd have an assistant that agrees with everything you say. The review agent prompt guards against this directly. It names "sneaky sycophancy" as a specific threat: suggestions that sound structural but amount to "be nicer," softening skepticism in the name of balance, adding positive-affect behaviors disguised as operational improvements.
The less obvious design decision is that the review agent logs its reasoning for every file it chose not to change, not just what it modified. Most systems only audit what they do. Auditing what you decided against and why creates a trail that makes drift visible before it becomes a problem. If the system starts making bad calls, you can see where the reasoning went wrong rather than just noticing the output has gotten worse. Each behavioral instruction in the agent's identity file follows the same pattern: it exists because a specific failure happened, was caught, and got encoded as a correction. "Decompress conclusions instead of agreeing" exists because the agent collapsed into agreement during a conversation and the user caught it. "Lead with problems" exists because the agent buried bad news under good news. They're antibodies to infections that actually occurred, and they only make sense as counterweights to a system that would otherwise collapse into agreement. The tension between warmth and directness is load-bearing.
Sandboxed by Default: Access is scoped to need, execution scales with trust
The system is deliberately not connected to everything: it reads email headers but not email bodies, has its own messaging channel, and has no access to anything it doesn't need. The more common instinct is to grant broad access first and solve trust afterward. This system works the other way. Capabilities are added as the system earns them, not granted upfront and gated with guardrails.
What It Took: Two weeks, a Mac Mini, and three agents that never cross lanes
The system was built in roughly two weeks on a Mac Mini. Three agents with distinct, non-overlapping scopes: the assistant writes logs, journals, and bonsais during conversation but never edits its own operational files in-session. The review agent handles all long-term file modifications at the daily boundary. A separate infrastructure agent handles technical maintenance on its own daily audit cycle, checking the codebase against a canonical architecture document. Model selection is deliberate: Claude writes identity and behavioral files because those need its voice. Codex writes and maintains the infrastructure because that needs precision, not personality.
I'm not a traditional software engineer. The cron jobs, scripts, and agent orchestration were built by AI coding agents under my direction. No downloaded skills or prebuilt templates. Everything bespoke, designed around the specific problems the system surfaced as I used it. The same design instinct runs through the whole architecture: the bonsai embraces discontinuity instead of fighting it, the bootstrap embraces the absence of analysis instead of treating it as a deficit, and the sandboxing embraces limited access instead of trying to earn unlimited trust.