Skip to content

Architecture

Design Principles

The P31 EDE follows three core principles:

Delta Topology — Reject hierarchy and centralization. Every subsystem forms a self-supporting triangle of redundancy. The three-agent AI mesh (Claude, DeepSeek, Gemini) mirrors this: no single model is a dependency.

Local-First — All data lives on the operator’s machine first. Neo4j runs locally. Ollama provides offline AI. The system degrades gracefully when cloud services are unavailable.

Cognitive Sovereignty — The operator’s attention is the scarcest resource. Every design decision optimizes for spoon conservation: progressive disclosure, voltage scoring, batched notifications, and adaptive UI complexity.

System Topology

┌─────────────────────────────────────────────────┐
│ Caddy (:80/:443) │
│ Reverse Proxy + TLS │
├────────────────┬────────────────┬────────────────┤
│ Frontend :3031 │ Backend :8031 │ Docs :4321 │
│ React + Three │ FastAPI + WS │ Astro Starlight│
├────────────────┴────────────────┴────────────────┤
│ AI Mesh (LiteLLM :4000) │
│ Claude │ DeepSeek │ Gemini │ Ollama (local) │
├──────────────────────────────────────────────────┤
│ Neo4j Knowledge Graph :7474 │
│ 4-Axis Taxonomy (A/B/C/D) │
├──────────────────────────────────────────────────┤
│ ESP32-S3 Firmware (Thick Click) │
│ WebSerial ↔ COBS/CRC8 @ 115200 │
└──────────────────────────────────────────────────┘

Protocol

All hardware communication uses the P31 serial protocol:

ParameterValue
Magic byte0x31 (Phosphorus-31)
CRC8 polynomial0x31 (CRC8-MAXIM)
CRC8 init0xFF
Frame encodingCOBS
Delimiter0x00
Baud115200
USBNative CDC (GPIO19/20)

Frame structure: COBS_ENCODE(magic | cmd | payload | crc8) + 0x00

Taxonomy

The knowledge graph organizes all information into four axes:

AxisDomainColorExamples
AIdentity#ff6b6bAuthentication, profiles, personal data
BHealth#4ecdc4Spoons, breathing, wellness tracking
CLegal#ffe66dLicenses, compliance, court documents
DTechnical#a29bfeCode, infrastructure, firmware

Progressive Disclosure

UI complexity adapts to operator energy:

LayerNameSpoonsVisible
0Breathe< 3Breathing pacer only
1Focus3-6Editor + AI chat
2Build6-9Full IDE (default)
3Command9-12All systems