Files
onibot 67f466bd84 docs: full rewrite from a clean slate (v0.3)
The idea is now clear, so the docs are rewritten from zero around it: LLMs do language, algorithms do thinking, verified knowledge lives on disk. New set: ARCHITECTURE (system + laws: division of labour, LLM calls as typed function calls via dspy Signatures, context as a per-call budget over unlimited machine state, evidence table laws, interface contract, tools as loop output, fleet, guarantees, v1->v2), ALGORITHM (general loop for any goal: reception/typing, main loop, tool action, generic expert, recursion, backtracking, per-call context composition), KNOWLEDGE (substrate: store, gather, checks, probe, offline growth), META (two levels: in-run self-awareness; offline self-analysis, lessons bank, prompt optimization, fine-tuning, v2 router). PIPELINE.md and SCOPE.md removed - superseded; GAPS.md closed with a merge map. Code untouched.
2026-10-14 10:28:21 +02:00

87 lines
4.6 KiB
Markdown

# META.md — the two meta levels
floop is aware of itself at two levels, one within the run and one between runs. Both are
instances of the fractal: the loop applied to floop's own behaviour. Neither ever runs
inside a serving response — level 2 is offline by definition.
## 1. Level one — in-run self-awareness
While serving a goal, floop **sees its own loop**: the question stack, the budget spent
and remaining, the depth of recursion, which calls are in flight, which retries are
burning, what the evidence table holds. This is not introspection mysticism — it is that
the machine's state is explicit, typed and queryable, and the per-call context composer
(ARCHITECTURE.md §3) can include it: an expert call whose context says "attempt 2 of 3,
budget 12/40, this question failed once as numeric" behaves differently from a blind
retry.
Concretely, the state that any call can be given as context:
- the goal and the response type it serves;
- the open questions and their dependency status;
- the budget ledger (calls spent, remaining, depth caps);
- the evidence rows relevant to the task (and how many times anything similar failed);
- floop's own operating notes — lessons from past runs (level two's output) — consulted
like any other knowledge, when relevant.
Self-awareness in the run is therefore **context composition over an explicit state**,
plus the honesty rules that already govern it: the machine, not the LLM, decides what is
true of the run; the LLM only reads what it is given.
## 2. Level two — offline self-analysis
After a run completes and the response is already delivered, floop analyzes its own
performance — as a scheduled task over its own logs, never inside the serving loop.
**Input**: the complete run record — the run log (every call, every context composed,
every output, every cost), the question stack, the evidence table, the failures and
retried calls, the final response and its verification status.
**Process**: a `SelfAnalysis` pass (an LLM Signature over the run record, composed
safely within the window — chunked if the run is long) plus deterministic statistics
(call counts by stage, retry rates, budget waste, routing decisions that preceded
failures, questions that never fed the parent).
**Output — a structured critique**: where decomposition over-split or under-split; where
routing misfired (and what signal would have caught it); where the per-call context was
missing something (context mis-composition); which checks should have caught what slipped;
what the run's honest quality was versus what it claimed. The critique is appended to the
run's directory and to a **lessons bank** (`runs/lessons.md`) — typed, citable, and
consultable by future runs at level one.
## 3. Offline maintenance (the `meta` goal type)
The same scheduled machinery serves floop's housekeeping as explicit goals:
- **Knowledge growth**: fill KG gaps observed in past runs (repeatedly unresolved
entities, failed checks, stale sources) via the standard gather pipeline.
- **Lessons distillation**: periodically condense the lessons bank into operating notes
(compact, high-signal), which level-one context composition serves to calls that need
them.
- **Cost accounting**: aggregate run economics — which stages dominate cost, which
experts pay for themselves — feeding v2's learned router.
## 4. Learning loops (the future path, stated now because the design must admit it)
1. **Prompt optimization (dspy-native)**: our prompts are Signature docstrings; dspy
optimizers (BootstrapFewShot now; MIPROv2-class later) compile improved prompts using
the lessons bank and critiques as trainset, with a post-hoc evaluator as metric.
Improvements are adopted when measured, never silently.
2. **Fine-tuning**: logged trajectories (contexts in, outputs out, verdicts from
self-analysis) become SFT data for the models floop calls.
3. **The learned router (v2)**: rational metareasoning — the value of computation
estimated from logged trajectories. The machine stays sound; its cost model becomes
data-driven.
All three eat the same substrate: **honest, complete logs of what floop actually did**.
That is why every run is logged the way it is (ARCHITECTURE.md §3; the run log IS the
training set).
## 5. Guardrails
- Self-analysis never edits the past: runs are append-only records; critiques are
annotations, not rewrites.
- Operating notes are knowledge like any other: typed, provenance-carrying (which runs
produced them), and revocable.
- Learning changes the *process*, never the laws: an optimizer may change a prompt's
wording, never the division of labour or the checks. A fine-tuned model still passes
the same gates.