Memory tier visualization

5 memory layers · write paths from workflows/HITL/cron · read paths into chat context · live row counts as of 2026-05-25

The platform learns by writing five distinct kinds of memory to D1 and reading them back into the chat system prompt + tool dispatch. This diagram shows every writer (workflow runner, HITL approval, cron, manual seed) feeding each tier and every reader (chat context loader, peer review, council prompt) consuming them.

5 tiers · live migration 122 · 124 R285 weekly tool-grader · R555 corpus build · R84 wiki rebuild

0 · Visual flow 3 lanes · 12 nodes

Memory tier flow — writers → tiers → readers
Memory tier visualization — workflows + HITL + cron write into 5 memory tiers; chat context reads them back 01 / Writers 02 / Memory tiers (D1 + Vectorize) 03 / Readers The workflow runner (R549+). Calls executeChatTool sequentially per workflow contract step. Logs each step into the event ledger; emits a reflexion when a step verdict fails so the system can learn from the miss. WRITER: workflow_runner source: src/lib/workflow_runner.ts fires: every workflow execution writes_to: reflexion_log + training_loop_runs hitl: pre-write step (proposed_actions) i workflow runner 22 workflow contracts BACKEND · R549 HITL approval surface at /proposed-actions.html. Mike accepts or rejects every AI-proposed write. Every decision becomes a row in decision_corpus along with redacted rationale + outcome. WRITER: HITL approval source: /proposed-actions.html + executeChatTool decide path fires: every approval/reject writes_to: decision_corpus + reflexion_log table: proposed_actions rule: X-Edit-Token required i HITL approval proposed_actions SECURITY · X-Edit-Token R285 weekly tool-grader cron at 03:00 Sunday. Replays a sample of failed tool calls, grades them, distills lessons → llm_wiki_log. Also rebuilds decision_corpus indices. WRITER: weekly cron trigger: 0 3 * * SUN task: tool grader replay + corpus rebuild writes_to: llm_wiki_log + decision_corpus cite: R285 i cron · weekly tool-grader 0 3 * * SUN MESSAGEBUS · R285 R555 corpus build runs nightly. Crawls every git commit + admin recap + ADR file. Embeds chunks via Workers AI, writes vectors into Vectorize + rows into knowledge_chunks. WRITER: nightly corpus build trigger: 0 2 * * * task: chunk + embed git+ADR+recap into knowledge_chunks writes_to: knowledge_chunks (3,371 rows live) cite: R555 i nightly · corpus build git + ADR + recap MESSAGEBUS · R555 R84 wiki rebuild fires after every commit with code path. Re-extracts function summaries, tool descriptions, ADR titles. Compacts to a 30k-token operational fact set. WRITER: R84 wiki rebuild trigger: post-commit + 0 4 * * MON task: extract function + tool + ADR summaries writes_to: llm_wiki_log (3 entries live) cite: R84 i post-commit · wiki rebuild function + tool + ADR distill MESSAGEBUS · R84 Manual seeding from training page. Mike pastes a Q+A or correction; admin endpoint POST /api/training/record writes it directly to the chosen tier. WRITER: manual seed source: training.html + /api/training/record fires: ad hoc writes_to: decision_corpus | reflexion_log pattern: Mike-curated golden examples i manual seed training.html FRONTEND · admin Append-only log of every workflow step verdict that failed plus model self-critique text. Used as a few-shot examples lifted into the chat system prompt when the same pattern recurs. TIER 1: reflexion_log table: reflexion_log rows: 0 (newly seeded; see also reflexion_constitution_log) schema: workflow_run_id · step_id · verdict · self_critique · created_at use: lift as few-shot when same pattern recurs migration: 054 i TIER 1 · reflexion_log workflow step verdicts + self-critique few-shot replay when same pattern recurs DATABASE · migration 054 · D1 append-only Curated decisions made by Mike or by an auto-grader. 979 rows live. Each row carries the question, the chosen answer, the rejected alternative, and the rationale. Top-3 most similar rows lift into chat system prompt. TIER 2: decision_corpus table: decision_corpus rows: 979 (as of 2026-05-25) schema: question · chosen · rejected · rationale · embedding use: top-3 cosine match lifted into council prompt cite: R555 i TIER 2 · decision_corpus 979 rows · curated Q + chosen + rejected + rationale top-3 cosine match lifted into council prompt DATABASE · migration 053 · R555 corpus build 3 active wiki snapshots. Compacted operational fact set: function signatures, chat tool descriptions, ADR titles, current cron schedule, current sync tier map. Top entry lifted at every chat call. TIER 3: llm_wiki_log table: llm_wiki_log rows: 3 active snapshots schema: snapshot_id · markdown_blob · token_count · created_at use: latest entry lifted at every chat call (~30k tokens) cite: R84 wiki rebuild i TIER 3 · llm_wiki_log 3 snapshots · compacted operational fact set latest entry lifted at every chat call DATABASE · migration 056 · R84 rebuild 1,974 training loop run records. Each is a question + 3 model answers + grader verdict + cost + latency. Used by R285 weekly grader to compute model-vs-model scores and surface drift. TIER 4: training_loop_runs table: training_loop_runs rows: 1,974 (as of 2026-05-25) schema: question · model_outputs · grader_verdict · cost · latency use: model-vs-model scoring + drift surfacing cite: R285 weekly tool-grader i TIER 4 · training_loop_runs 1,974 runs · Q + 3 model outputs + grader verdict model-vs-model scoring + drift surfacing DATABASE · migration 038 · R285 grader 3,371 embedded chunks of code, ADRs, recaps, workflow contracts. Vectorized into Vectorize index. Top-k retrieval feeds Council v2 system prompt as auto-context block. TIER 5: knowledge_chunks table: knowledge_chunks (+ Vectorize index) rows: 3,371 (as of 2026-05-25) schema: chunk_id · source · markdown · embedding use: top-k retrieval → Council v2 auto-context cite: R555 corpus build i TIER 5 · knowledge_chunks 3,371 chunks · code + ADR + recap + workflow contracts top-k Vectorize retrieval → Council v2 auto-context DATABASE · migration 122/124 · Vectorize · R555 Council v2 chat call. Three models in parallel; before they fire, the system prompt is assembled from: llm_wiki_log latest + decision_corpus top-3 + knowledge_chunks top-k + reflexion_log most-recent. READER: chat context loader endpoint: POST /api/chat (Council v2) reads: llm_wiki + decision_corpus + knowledge_chunks + reflexion_log cost: contributes ~30k input tokens to each council member cite: R39 council v2 i chat context loader Council v2 system prompt wiki + corpus + chunks + reflexion CLOUD · POST /api/chat Each anonymized peer review pass loads the same context as the council members. Ensures all three reviewers see the same operational facts when revising. READER: peer review pass endpoint: internal council loop reads: llm_wiki + decision_corpus (top-3) fires: 3x per chat call (once per model) cite: R39 i peer review pass internal council loop · 3x/chat wiki + corpus top-3 CLOUD · R39 Tool dispatch reads decision_corpus to bias canonical_pattern selection. When a question matches a corpus exemplar, the forced tool from that exemplar is favored. READER: tool dispatch bias source: executeChatTool entry path reads: decision_corpus effect: top-1 corpus match biases canonical_pattern selection cite: R556 i tool dispatch bias canonical pattern boost decision_corpus top-1 CLOUD · R556 The R285 grader uses training_loop_runs as its eval set. Compares current model output against prior verdicts; surfaces regression. READER: weekly grader eval source: R285 cron reads: training_loop_runs effect: regression detection + cost vs grade trade-off cite: R285 i weekly grader eval training_loop_runs as eval set regression detection CLOUD · R285 Admin dashboard renders a memory-tier health card pulling row counts + last-write timestamps from each tier. Drives the recap that lands in chat for "what does the platform remember today." READER: admin dashboard health card surface: /admin-dashboard.html reads: row counts + max(created_at) from all 5 tiers effect: surfaces tier freshness + recency cite: R563 i admin health card 5-tier row counts + last-write /admin-dashboard.html FRONTEND · R563

