# ludwigweiss/sillytavern-starmem architecture

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

- Interactive diagram: https://gitdiagram.com/ludwigweiss/sillytavern-starmem
- Repository: https://github.com/ludwigweiss/sillytavern-starmem

## Overview

1. **What this repo is**
   - STARmem is a **SillyTavern browser extension** written primarily in JavaScript/ES modules.
   - The runtime boundary is the **SillyTavern client**; Node.js is used only for development, testing, linting, Playwright E2E, and benchmarks.
   - The extension’s top-level entry is `index.js`, with `manifest.json`, `settings.html`, and `style.css` providing the extension shell and UI.

2. **Primary architectural boundary**
   - The repo sits between **SillyTavern chat events** and an **external Child Model API**.
   - It captures conversation state from SillyTavern, retrieves memory/context, injects facts back into the prompt flow, and then performs asynchronous post-response consolidation.
   - The main external dependency is the **Child Model endpoint**; the rest is local extension logic and persisted settings/storage.

3. **Integration layer with SillyTavern**
   - `src/integration/` contains the extension-facing glue: initialization, router integration, prompt injection, interceptors, health checks, setup wizard, settings UI, and debug helpers.
   - This layer is the main adapter between SillyTavern’s event model and STARmem’s internal subsystems.
   - It also owns user-visible operational controls like enable/disable, connection testing, and context-flow visibility.

4. **Core runtime and shared state**
   - `src/core/` centralizes shared constants, app state, validation, and error boundaries.
   - This is the boundary that keeps configuration, invariants, and failure handling consistent across retrieval, memory, and integration subsystems.
   - It prevents the rest of the system from depending directly on SillyTavern specifics or UI state.

5. **4-tier retrieval pipeline**
   - `src/retrieval/` implements the main query pipeline:
     - **Tier 0** exact cache
     - **Tier 1** fuzzy cache / Jaccard-style matching
     - **Tier 2** BM25+ semantic retrieval
     - **Tier 3** Child Model reasoning over long context
   - Query classification, routing, prompt templates, refinement, expansion, and output formatting all live here.
   - The routing layer is the key latency-control boundary: cheap cache hits are preferred, BM25+ is the main semantic fallback, and the LLM is the last resort.

6. **4-memory architecture**
   - `src/memory/` holds the long-lived memory model:
     - **Working Memory** for recent turns / hot buffer
     - **Episodic Memory** for consolidated conversation history
     - **Persona Memory** for traits, preferences, and evidence-backed beliefs
     - **Graph Memory** for entities and relationships
   - `src/memory/unified-retrieval.js` fuses results across these stores into a single ranked result set.
   - `src/memory/fusion-scorer.js` is the ranking boundary that combines base retrieval score, recency, graph signals, and memory-specific weights.

7. **Knowledge lifecycle / adaptive consolidation**
   - `src/akl/` is the subsystem for memory evolution over time: decay, drift detection, importance scoring, influence propagation, consolidation triggers, and storage integration.
   - This layer is responsible for deciding what becomes durable memory and what fades.
   - It also enforces the repo’s design principle that older lore can remain important via custom decay/boost logic instead of naïve recency-only eviction.

8. **Persistence and structural storage**
   - `src/storage/` contains persistence-facing structures such as semantic store integration, RAPTOR tree storage, and AKL metadata.
   - The storage boundary is important because many memories are not just transient retrieval artifacts; they need to survive across sessions and be reloadable from extension settings or chat-scoped state.
   - The repository appears optimized for extension-local persistence rather than a separate backend database service.

9. **Model clients**
   - `src/models/child-model.js` and `src/models/tertiary-model.js` encapsulate external LLM interactions.
   - The **Child Model** is the critical pre-generation retrieval/reasoning service used in Tier 3 and for fact extraction.
   - The **Tertiary Model** supports asynchronous post-generation extraction or consolidation, so the generation path can stay responsive.

10. **Utility and infrastructure support**
   - `src/utils/` provides low-level helpers such as caches, token counting, clustering, idle detection, debug console, status reporting, and graph/context-flow helpers.
   - These utilities are cross-cutting infrastructure used by retrieval, memory, and integration rather than standalone features.
   - `src/utils/context-flow.js` and the debug/status tooling are especially relevant for understanding runtime data movement.

