# iamkevincruz/c0 architecture

> Architecture diagram of the GitHub repository iamkevincruz/c0, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamkevincruz/c0
- Repository: https://github.com/iamkevincruz/c0

## Overview

c0 is a CLI-based external memory for LLMs: users add and relate knowledge, query it through a tiered retrieval cascade, then receive graph-traversed context. It also ingests source material, tracks knowledge over time, audits graph quality, and can learn from lookup misses through a reflection loop. The sampled sources establish the graph, embedding, extraction, session, and reflection modules; some command wiring is only documented in the README, so uncertain calls are omitted.

Main entry points: [`src/main.rs`](https://github.com/iamkevincruz/c0/blob/main/src/main.rs) (c0 commands), [`src/graph.rs`](https://github.com/iamkevincruz/c0/blob/main/src/graph.rs) (Graph operations), [`src/reflector.rs`](https://github.com/iamkevincruz/c0/blob/main/src/reflector.rs) (Miss reflection), [`src/claude.rs`](https://github.com/iamkevincruz/c0/blob/main/src/claude.rs) (LLM clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and retrieval"]
  node_cli["c0 commands<br/>[main.rs]"]
end

subgraph group_memory["Graph memory"]
  node_graph["Graph operations<br/>[graph.rs]"]
  node_embedding["Embedding client<br/>[embeddings.rs]"]
end

subgraph group_ingest["Knowledge ingestion"]
  node_fetch["Source fetching<br/>[fetch.rs]"]
  node_extract["Transcript extraction<br/>[extract.rs]"]
  node_llm["LLM clients<br/>[claude.rs]"]
  node_sessions["Session indexing<br/>[sessions.rs]"]
end

subgraph group_learning["Reflection loop"]
  node_reflector["Miss reflection<br/>[reflector.rs]"]
  node_miss_queue["Queued misses<br/>[reflector.rs]"]
end

subgraph group_operations["Memory operations"]
  node_audit["Graph audit<br/>[audit.rs]"]
  node_export["Graph export<br/>[export.rs]"]
  node_eval["Retrieval evaluation<br/>[eval.rs]"]
  node_bench["Memory benchmark<br/>[bench.rs]"]
end

node_user(("LLM user"))
node_neo4j[("Neo4j graph")]
node_ollama["Ollama"]
node_web["Web and documents"]
node_session_files["Claude sessions"]

node_user -->|"runs commands"| node_cli
node_cli -->|"queries and updates"| node_graph
node_graph -->|"reads and writes"| node_neo4j
node_cli -->|"requests embeddings"| node_embedding
node_embedding -->|"embeds text"| node_ollama
node_cli -->|"fetches sources"| node_fetch
node_fetch -->|"retrieves content"| node_web
node_cli -->|"extracts transcripts"| node_extract
node_extract -->|"requests extraction"| node_llm
node_llm -.->|"uses local model"| node_ollama
node_llm -.->|"calls configured provider"| node_user
node_cli -->|"runs reflection"| node_reflector
node_reflector -->|"processes misses"| node_miss_queue
node_reflector -->|"classifies queries"| node_llm
node_reflector -->|"commits knowledge"| node_graph
node_cli -->|"audits memory"| node_audit
node_audit -->|"reads graph"| node_neo4j
node_cli -->|"exports graph"| node_export
node_export -->|"reads graph"| node_neo4j
node_cli -.->|"indexes sessions"| node_sessions
node_session_files -.->|"provides transcripts"| node_sessions
node_sessions -.->|"stores session data"| node_graph
node_sessions -.->|"embeds session text"| node_embedding
node_cli -->|"evaluates retrieval"| node_eval
node_eval -->|"runs retrieval cascade"| node_graph
node_eval -->|"embeds queries"| node_embedding
node_cli -->|"benchmarks memory"| node_bench
node_bench -->|"uses memory graph"| node_graph

click node_cli "https://github.com/iamkevincruz/c0/blob/main/src/main.rs"
click node_graph "https://github.com/iamkevincruz/c0/blob/main/src/graph.rs"
click node_embedding "https://github.com/iamkevincruz/c0/blob/main/src/embeddings.rs"
click node_fetch "https://github.com/iamkevincruz/c0/blob/main/src/fetch.rs"
click node_extract "https://github.com/iamkevincruz/c0/blob/main/src/extract.rs"
click node_llm "https://github.com/iamkevincruz/c0/blob/main/src/claude.rs"
click node_reflector "https://github.com/iamkevincruz/c0/blob/main/src/reflector.rs"
click node_miss_queue "https://github.com/iamkevincruz/c0/blob/main/src/reflector.rs"
click node_audit "https://github.com/iamkevincruz/c0/blob/main/src/audit.rs"
click node_export "https://github.com/iamkevincruz/c0/blob/main/src/export.rs"
click node_sessions "https://github.com/iamkevincruz/c0/blob/main/src/sessions.rs"
click node_eval "https://github.com/iamkevincruz/c0/blob/main/src/eval.rs"
click node_bench "https://github.com/iamkevincruz/c0/blob/main/src/bench.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_user toneBlue
class node_graph,node_embedding,node_neo4j toneAmber
class node_fetch,node_extract,node_llm,node_sessions toneMint
class node_reflector,node_miss_queue toneRose
class node_audit,node_export,node_eval,node_bench,node_ollama,node_web,node_session_files toneIndigo
```

## Components

### CLI and retrieval

- [c0 commands](https://github.com/iamkevincruz/c0/blob/main/src/main.rs): `src/main.rs`

### Graph memory

- [Graph operations](https://github.com/iamkevincruz/c0/blob/main/src/graph.rs): `src/graph.rs`
- [Embedding client](https://github.com/iamkevincruz/c0/blob/main/src/embeddings.rs): `src/embeddings.rs`

### Knowledge ingestion

- [Source fetching](https://github.com/iamkevincruz/c0/blob/main/src/fetch.rs): `src/fetch.rs`
- [Transcript extraction](https://github.com/iamkevincruz/c0/blob/main/src/extract.rs): `src/extract.rs`
- [LLM clients](https://github.com/iamkevincruz/c0/blob/main/src/claude.rs): `src/claude.rs`
- [Session indexing](https://github.com/iamkevincruz/c0/blob/main/src/sessions.rs): `src/sessions.rs`

### Reflection loop

- [Miss reflection](https://github.com/iamkevincruz/c0/blob/main/src/reflector.rs): `src/reflector.rs`
- [Queued misses](https://github.com/iamkevincruz/c0/blob/main/src/reflector.rs): `src/reflector.rs`

### Memory operations

- [Graph audit](https://github.com/iamkevincruz/c0/blob/main/src/audit.rs): `src/audit.rs`
- [Graph export](https://github.com/iamkevincruz/c0/blob/main/src/export.rs): `src/export.rs`
- [Retrieval evaluation](https://github.com/iamkevincruz/c0/blob/main/src/eval.rs): `src/eval.rs`
- [Memory benchmark](https://github.com/iamkevincruz/c0/blob/main/src/bench.rs): `src/bench.rs`

### Other components

- **LLM user**
- **Neo4j graph**
- **Ollama**
- **Web and documents**
- **Claude sessions**

## Connections

- LLM user → c0 commands: runs commands
- c0 commands → Graph operations: queries and updates
- Graph operations → Neo4j graph: reads and writes
- c0 commands → Embedding client: requests embeddings
- Embedding client → Ollama: embeds text
- c0 commands → Source fetching: fetches sources
- Source fetching → Web and documents: retrieves content
- c0 commands → Transcript extraction: extracts transcripts
- Transcript extraction → LLM clients: requests extraction
- LLM clients → Ollama: uses local model
- LLM clients → LLM user: calls configured provider
- c0 commands → Miss reflection: runs reflection
- Miss reflection → Queued misses: processes misses
- Miss reflection → LLM clients: classifies queries
- Miss reflection → Graph operations: commits knowledge
- c0 commands → Graph audit: audits memory
- Graph audit → Neo4j graph: reads graph
- c0 commands → Graph export: exports graph
- Graph export → Neo4j graph: reads graph
- c0 commands → Session indexing: indexes sessions
- Claude sessions → Session indexing: provides transcripts
- Session indexing → Graph operations: stores session data
- Session indexing → Embedding client: embeds session text
- c0 commands → Retrieval evaluation: evaluates retrieval
- Retrieval evaluation → Graph operations: runs retrieval cascade
- Retrieval evaluation → Embedding client: embeds queries
- c0 commands → Memory benchmark: benchmarks memory
- Memory benchmark → Graph operations: uses memory graph