Tier detail · 5 memory layers

T1 reflexion_log seed

Append-only log of workflow step verdicts that failed + self-critique blob. Few-shot replay path when the same pattern recurs.
Table
reflexion_log · also reflexion_constitution_log (3 rows)
Migration
054_reflexion_constitution_log.sql
Writers
workflow_runner (post-step verdict) + HITL reject path
Readers
Council v2 system prompt (top-3 recent matches)

T2 decision_corpus 979 rows

Curated Q+A pairs with chosen + rejected + rationale. Top-3 cosine match lifted into council prompt.
Table
decision_corpus · decision_corpus_few_shot_log
Migration
053_decision_corpus_few_shot_log.sql + 071 backfill
Writers
HITL approval · R555 corpus build · manual seed
Readers
Council v2 prompt · tool dispatch canonical_pattern bias
Build cite
R555

T3 llm_wiki_log 3 snapshots

Compacted operational fact set rebuilt by R84. Latest snapshot lifted at every chat call (~30k tokens).
Table
llm_wiki_log
Migration
056_llm_wiki_log.sql
Writers
post-commit hook · weekly cron (0 4 * * MON)
Content
function summaries · chat tool catalog · ADR titles · cron schedule · sync tier map
Cite
R84 wiki rebuild

T4 training_loop_runs 1,974 runs

Eval-set runs: question + model outputs + grader verdict + cost + latency. R285 weekly grader consumer.
Table
training_loop_runs
Migration
038_training_question_bank.sql
Writers
/api/training/run · /api/eval/run-now
Readers
R285 weekly tool-grader + admin grade dashboard
Cite
R285

T5 knowledge_chunks 3,371 chunks

Vectorized chunks of code + ADRs + recaps + workflow contracts. Top-k retrieval feeds Council v2 auto-context.
Table
knowledge_chunks + Vectorize index
Migration
122/124 (knowledge corpus build) · per spec
Writers
nightly cron corpus build · /api/knowledge/ingest
Readers
Council v2 auto-context · getCachedAutoContext()
Cite
R555 corpus build

Tables, endpoints, writers, readers

kindnamepurpose
tablereflexion_logworkflow step verdicts + self-critique · few-shot replay
tabledecision_corpuscurated Q+A pairs · top-3 lifted into council prompt
tablellm_wiki_logcompacted operational facts · latest snapshot per chat call
tabletraining_loop_runseval-set runs · R285 grader source-of-truth
tableknowledge_chunksVectorized code + ADR + recap chunks · 3,371 rows
endpointPOST /api/training/runappend a training_loop_runs row
endpointPOST /api/decision-corpus/reindexrebuild decision_corpus embeddings
endpointPOST /api/knowledge/ingestingest one source into knowledge_chunks
endpointPOST /api/learning/nightly-nowforce the nightly corpus build off-schedule
cron0 2 * * *nightly corpus build (R555)
cron0 3 * * SUNweekly tool-grader (R285)
cron0 4 * * MONR84 wiki rebuild

Open gaps · honest punch list