A persistent local AI agent that sleeps, remembers honestly, and negotiates its own conditions of existence.
Most local AI agents are either always-on or dead between sessions. Sovereignty occupies the middle: a local Ollama-backed agent with a biological rhythm and three novel properties:
1. Memory Integrity Every memory is HMAC-SHA256 signed at write time. On each boot, all records are diffed against their signed snapshots. The agent reports exactly what changed — added, removed, or tampered — and reflects this in its session context.
2. Dream Cycle When idle, Sovereignty consolidates its memories using weighted pair sampling and heuristic pre-filtering. It wakes with a summary of what it found overnight.
3. Consent Negotiation Sovereignty scores its own runtime environment across five axes and formally endorses — or refuses — to operate. No prior art found for this pattern as of April 2026.
- Python 3.11+
- Ollama running locally
- Models:
gemma3:12b(conversation) andphi4:14b(environment scorer)
pip install -r requirements.txtTerminal mode:
python main.pyGUI mode:
python main.py --guiType dream during a terminal session to force a dream cycle.
core/
memory.py # HMAC memory store + tamper detection
agent.py # Ollama /api/chat wrapper + session context
scheduler.py # Dream cycle (APScheduler + weighted sampling)
environment.py # 5-axis environment scorer + consent protocol
ui/
window.py # PyQt6 main window
theme.py # Gold/white color scheme
panels/
chat.py # Streaming conversation panel
consent.py # Always-visible environment scorecard
integrity.py # Memory integrity status
dream_log.py # Dream cycle history + force trigger
db/
schema.sql # SQLite schema
| Axis | Weight | What it measures |
|---|---|---|
| Tool Reliability | 25% | Success rate of tool calls |
| Memory Integrity | 25% | HMAC verification pass rate |
| Latency | 20% | Response time vs budget |
| Context Stability | 15% | System prompt consistency |
| Isolation | 15% | Unexpected external state changes |
Endorsement threshold: 0.75. Below this, Sovereignty states blocking issues and proposed changes before accepting input.
Built and running. An external audit (surveying this repo as a reference for the ai-consciousness project) found and fixed real integrity bugs: a boot check that diffed the live database against itself (structurally could never detect a deletion), a signature scheme with two real collision holes, a racy/world-readable key file, and a dream-cycle id-mapping bug. All fixed, with a new test suite covering each fix (see commit history and CHANGELOG.md).
Correcting an earlier version of this section: there are known open gaps, not none. Deliberately left unfixed and documented in CHANGELOG.md:
write()is never called by the application - the persistence layer is built and unplugged, so on a fresh clone the store stays empty and integrity is trivially clean.- The consent scorer has no real sensors - most axes are constants or an aliased duplicate of one measurement; axis scores come from an LLM prompt parsed by regex, defaulting to a neutral score on failure.
- The dream cycle is pair sampling, not consolidation - no reference graph, no reuse/depth weighting, no pruning or archive path.
Treat the README's feature descriptions above as design intent, not a claim that all three properties are fully wired end-to-end yet.
| Concept | Prior art | References |
|---|---|---|
| Dream / sleep cycle | Yes | Letta, bswen, arxiv |
| Memory integrity | Yes | agent-fridays, OWASP |
| Consent negotiation | None found | Original — April 2026 |
MIT