11. **Test and validation architecture**
   - The repo has layered verification: unit tests, integration tests, E2E Playwright tests against a live SillyTavern instance, and a benchmark suite under `tests/benchmark/`.
   - This mirrors the architecture: unit tests cover individual retrieval/memory algorithms, integration tests cover cross-subsystem flows, and E2E validates actual extension behavior in SillyTavern.
   - The benchmark suite is a separate performance/evaluation subsystem with fixtures, scorers, and reporting.

12. **How data flows through the system**
   - A chat turn enters from SillyTavern, is captured by the integration layer, and updates Working Memory.
   - The user query is classified, routed through the retrieval tiers, and merged with unified memory results.
   - A fused fact sheet is injected before the parent model generates the reply.
   - After generation, async consolidation updates episodic, persona, graph, and storage layers, closing the loop for the next turn.

Main entry points: [`src/integration/index.js`](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/index.js) (Integration API), [`src/memory/index.js`](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/index.js) (Memory API), [`src/retrieval/router.js`](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/router.js) (Query router), [`src/retrieval/index.js`](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/index.js) (Retrieval API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Extension shell"]
  node_index_js["Main entry<br/>extension entry<br/>[index.js]"]
  node_manifest_json["Manifest<br/>[manifest.json]"]
  node_settings_html["Settings UI<br/>extension ui<br/>[settings.html]"]
  node_style_css["Styles<br/>extension ui<br/>[style.css]"]
end

subgraph group_integration["SillyTavern bridge"]
  node_integration_index["Integration API<br/>adapter entry<br/>[index.js]"]
  node_integration_init["Bootstrap<br/>[init.js]"]
  node_integration_prompt["Prompt inject<br/>prompt adapter"]
  node_integration_router["Router bridge<br/>event bridge"]
end

subgraph group_runtime["Core runtime"]
  node_core_index["Core API<br/>runtime core<br/>[index.js]"]
end

subgraph group_retrieval["Retrieval pipeline"]
  node_retrieval_index["Retrieval API<br/>query pipeline<br/>[index.js]"]
  node_retrieval_router["Query router<br/>routing logic<br/>[router.js]"]
  node_tier0_cache(("Tier 0<br/>exact cache<br/>[tier-0-cache.js]"))
  node_tier1_cache(("Tier 1<br/>fuzzy cache<br/>[tier-1-cache.js]"))
  node_tier2_bm25(("Tier 2<br/>semantic search<br/>[tier-2-bm25.js]"))
  node_tier3_llm(("Tier 3<br/>llm reasoning<br/>[tier-3-llm.js]"))
end

subgraph group_memory["Memory system"]
  node_memory_index["Memory API<br/>memory facade<br/>[index.js]"]
  node_working_memory[("Working mem<br/>hot buffer<br/>[working-memory.js]")]
  node_episodic_memory[("Episodic mem<br/>conversation archive<br/>[episodic-memory.js]")]
  node_persona_memory[("Persona mem<br/>trait store<br/>[persona-memory.js]")]
  node_graph_memory[("Graph mem<br/>entity graph<br/>[graph-memory.js]")]
  node_unified_retrieval["Unified retrieve<br/>fusion layer"]
  node_fusion_scorer{{"Fusion scorer<br/>ranking logic<br/>[fusion-scorer.js]"}}
end

subgraph group_akl["Knowledge lifecycle"]
  node_akl_index["AKL API<br/>lifecycle engine<br/>[index.js]"]
end

subgraph group_storage["Persistence layer"]
  node_storage_index["Storage API<br/>persistence layer<br/>[index.js]"]
end

subgraph group_models["Model clients"]
  node_models_index["Model API<br/>llm clients<br/>[index.js]"]
  node_child_model["Child model<br/>llm client<br/>[child-model.js]"]
  node_tertiary_model["Tertiary model<br/>llm client<br/>[tertiary-model.js]"]
end

subgraph group_utils["Shared utilities"]
  node_utils_index["Utilities<br/>shared helpers<br/>[index.js]"]
end

subgraph group_verification["Verification"]
  node_bench_runners["Benchmarks<br/>evaluation suite<br/>[run-benchmark.js]"]
  node_e2e_tests["E2E tests<br/>browser tests"]
  node_unit_tests["Unit tests<br/>algorithm tests<br/>[router.test.js]"]
end

node_index_js -->|"bootstraps"| node_integration_index
node_index_js -->|"shares state"| node_core_index
node_index_js -.->|"declares"| node_manifest_json
node_index_js -.->|"renders"| node_settings_html
node_index_js -.->|"styles"| node_style_css
node_integration_index -->|"initializes"| node_integration_init
node_integration_index -->|"routes events"| node_integration_router
node_integration_index -->|"injects context"| node_integration_prompt
node_integration_index -->|"validates"| node_core_index
node_integration_router -->|"queries"| node_retrieval_index
node_integration_prompt -->|"reads memory"| node_memory_index
node_integration_prompt -->|"requests facts"| node_retrieval_index
node_retrieval_index -->|"dispatches"| node_retrieval_router
node_retrieval_router -->|"exact hit"| node_tier0_cache
node_retrieval_router -->|"fuzzy hit"| node_tier1_cache
node_retrieval_router -->|"semantic hit"| node_tier2_bm25
node_retrieval_router -->|"reasoning fallback"| node_tier3_llm
node_tier3_llm -->|"calls"| node_child_model
node_retrieval_index -->|"uses clients"| node_models_index
node_memory_index -->|"maintains"| node_working_memory
node_memory_index -->|"stores"| node_episodic_memory
node_memory_index -->|"stores"| node_persona_memory
node_memory_index -->|"stores"| node_graph_memory
node_memory_index -->|"fuses"| node_unified_retrieval
node_unified_retrieval -->|"ranks"| node_fusion_scorer
node_akl_index -->|"persists"| node_storage_index
node_akl_index -->|"evolves"| node_memory_index
node_akl_index -->|"signals"| node_utils_index
node_models_index -->|"exposes"| node_child_model
node_models_index -->|"exposes"| node_tertiary_model
node_integration_index -->|"observes"| node_utils_index
node_retrieval_index -->|"depends on"| node_utils_index
node_bench_runners -.->|"measures"| node_retrieval_index
node_e2e_tests -.->|"validates"| node_integration_index
node_unit_tests -.->|"verifies"| node_retrieval_router
node_unit_tests -.->|"verifies"| node_fusion_scorer

click node_index_js "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/index.js"
click node_manifest_json "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/manifest.json"
click node_settings_html "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/settings.html"
click node_style_css "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/style.css"
click node_integration_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/index.js"
click node_integration_init "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/init.js"
click node_integration_prompt "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/prompt-injection.js"
click node_integration_router "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/router-integration.js"
click node_core_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/core/index.js"
click node_retrieval_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/index.js"
click node_retrieval_router "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/router.js"
click node_tier0_cache "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-0-cache.js"
click node_tier1_cache "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-1-cache.js"
click node_tier2_bm25 "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-2-bm25.js"
click node_tier3_llm "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-3-llm.js"
click node_memory_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/index.js"
click node_working_memory "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/working-memory.js"
click node_episodic_memory "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/episodic-memory.js"
click node_persona_memory "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/persona-memory.js"
click node_graph_memory "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/graph-memory.js"
click node_unified_retrieval "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/unified-retrieval.js"
click node_fusion_scorer "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/fusion-scorer.js"
click node_akl_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/akl/index.js"
click node_storage_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/storage/index.js"
click node_models_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/models/index.js"
click node_child_model "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/models/child-model.js"
click node_tertiary_model "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/models/tertiary-model.js"
click node_utils_index "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/utils/index.js"
click node_bench_runners "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/tests/benchmark/runners/run-benchmark.js"
click node_e2e_tests "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/tests/e2e/interceptor.spec.js"
click node_unit_tests "https://github.com/ludwigweiss/sillytavern-starmem/blob/main/tests/unit/router.test.js"

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_index_js,node_manifest_json,node_settings_html,node_style_css,node_storage_index toneBlue
class node_integration_index,node_integration_init,node_integration_prompt,node_integration_router,node_models_index,node_child_model,node_tertiary_model toneAmber
class node_core_index,node_utils_index toneMint
class node_retrieval_index,node_retrieval_router,node_tier0_cache,node_tier1_cache,node_tier2_bm25,node_tier3_llm,node_bench_runners,node_e2e_tests,node_unit_tests toneRose
class node_memory_index,node_working_memory,node_episodic_memory,node_persona_memory,node_graph_memory,node_unified_retrieval,node_fusion_scorer toneIndigo
class node_akl_index toneTeal
```

## Components

### Extension shell

SillyTavern extension entrypoints and visible UI surface

- [Main entry](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/index.js): extension entry · Top-level extension bootstrap for SillyTavern · `index.js`
- [Manifest](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/manifest.json): extension manifest · Browser extension metadata and permissions · `manifest.json`
- [Settings UI](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/settings.html): extension ui · Extension configuration surface · `settings.html`
- [Styles](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/style.css): extension ui · Shell styling for the settings and controls · `style.css`

### SillyTavern bridge

Event hookup, prompt injection, health checks, and setup flow

- [Integration API](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/index.js): adapter entry · Primary SillyTavern integration surface · `src/integration/index.js`
- [Bootstrap](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/init.js): adapter bootstrap · Initialization and lifecycle wiring for the extension · `src/integration/init.js`
- [Prompt inject](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/prompt-injection.js): prompt adapter · Injects facts and context into the chat flow · `src/integration/prompt-injection.js`
- [Router bridge](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/integration/router-integration.js): event bridge · Connects SillyTavern events to retrieval routing · `src/integration/router-integration.js`

### Core runtime

Shared state, constants, validation, and error boundaries

- [Core API](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/core/index.js): runtime core · Shared constants, state, validation, and error handling · `src/core/index.js`

### Retrieval pipeline

Tiered query routing from cache to semantic and model-backed search

- [Retrieval API](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/index.js): query pipeline · Entry to tiered retrieval and query handling · `src/retrieval/index.js`
- [Query router](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/router.js): routing logic · Classifies queries and selects retrieval tiers · `src/retrieval/router.js`
- [Tier 0](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-0-cache.js): exact cache · Exact-match cache layer · `src/retrieval/tier-0-cache.js`
- [Tier 1](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-1-cache.js): fuzzy cache · Fuzzy and Jaccard-style cache matching · `src/retrieval/tier-1-cache.js`
- [Tier 2](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-2-bm25.js): semantic search · BM25-backed semantic retrieval layer · `src/retrieval/tier-2-bm25.js`
- [Tier 3](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/retrieval/tier-3-llm.js): llm reasoning · Child-model reasoning over long context · `src/retrieval/tier-3-llm.js`

### Memory system

Working, episodic, persona, and graph memory plus fusion

- [Memory API](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/index.js): memory facade · Unified access to long-lived memory stores · `src/memory/index.js`
- [Working mem](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/working-memory.js): hot buffer · Recent turns and active conversational state · `src/memory/working-memory.js`
- [Episodic mem](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/episodic-memory.js): conversation archive · Consolidated history of prior exchanges · `src/memory/episodic-memory.js`
- [Persona mem](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/persona-memory.js): trait store · Traits, preferences, and evidence-backed beliefs · `src/memory/persona-memory.js`
- [Graph mem](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/graph-memory.js): entity graph · Entities and relationships extracted from chat · `src/memory/graph-memory.js`
- [Unified retrieve](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/unified-retrieval.js): fusion layer · Merges results across memory stores · `src/memory/unified-retrieval.js`
- [Fusion scorer](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/memory/fusion-scorer.js): ranking logic · Combines retrieval score, recency, and graph signals · `src/memory/fusion-scorer.js`

### Knowledge lifecycle

Decay, drift, importance, consolidation, and propagation

- [AKL API](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/akl/index.js): lifecycle engine · Adaptive knowledge lifecycle and consolidation entrypoint · `src/akl/index.js`

### Persistence layer

Extension-local storage for semantic and metadata structures

- [Storage API](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/storage/index.js): persistence layer · Semantic store, RAPTOR tree, and AKL metadata persistence · `src/storage/index.js`

### Model clients

External Child and tertiary model integrations

- [Model API](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/models/index.js): llm clients · External model client surface · `src/models/index.js`
- [Child model](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/models/child-model.js): llm client · Primary external model for reasoning and extraction · `src/models/child-model.js`
- [Tertiary model](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/models/tertiary-model.js): llm client · Async post-generation extraction and consolidation model · `src/models/tertiary-model.js`

### Shared utilities

Cross-cutting caches, token logic, context flow, and diagnostics

- [Utilities](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/src/utils/index.js): shared helpers · Cross-cutting caches, token counting, clustering, context flow, and diagnostics · `src/utils/index.js`

### Verification

Tests, end-to-end checks, and benchmarks

- [Benchmarks](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/tests/benchmark/runners/run-benchmark.js): evaluation suite · Performance and quality benchmark runners · `tests/benchmark/runners/run-benchmark.js`
- [E2E tests](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/tests/e2e/interceptor.spec.js): browser tests · Playwright validation against a live SillyTavern instance · `tests/e2e/interceptor.spec.js`
- [Unit tests](https://github.com/ludwigweiss/sillytavern-starmem/blob/main/tests/unit/router.test.js): algorithm tests · Focused tests for retrieval, memory, and scoring modules · `tests/unit/router.test.js`

## Connections

- Main entry → Integration API: bootstraps · Main entry hands control to the integration layer
- Main entry → Core API: shares state · Extension bootstrap depends on core invariants
- Main entry → Manifest: declares · Browser extension metadata describes the entrypoint
- Main entry → Settings UI: renders · Settings UI is part of the extension shell
- Main entry → Styles: styles · Extension shell styling is loaded with the UI
- Integration API → Bootstrap: initializes · Coordinates lifecycle and registration
- Integration API → Router bridge: routes events · Connects chat events to the retrieval pipeline
- Integration API → Prompt inject: injects context · Adds facts before generation
- Integration API → Core API: validates · Uses shared runtime validation and error boundaries
- Router bridge → Retrieval API: queries · Forwards routed requests into retrieval
- Prompt inject → Memory API: reads memory · Pulls unified memory context for injection
- Prompt inject → Retrieval API: requests facts · Builds prompt payloads from retrieval results
- Retrieval API → Query router: dispatches · Routes each query to the cheapest viable tier
- Query router → Tier 0: exact hit · First latency-controlled retrieval path
- Query router → Tier 1: fuzzy hit · Fallback cache matching
- Query router → Tier 2: semantic hit · Main semantic retrieval fallback
- Query router → Tier 3: reasoning fallback · Last-resort Child Model reasoning path
- Tier 3 → Child model: calls · Uses the Child Model endpoint for reasoning
- Retrieval API → Model API: uses clients · Retrieval can invoke external model clients
- Memory API → Working mem: maintains · Tracks hot conversational state
- Memory API → Episodic mem: stores · Persists consolidated turn history
- Memory API → Persona mem: stores · Keeps durable persona facts
- Memory API → Graph mem: stores · Maintains entity and relation graph
- Memory API → Unified retrieve: fuses · Combines results across memory subsystems
- Unified retrieve → Fusion scorer: ranks · Applies score fusion across signals
- AKL API → Storage API: persists · Adaptive lifecycle writes metadata and structures
- AKL API → Memory API: evolves · Feeds consolidation back into memory stores
- AKL API → Utilities: signals · Uses shared helpers for decay, clustering, and diagnostics
- Model API → Child model: exposes · Primary external model client
- Model API → Tertiary model: exposes · Async consolidation model client
- Integration API → Utilities: observes · Context flow and status tooling support the adapter layer
- Retrieval API → Utilities: depends on · Uses caches, token counts, and graph helpers
- Benchmarks → Retrieval API: measures · Benchmarks exercise retrieval behavior
- E2E tests → Integration API: validates · End-to-end checks cover the SillyTavern bridge
- Unit tests → Query router: verifies · Unit tests cover routing and tier selection
- Unit tests → Fusion scorer: verifies · Unit tests cover cross-memory ranking
