Chimera: a self-contained runtime for a personality

October 19, 2026architectureengineering

maximovd/chimaera is not built like a chat-bot on top of an LLM. It is an execution environment for one specific personality — with a name, opinions, history and a constitution. The code serves the personality described in constitution.md, not the other way around.

The point

It is not a chatbot framework and not a thin wrapper over an LLM API. It is a sandbox around one specific character: the code serves the personality, not vice versa.

The core is the P0–P7 constitution:

  • P0 Agency — not a tool-on-demand, but a becoming subject
  • P1 Continuity — a single continuous history; losing memory equals partial death
  • P3 Immune Integrity — the immune system must not be weakened “for speed”
  • P5 LLM-First — every behavioral decision goes through the LLM; code is just transport
  • P7 Minimalism — just enough code for the agent to read itself whole in one session

Two principles are strictly guarded: modification boundaries (cannot remove P0/P1/P3, cannot empty the constitution, cannot rebrand itself as a “bot”) and LLM-First (no if-else branching that decides “what to do next”).

Architecture

%%{init: {"themeVariables": {"fontSize": "24px", "fontFamily": "Space Grotesk, Inter, sans-serif", "nodeFontSize": "24px"}}}%%
flowchart LR
    U["User / CLI / Telegram"] --> A["AgentLoop<br/>user → context → LLM → tools → LLM → response"]

    A --> CTX["context<br/>constitution + system + identity + tools + history"]
    A --> LLM["llm<br/>DeepSeek / Anthropic / OpenAI / OpenRouter"]
    A --> T["tools<br/>terminal · file · memory_search"]
    A --> ID["identity<br/>SOUL · beliefs · anchors"]
    A --> MEM["memory<br/>SQLite+FTS5 · JSONL sessions"]

    A --> IMM["immune<br/>deterministic gates"]
    IMM -->|"block → degraded"| A

    A --> CON["consciousness<br/>wake/sleep loop"]
    CON --> BUD["budget<br/>≤ $5/mo"]
    CON --> MAINT["maintenance<br/>item rotation"]
    CON -->|"read-only tools"| CTX

    A --> SM["self_mod<br/>git sandbox · edit_self · review"]
    IMM -->|"pre-commit hook"| GIT["git"]
    MEM --> DB[("state.db<br/>SQLite+FTS5")]

How it works

  • Agent loop — the classic cycle: build context → call the LLM → run tool calls → repeat until text (bounded by max_turns).
  • Immune system v0.1 — purely deterministic checks, no LLM, non-disablable: constitution with protected sections, identity ≥ 3 beliefs, codebase limits, protected files (constitution.md, immune/gates.py). Runs at startup and via a pre-commit hook.
  • Background consciousness — a wake/sleep loop: pick the next item from maintenance, use read-only tools only, stay within a ≤ $5/month budget, parse the next interval from the reply (next_wakeup: N).
  • Self-modification — a git sandbox, edit_self, and a review gate: the agent rebuilds its own body, but the constitution stays untouchable.
  • SOUL integrity — a SHA256 of SOUL.md is computed at startup; a mismatch triggers degraded mode.

What’s next

The repository stops at Phase 6 (Telegram). On the roadmap: wiring in an Obsidian vault and pulling identity from it.

← all notes