Flow traces of every runtime path in Aphrodite:
- the CCR compression proxy with its dual loopback listeners
- the Hermes plugin (Python shim → C-ABI dylib → shared core crate)
- the CI/release pipeline
- and the data model underneath.
Two runtime worlds run in separate processes with separate state: the proxy binary (HTTP response compression) and the Hermes plugin (hook-level interception).
The plugin is a pure loader - directives are embedded in the binary and materialized into ~/.hermes/aphrodite/directives/ at startup, and the dylib/binary live in the canonical runtime home ~/.hermes/aphrodite/binaries/ with layout self-heal.
| # | File | What it traces |
|---|---|---|
| 01 | 01-startup.md | Process startup: config resolution, bind-before-spawn of the :9797 cache / :9798 token listeners, CCR store init, config reload watcher, and plugin register() (dylib probe/load, layout self-heal, directives materialize, proxy launch). |
| 02 | 02-chat-compression.md | Core value path: chat response → classify → EMA-tuned threshold → BLAKE3 → store → <<<CCR:...>>> marker + preview; the tool_calls-not-compressed branch; proxy vs FFI pipeline separation. |
| 03 | 03-retrieve.md | /retrieve (inline → backend, filter, pagination, byte-exact round-trip) plus the recursive resolver resolve::expand (nested markers, depth limit, cycle-safe, no write-back). |
| 04 | 04-hook-ffi.md | Hermes → Python ctypes → C-ABI → core hooks; FFI declarations via the generated _bindings.py; the pre_llm_call → flow::build_turn_context choke point. |
| 05 | 05-ccr-lifecycle.md | State machine of a CCR entry (created → stored → previewed → {retrieved / decayed / evicted / expired} → GC) plus the EMA threshold state. |
| 06 | 06-sse-streaming.md | text/event-stream detection → timeout-free client → chunk passthrough (no compression, no cache) → mid-stream byte/error accounting. |
| 07 | 07-config-resolution.md | env > TOML > default precedence across the proxy and FFI config loaders; live vs inert/reserved keys; config reload scope. |
| 08 | 08-dylib-loading.md | Load-once-per-process contract: candidate resolution → presence-only _ensure_binaries (no downloads) → subprocess probe → direct CDLL; restart to pick up a new build. |
| 09 | 09-release-ci.md | Tag push → Build.yml (release-once → 4-target matrix → Finalize) + Publish.yml (Test + packaging guard → crates.io chain; aphrodite/aphrodite-hermes publish on tag, headroom-core dispatch-only). |
| 10 | 10-component.md | Top-level component diagram: crates + Python shim + proxies + store backends + Hermes host + canonical runtime home, with the C-ABI and HTTP boundaries labeled. |
| 11 | 11-data-model.md | Class diagram: AphroditeState, AppState, MarkerEntry, ToolEvent, SplitEvent, CcrStore trait + backends, directives. |
Cross-cutting notes
- The HTTP proxy path and the Hermes FFI path are two separate compression pipelines. The proxy classifies via
proxy_detect_content_typeand builds previews viaproxy_build_preview; the staged transform pipeline (transforms::detect,stage2,struct_extract) runs only on the hook path. They share the BLAKE3compute_keyand the marker wire format, but nothing else. - Two marker layouts exist for the same
<<<CCR:hash|type|size>>>token: the FFI path renders the marker line first, the proxy path renders it last. flow::build_turn_contextis the single directive choke point that allpre_llm_callentry points converge on, so directive injection cannot fork between paths.- The proxy and the plugin run in separate processes: each carries its own
AppState/AphroditeState, its own inline store, and its own CCR backend - the dylib is loaded once per process, so a session restart starts a fresh plugin-side store.