← OpenCLIs

How It Works

Four layers: Runtime, Observation, Memory, Understanding.

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.                                 β”‚
β”‚                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