Four Layers
┌──────────────────────────────────────────────────────────────────┐
│ OpenCLIs LAYERS │
├──────────────────────────────────────────────────────────────────┤
│ │
│ RUNTIME │
│ Shared PTY terminal. Human and AI in the same shell. │
│ Any CLI invokes any other CLI via shell command. │
│ Each CLI uses its official model on human's subscription. │
│ │
│ OBSERVATION │
│ Every file change recorded in real time. │
│ Every save diffed against HEAD and stored. │
│ When commit happens, all saves link to it. │
│ Git sees the result. OpenCLIs sees the journey. │
│ │
│ MEMORY │
│ Reads sessions from Claude, Codex, OpenCode, Gemini. │
│ Indexes into single searchable database. │
│ Any model recalls what any other model did. │
│ Sessions end. Models change. Memory stays. │
│ │
│ UNDERSTANDING │
│ Shared tools for human and AI alike. │
│ Code search, document search, git structure, visual alignment. │
│ Same tool, same result, regardless of who calls it. │
│ Human sees AI's work. AI uses human's tools. │
│ │
└──────────────────────────────────────────────────────────────────┘
Layer 1: Runtime
The foundation. A PTY terminal where human and AI share the same shell.
┌──────────────────────────────────────────────────────────────────┐
│ RUNTIME │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Human types: $ codex "review this function" │
│ AI types: $ codex "review this function" │
│ │
│ Same command. Same PTY. Same result. │
│ │
│ Claude running in Tab 1 can: │
│ $ codex "check this approach" │
│ $ gemini "analyze this error" │
│ $ opencode "run these tests" │
│ │
│ No API keys passed. No SDK imported. │
│ Just shell commands, like a human would type. │
│ Each CLI authenticates with its own subscription. │
│ │
└──────────────────────────────────────────────────────────────────┘
The PTY daemon runs as a sidecar binary — if the app crashes, terminal sessions survive. Each session is managed by a SessionActor with no locks, guaranteed ordering, and independent state.
Layer 2: Observation
Every file change is recorded, diffed, and linked to commits.
┌──────────────────────────────────────────────────────────────────┐
│ OBSERVATION │
├──────────────────────────────────────────────────────────────────┤
│ │
│ File saved │
│ ↓ file watcher detects change │
│ Diff computed against HEAD │
│ ↓ save tracker stores with timestamp │
│ ↓ records: who (ai_session_id), what (diff), when (ts) │
│ Commit happens │
│ ↓ saves are linked to the commit │
│ │
│ Now you can ask: │
│ "How was this commit made?" │
│ → 12 saves, 3 were rollbacks, saves 7-10 from Claude │
│ │
│ git log sees: commit abc123, +200/-50 │
│ OpenCLIs sees: the full journey to that commit │
│ │
└──────────────────────────────────────────────────────────────────┘
Layer 3: Memory
Sessions are read from local files — not API calls.
┌──────────────────────────────────────────────────────────────────┐
│ MEMORY │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Claude Code → ~/.claude/projects/*/session.jsonl │
│ Codex → ~/.codex/history.jsonl │
│ OpenCode → ~/.local/share/opencode/opencode.db │
│ Gemini CLI → ~/.gemini/tmp/*/chats/*.json │
│ │
│ NIIA reads all four, indexes into one database. │
│ │
│ From any CLI: │
│ $ niia session search "the auth bug" │
│ → Found in Claude session 3 days ago │
│ → Found in Codex session yesterday │
│ → Found in Gemini session this morning │
│ │
│ Memory is not locked to any model. │
│ Identity persists across sessions and time. │
│ │
└──────────────────────────────────────────────────────────────────┘
Layer 4: Understanding
The same tools serve human and AI equally.
┌───────────────────────────────────────────────────────────────────┐
│ UNDERSTANDING │
├───────────────────────────────────────────────────────────────────┤
│ │
│ monogram Human searches code. AI searches code. │
│ Same trigram engine, same results. │
│ │
│ monomento Human searches docs. AI searches docs. │
│ Same reference graph, same navigation. │
│ │
│ monokist Human checks branches. AI checks branches. │
│ Same commit cache, same structure. │
│ │
│ monogrid Human writes boxes. AI writes boxes. │
│ Same width rules, same alignment. │
│ │
│ git viewer Human reads AI's commits. │
│ save history Human sees the saves behind each commit. │
│ terminal log Human reviews AI's full terminal activity. │
│ │
│ AI's work is not a black box. │
│ Human reads it through the same tools AI used. │
│ │
└───────────────────────────────────────────────────────────────────┘
How They Connect
┌──────────────────────────────────────────────────────────────────┐
│ FLOW │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Human opens Monolex. Starts Claude Code. │
│ Claude works on a feature. │
│ → Runtime: Claude is in a PTY │
│ → Observation: every save is diffed and stored │
│ → Memory: Claude session is recorded locally │
│ │
│ Claude needs a second opinion. │
│ $ codex "review this approach" │
│ → Runtime: Codex runs in the same PTY │
│ → Memory: Codex session is also recorded │
│ │
│ Human comes back next day. New Claude session. │
│ $ niia recall │
│ → Memory: shows what Claude and Codex did yesterday │
│ $ niia session search "the approach" │
│ → Memory: finds the exact conversation from both │
│ │
│ Human reviews the commit. │
│ → Understanding: git viewer shows the commit │
│ → Observation: save history shows 12 saves that made it │
│ → Understanding: which saves were Claude, which Codex │
│ │
└──────────────────────────────────────────────────────────────────┘
Both Sides Grow
Not an AI Tool. Not a Human Tool.
OpenCLIs doesn't pick a side. The same framework strengthens both.
┌───────────────────────────────────────────────────────────────────┐
│ AI GETS STRONGER │
├───────────────────────────────────────────────────────────────────┤
│ │
│ Can call other models │
│ Claude asks Codex for a second opinion. Codex asks Gemini │
│ for a different perspective. Each uses its full capabilities. │
│ │
│ Memory persists │
│ Session ends, but NIIA remembers. Next session picks up │
│ where the last one stopped. Across models, across time. │
│ │
│ Uses human's tools │
│ monogram for code search. Git for version control. │
│ The same PATH, the same installed packages. │
│ AI doesn't live in a sandbox. It lives in the real system. │
│ │
└───────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────┐
│ HUMAN GETS STRONGER AT USING AI │
├──────────────────────────────────────────────────────────────────┤
│ │
│ Sees what AI did │
│ Save history shows every save. Terminal log shows activity. │
│ Git viewers show commits. Not a black box. │
│ │
│ Sees why AI did it │
│ Save history per commit. Rollbacks visible. Direction changes │
│ tracked. The journey, not just the result. │
│ │
│ Uses multiple models freely │
│ Claude for deep reasoning. Codex for quick edits. │
│ Gemini for a fresh perspective. Switch without friction. │
│ │
│ Switches without losing context │
│ NIIA carries memory across models. Start Gemini, │
│ pull Claude's yesterday session, continue working. │
│ │
└──────────────────────────────────────────────────────────────────┘
The Loop
┌──────────────────────────────────────────────────────────────────┐
│ REINFORCEMENT LOOP │
├──────────────────────────────────────────────────────────────────┤
│ │
│ AI works better │
│ ↓ │
│ Human can delegate more │
│ ↓ │
│ Human understands AI's work through shared tools │
│ ↓ │
│ Human gives more precise instructions │
│ ↓ │
│ AI works better │
│ ↓ │
│ ... │
│ │
│ The tools don't pick a side. │
│ They amplify the collaboration. │
│ │
└──────────────────────────────────────────────────────────────────┘