Namespace: memory-steward • Owner: architecture-team
← Prev: Document 08 (Verification) | Next: Document 10 (Landscape) →
- 0. Status, Scope, and Authority
- 1. Purpose
- 2. System Architecture (C4 Model)
- 3. Request Lifecycle (Sequence)
- 4. Environment Variable Contract
- 5. Dashboard Specification
- 7. Log Aggregation Component (Vector)
- 8. Closing Statement
Status: FOUNDATIONAL Audience: Core maintainers, operators Change policy:
- Append-only
- No silent edits
This document defines the Physical Architecture and Runtime Configuration of the system. It replaces ad-hoc READMEs with a strict contract.
graph TD
User((User))
subgraph "Memory Steward System"
UI[Open WebUI]
Router[<b>Memory Router</b><br>Orchestrator]
Steward[<b>Memory Steward</b><br>Admission Controller]
Builder[<b>Builder LLM</b><br>vLLM / Inference]
subgraph "Storage"
DB[(Postgres<br>Canonical)]
Vector[(Qdrant<br>Index)]
Logs[(Log Sink<br>PVC)]
end
end
User -->|Chat| UI
UI -->|OpenAI Protocol| Router
Router -->|Inference| Builder
Router -->|Read Static| DB
Router -->|Search| Vector
Router -.->|Async Admit| Steward
Steward -->|Write Dynamic| DB
Steward -->|Upsert| Vector
Router -.->|Logs| Logs
Steward -.->|Logs| Logs
sequenceDiagram
participant U as User
participant R as Router
participant Q as Qdrant
participant B as Builder
participant S as Steward
U->>R: POST /chat/completions
par Retrieval
R->>Q: Search (Project ID)
R->>R: Load Static Rules
end
R->>R: Assemble Context
R->>B: Generate(Prompt)
B-->>R: Response
R-->>U: Response
rect rgb(240, 240, 240)
Note right of R: Async Admission
R->>S: Admit(User + Assistant Msg)
S->>S: Extract Fragments
S->>Q: Upsert Vector
end
| Variable | Default | Description |
|---|---|---|
POSTGRES_DSN |
Required | Canonical storage connection. |
QDRANT_URL |
http://qdrant:6333 |
Vector store endpoint. |
BUILDER_BASE_URL |
Required | vLLM / OpenAI inference endpoint. |
STEWARD_URL |
Required | Async admission endpoint. |
MAX_CONTEXT_TOKENS |
2000 |
Safety cap for injection. |
OPEN_WEBUI_URL |
http://open-webui:8080 |
Open WebUI base URL for slash-command seeding. |
OPEN_WEBUI_API_KEY |
Optional | Open WebUI API key. Required for /glap slash-command auto-seeding. Set via open-webui-api-key secret. |
| Variable | Default | Description |
|---|---|---|
MIN_CONFIDENCE |
0.7 |
Threshold for memory persistence. |
EMBEDDINGS_URL |
Required | Service for vectorization. |
| Variable | Default | Description |
|---|---|---|
LOG_DIR |
/var/log/memory_steward_logs |
Root directory for persisted logs. |
LOG_ROTATE_MAX_SIZE_MB |
10 |
Size threshold for rotation. |
LOG_ROTATE_MAX_FILES |
10 |
Max rotated files per log. |
LOG_RETENTION_DAYS |
14 |
Age horizon for purge. |
LOG_TOTAL_CAP_MB |
5120 |
Global cap for all logs under LOG_DIR. |
| Variable | Default | Description |
|---|---|---|
MCP_MAX_LINES |
1000 |
Hard cap for logs.read. |
MCP_MAX_WINDOW_MINUTES |
360 |
Hard cap for smart_search time window. |
MCP_RESPONSE_MAX_BYTES |
524288 |
Response size ceiling (bytes). |
Dashboards are powered by the Diagnostics Plane (Postgres telemetry schema).
- Router Overview: RPS, Error Rate, Latency (p95).
- Steward Health: Admission Lag, Fragments Inserted per Minute.
- Retrieval Quality: “Zero Candidate” rate (Blind spots).
-- Check if telemetry is flowing
SELECT count(*) FROM telemetry.request WHERE created_at > now() - interval '1 hour';Component name: vector-agent (DaemonSet)
Purpose: Harvest all container logs, persist to PVC, enforce rotation and retention, and expose bounded diagnostics via MCP.
Contracts
- Directories
LOG_DIR(default/var/log/memory_steward_logs)
- Rotation / Retention
LOG_ROTATE_MAX_SIZE_MB(default 10)LOG_ROTATE_MAX_FILES(default 10)LOG_RETENTION_DAYS(default 14)LOG_TOTAL_CAP_MB(default 5120)
- Time
LOG_TZ(default cluster timezone) for timestamp normalization
Kubernetes Resources
- DaemonSet:
vector-agent - ConfigMap:
vector-config(immutable pipeline and retention rules) - PVC:
vector-logs(ReadWriteOnce) mounted atLOG_DIR - ServiceAccount:
vector-agent(read pod metadata only)
This runtime contract ensures that deployment is deterministic. If the Env Vars match, the C4 architecture holds true.
Date: 2026 Scope: Sections 2, 3, 4.1
The frontend component has been replaced from AnythingLLM to Open WebUI. All references to AnythingLLM / UI in the C4 diagram and sequence diagram now refer to Open WebUI. Two new environment variables have been added to the Memory Router contract (OPEN_WEBUI_URL, OPEN_WEBUI_API_KEY) to support lazy slash-command seeding via mcp_bridge.py. The open-webui service is added to the log aggregation file layout (see Doc 06 Section 11.2).
END OF DOCUMENT 09