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.
This commit is contained in:
@@ -1,249 +1,23 @@
|
||||
# FLOOP — Gap log (step-by-step replay)
|
||||
# GAPS.md — design-gap log (CLOSED)
|
||||
|
||||
Running log of design gaps found while virtually executing FLOOP on:
|
||||
*"Quants qubits cal que tingui un ordinador quàntic per minar un bloc de bitcoin?"*
|
||||
Status: **closed 2026-10-13**. The gap log of the walkthrough replays (GAP-1..14,
|
||||
including the 2026-10-13 intent/tool corrections) has served its purpose: every
|
||||
resolution is now merged into the rewritten documents. This file stays as history —
|
||||
do not add new entries here; new design gaps get their own doc and a RUNLOG note.
|
||||
|
||||
Each entry: what's missing → where it bites → proposed resolution → which doc to patch.
|
||||
Status: **proposed**. Nothing patched yet — resolutions get merged into PIPELINE.md /
|
||||
ALGORITHM.md at the end of the replay, once the walkthrough is complete.
|
||||
Merged mapping (resolution → new home):
|
||||
|
||||
---
|
||||
| Gap (short) | New home |
|
||||
|---|---|
|
||||
| GAP-1 goal schema; GAP-4 answer typing (constant/interval/function); GAP-8 INIT epistemic closure | ALGORITHM.md §1-§2 (typing declared, tightened by evidence; decomposition is a linguistic act) |
|
||||
| GAP-2 assumption typing; GAP-7 hypothesis branching + TMS retraction; GAP-9 user-reply semantics | ALGORITHM.md §6 (branch vs parameter; user never retracted) |
|
||||
| GAP-3 decomposition is heuristic — soundness rests on the prover | ALGORITHM.md §8; ARCHITECTURE.md §8 |
|
||||
| GAP-5 fractal-table mapping; GAP-10 adequacy contract, decompose-on-failure | ALGORITHM.md §4-§5 (the type is the parent-child interface) |
|
||||
| GAP-6 budget units | ALGORITHM.md §2 step 5 (every call and engine run costs, logged) |
|
||||
| GAP-11 intent layer; GAP-12 tool_call/tool_result semantics | ARCHITECTURE.md §5-§6; ALGORITHM.md §1, §3 (typing, not path switch; tool_call as loop output) |
|
||||
| GAP-13 progress streaming + run logs | code/README.md + code/floop/stream.py (CLI part done); endpoint SSE future |
|
||||
| GAP-14 meta level | META.md (all of it) |
|
||||
| REDESIGN-1 orchestrator-as-recursion, no v1 meta-planner | ARCHITECTURE.md §7-bis; ALGORITHM.md §5 |
|
||||
|
||||
## Found at INIT (step 1)
|
||||
|
||||
### GAP-1 — Goal schema undefined
|
||||
`ALGORITHM.md` says INIT emits a "goal formula", but nothing defines its vocabulary or shape.
|
||||
**Bites:** `PROVER.derivable` can only check goals written in the same sorted language the
|
||||
evidence will be formalized into; left free-form, the LLM invents predicates the prover
|
||||
cannot consume. No home for: answer type, free parameters, success criterion,
|
||||
presupposition flags.
|
||||
**Resolution:** new core type
|
||||
`GoalSchema { quantity, unit?, answer_type, params[], criterion, presuppositions[] }`.
|
||||
INIT emits it; `ANSWER` validates its output against it; flagged presuppositions may become
|
||||
milestones (e.g. an m0 "frame check") at the planner's discretion.
|
||||
**Patch:** ALGORITHM.md §0, §3; PIPELINE.md §3.
|
||||
|
||||
### GAP-2 — `Assumption` type and ask-vs-assume criterion missing
|
||||
In the first replay, LLM-authored defaults entered the evidence table disguised as
|
||||
`UserReply` (provenance: "assumption") — type pollution that violates invariant #1 in
|
||||
spirit: LLM prose entering the table through the user channel.
|
||||
**Resolution:** new evidence type `Assumption { author: llm, marked: true, weakens_verification }`.
|
||||
Formal criterion for `ask_user`: a free parameter whose plausible range moves the answer
|
||||
by ≥ 1 order of magnitude → ask; otherwise assume + mark. A verified answer must list
|
||||
every Assumption it depends on.
|
||||
**Patch:** PIPELINE.md §5; ALGORITHM.md §0.
|
||||
|
||||
### GAP-3 — Milestone acceptance criteria unspecified
|
||||
Who validates an LLM-proposed decomposition? Nothing guarantees m1..mk ⇒ goal — proving
|
||||
that would require solving the problem itself.
|
||||
**Resolution:** acceptance check = formula well-sorted + usable as a planner subgoal.
|
||||
State explicitly in the docs that **decomposition is heuristic**: system soundness rests
|
||||
on the final PROVER check + replanning, not on decomposition soundness. (Honest
|
||||
limitation to declare, not a bug to fix away.)
|
||||
**Patch:** PIPELINE.md §4; ALGORITHM.md §3.
|
||||
|
||||
### GAP-4 — Answer typing (constant | interval | function)
|
||||
The replay's goal had a free parameter (t_or) but ANSWER returned scenario constants —
|
||||
presenting a function as bare numbers is exactly what made the answer feel wrong
|
||||
("massa gran?"). The system should have *refused* to print a single number.
|
||||
**Resolution:** `GoalSchema.answer_type ∈ {constant, interval, function}`; ANSWER must
|
||||
match it; when later evidence bounds a parameter, function → interval → constant
|
||||
(the answer tightens as evidence arrives).
|
||||
**Patch:** ALGORITHM.md §6.
|
||||
|
||||
### GAP-5 — Fractal-table mapping bug (PIPELINE.md §3)
|
||||
The orchestrator row maps CHECK → `PROVER.derivable`. But in the generic expert, CHECK
|
||||
gates the *formalization before the engine runs*; derivability is the engine's goal test
|
||||
(the stop condition). The table conflates the two.
|
||||
**Resolution:** orchestrator's formalization check = GoalSchema validity (GAP-1);
|
||||
engine goal-test = derivability (stop condition). Fix the table.
|
||||
**Patch:** PIPELINE.md §3.
|
||||
|
||||
### GAP-6 — Budget policy undefined
|
||||
Termination depends on `budget.exhausted()` but nothing sets the initial budget or its units.
|
||||
**Resolution:** budget = cost units of the meta-domain price list (§5); set by user or system
|
||||
default at INIT; logged per run; `ask_user` priced high (human latency).
|
||||
**Patch:** ALGORITHM.md §3, §5.
|
||||
|
||||
### GAP-7 — Assumption branching & dependency-directed backtracking (TMS-lite)
|
||||
Backtracking exists at search level (A* explores/prunes the plan space every turn, cheap),
|
||||
but there is no machinery for branching over **hypotheses across turns**: a factual hypothesis
|
||||
opens a world-branch that lives until evidence refutes or confirms it; on contradiction the
|
||||
branch must die *including everything built on top of it*. Current design only replans the
|
||||
active branch — nothing retracts downstream rows derived from a refuted premise.
|
||||
**Bites:** the evidence table is a single linear world; a refuted premise leaves contradictory
|
||||
rows alive; contradictions linger and poison the prover's derivability checks.
|
||||
**Resolution:**
|
||||
- Distinguish **factual hypotheses** (refutable by evidence → branch: explore, kill or
|
||||
confirm; a refuted row is marked RETRACTED) from **parameter assumptions** (GAP-2; not
|
||||
refutable by any evidence → scenario contexts, dimensions of the answer function, never
|
||||
branches). Criterion: *if no possible evidence could refute it, it is a parameter, not a
|
||||
hypothesis*.
|
||||
- Consistency CHECK on every append; on contradiction, **dependency-directed backtracking**
|
||||
(not chronological): walk the provenance graph from the contradictory rows → find culprit
|
||||
assumptions → mark RETRACTED → transitively retract every row whose provenance includes a
|
||||
culprit → replan the affected branch only.
|
||||
- The provenance graph the table already carries for auditability **doubles as the TMS
|
||||
justification graph** (Doyle 1979; ATMS de Kleer 1986 = the multi-world v2 option — keep
|
||||
all assumption contexts alive in parallel).
|
||||
- Append-only + retraction marks preserve the corpse: the dead-branch log (hypothesis,
|
||||
what refuted it, what it cost) is exactly the training data for the learned v2 router.
|
||||
**Worked example from the replay:** E5 ("the 1,151-qubit article measures the mining
|
||||
oracle") was a factual hypothesis; CHECK flagged it; one targeted knowledge call refuted it
|
||||
(it was Shor on ECDSA); the row died, nothing downstream depended on it. The machinery to
|
||||
do this automatically is what this gap adds.
|
||||
**Patch:** PIPELINE.md §4, §5; ALGORITHM.md §3.
|
||||
|
||||
### GAP-8 — INIT must be epistemically closed over the question's vocabulary
|
||||
The replay's INIT emitted a goal full of domain predicates (`minQubits(T,D,t_or)`,
|
||||
`N_c = D·2³²`, Grover, Zalka) — LLM world knowledge dressed as formalism, i.e. domain
|
||||
content entering through the back door at t=0, before ANY evidence exists. Same disease
|
||||
as CYC, one level up. Also: INIT imported the *competitive* framing (T = 600 s), which
|
||||
inflated the answer by ~17 orders of magnitude — the user's "massa gran" was the symptom.
|
||||
**Resolution (user's correction, adopted):**
|
||||
- INIT may use ONLY: (a) concepts literally present in the question, (b) a small generic
|
||||
planning scaffold (number, method, machine, resources, dependencies). No domain
|
||||
predicates, no parameters, no time, no answer structure.
|
||||
- **GoalSchema shrinks**: `{quantity, of, answer_type: OPEN, criterion}`. `answer_type`
|
||||
starts OPEN — constant vs function vs interval is *discovered by the plan* when evidence
|
||||
reveals dependencies, and tightens OPEN → FUNCTION → INTERVAL → CONSTANT.
|
||||
- **Milestones become epistemic questions**, not formulas: `Milestone{question, produces,
|
||||
deps}` — done = a sourced answer exists in the table. Dependency chains make milestones
|
||||
*templates over slots* (ReWOO at milestone level): m2 cannot even be instantiated until
|
||||
#m1 is filled. The first branch therefore has exactly ONE concrete step.
|
||||
- Domain structure (including whether time matters!) enters ONLY via evidence rows; if
|
||||
evidence at m3 says "the count depends on clock / parallelization policy", THEN the
|
||||
planner opens parameters (and GAP-2's criterion decides ask_user — a machine-vs-fleet
|
||||
spread of ≥10⁹ fires ask_user, which the first run skipped and decided alone).
|
||||
**Patch:** PIPELINE.md §3, §4; ALGORITHM.md §0, §3, §6. Deepest gap so far — affects
|
||||
fractality: the orchestrator's "formalization" is now question decomposition (a linguistic
|
||||
skill, domain-independent), not domain modeling.
|
||||
|
||||
### GAP-9 — Semantics of user-supplied knowledge (UserReply rows)
|
||||
In the replay, the user volunteered domain knowledge from memory (how the mining threshold
|
||||
works) via chat. The docs define `UserReply` as a type but never say what the system does
|
||||
with user-provided *facts* (as opposed to user-provided *scope decisions*, which the
|
||||
ask_user action was designed for).
|
||||
**Bites:** (a) Is a user fact a premise immediately, or does it need verification?
|
||||
(b) What happens when cited evidence contradicts a user row? GAP-7's retraction machinery
|
||||
assumes the culprit is a machine-checkable assumption — but you cannot "retract" the user.
|
||||
(c) ANSWER ships sources: "the user told me" is provenance, but a reader cannot audit it.
|
||||
**Resolution (proposed):**
|
||||
- User rows are premises (user is the authority on intent and scope) but are typed
|
||||
`UserReply{claim, marked: true}` and ALWAYS carry `provenance: user` into the final
|
||||
answer — user-asserted facts are listed separately from source-cited facts.
|
||||
- If a user fact is **load-bearing** for the goal (the derivation would collapse without
|
||||
it) and verification is cheap, the planner may schedule a confirm-call to `knowledge`
|
||||
— the row stays, the citation gets attached.
|
||||
- On conflict between a user row and sourced evidence: **never silent-pick**. Fire
|
||||
`ask_user` presenting the discrepancy verbatim (quote + user claim). The user is
|
||||
the tie-breaker on facts, not the system.
|
||||
**Patch:** PIPELINE.md §5; ALGORITHM.md §0.
|
||||
|
||||
### REDESIGN-1 — The orchestrator's engine is recursion into FLOOP (no symbolic planner in v1)
|
||||
User proposal, adopted: INIT is a single LLM call ("what do I need to know to answer this?");
|
||||
subquestions too big for one expert are solved by a recursive FLOOP run that knows it serves a
|
||||
parent goal. The A*/clingo meta-planner was over-engineering: with dependent questions,
|
||||
execution order = dependency order — nothing to search. Division of labour now: decomposition
|
||||
proposal = LLM (linguistic, epistemically closed per GAP-8); sequencing/budget/depth/retries/
|
||||
retraction = fixed code; stop = prover; expert-vs-recursion-vs-user per question = one cheap
|
||||
LLM judgement over the expert catalogue (which now contains floop itself as the decomposition
|
||||
expert, and the user as expert of last resort). A* returns only in v2 (budget competition
|
||||
between parallel branches / learned routing costs). Supersedes the PLANNER-centric sections
|
||||
of both docs — ALGORITHM.md rewritten as a prose description of the machine.
|
||||
|
||||
### GAP-10 — Adequacy contract & the decomposition criterion (found at depth-1 replay)
|
||||
Walking the child run exposed three things the docs left implicit:
|
||||
(a) **Who decides "is this question primitive or does it need decomposition?"** — no criterion
|
||||
existed. Working answer: decompose only when a single expert call cannot produce an answer
|
||||
of the declared type; prefer routing first and decomposing **on failure** (type-check miss /
|
||||
shallow quotes), not by upfront inspection.
|
||||
(b) **Adequacy for the parent lives in the declared answer type.** The child knows why it is
|
||||
asked (parent context), and the parent's need is expressed as the fields of the declared
|
||||
type (e.g. `Algorithm{function, input, variable, success_condition}`). A quote that fills
|
||||
3 of 4 fields fails the arrival check → targeted retry/decomposition of just the missing
|
||||
field. The type IS the parent-child interface.
|
||||
(c) **Derivability degenerates for descriptive questions**: no real logical derivation, just
|
||||
"an adequate typed, sourced row exists". Formal rigor concentrates where composition happens
|
||||
(analytic/numeric levels). State this honestly — the prover is not equally strong at all
|
||||
nodes of the tree.
|
||||
**Also discovered (not a gap — a freebie):** the stop-check runs on newly-opened questions
|
||||
too, so a child whose answer already exists in the visible table terminates with zero or one
|
||||
confirm calls. The stop-check IS the cache/dedup of the architecture.
|
||||
**Patch:** PIPELINE.md §3, §4; ALGORITHM.md §2, §4.
|
||||
|
||||
### GAP-11 — floop's scope is "answer questions"; the drop-in-LLM contract has no intent layer
|
||||
Emili (2026-10-13): floop's final goal is to **replace the LLM of a Hermes agent (or any
|
||||
harness)** — floop acts as an LLM from the outside. A harness request is not always a
|
||||
question: it can be a tool execution request, chat, or self-management. The current design
|
||||
only handles `answer`-shaped requests.
|
||||
**Bites:** positioned as a harness model, floop would decompose "what's the weather in
|
||||
Barcelona?" (needing the harness's weather tool) into retrieval subquestions instead of
|
||||
emitting a tool call — unusable as an agent LLM.
|
||||
**Resolution (design in SCOPE.md) — CORRECTED by Emili (2026-10-13):** the intent gate
|
||||
TYPES the response expected by the user/harness (`answer | tool_call | chat | meta |
|
||||
plan_only(future)`), like answer_type on GoalSchema — it does NOT choose the processing
|
||||
path and does NOT pick tools or experts. Deciding the next step (call a tool, ask an
|
||||
expert, stop) is reasoning, and all reasoning goes through the loop: subquestions, ROUTE,
|
||||
experts, prover-gated stopping. A wrong response type degrades as a type mismatch on
|
||||
output arrival (refusal/replan), never as skipped reasoning.
|
||||
**Patch:** SCOPE.md §1-§2 (new doc); README.md definition; PIPELINE.md §1 note.
|
||||
|
||||
### GAP-12 — tool_call flow and `tool_result` semantics
|
||||
Follows GAP-11: nothing defines how a harness's tool list flows through floop, nor what a
|
||||
tool result is epistemically.
|
||||
**Resolution (SCOPE.md §3) — CORRECTED by Emili (2026-10-13):** tool_call is an OUTPUT of
|
||||
the loop, not an alternative path to it. Tool list + JSON schemas enter as typed evidence
|
||||
(`tool_schema` rows); "which tool satisfies this?", "what arguments?", "is the observation
|
||||
enough?" are ordinary subquestions routed to experts (logic over schemas, analytic/numeric
|
||||
for argument values, knowledge for world facts) — no LLM shortcut decides a tool directly.
|
||||
The loop emits a typed tool_call row (tool, args) with provenance over the schema/evidence
|
||||
rows that justify it; the tool executes outside the LLM (harness-side when floop serves as
|
||||
the model); its result enters the table as a **`tool_result` row: an observation with
|
||||
provenance** (tool name, args, ts, payload) — epistemically like UserReply rows: user-side
|
||||
facts about what happened, never "verified" claims, no containment check (that gate is for
|
||||
source-document quotes), never silently retracted; conflicts → user. Then the loop iterates
|
||||
on the new observation (ReAct with typed, evidenced steps; stop = prover).
|
||||
**Patch:** SCOPE.md §3; PIPELINE.md §5 (add row types + provenance law note).
|
||||
|
||||
### GAP-13 — serving is invisible: no per-call progress stream, no run log
|
||||
Emili (2026-10-13): running from CLI shows only the final summary; LLM calls can be long —
|
||||
he wants (a) a line before each LLM call naming it, (b) the raw LLM output as it lands,
|
||||
(c) the same for engines, (d) log-to-file always (flushed, `tail -f`-able) + screen output
|
||||
only under a flag.
|
||||
**Resolution (DESIGN in SCOPE.md §4) — CLARIFIED by Emili the same day:** screen ≠ log. The
|
||||
screen is the future **"thinking" output of floop-as-LLM** (a readable subset); the log is
|
||||
the full technical record and stays a superset — they will diverge. **IMPLEMENTED (CLI part,
|
||||
2026-10-13):** `floop/stream.py` (`RunStreams`: log always flushed; `think()` → screen iff
|
||||
verbose), machine hooks on every LLM stage + engine + budget tick, child runs share the
|
||||
parent's stream; `run_app.py --verbose`. Verified live: 8-call run shows reasoning inline.
|
||||
**Remaining:** real token-level streaming (dspy/litellm path) and the endpoint SSE mode.
|
||||
**Patch:** SCOPE.md §4; code/floop/stream.py; code/README.md next-steps.
|
||||
|
||||
### GAP-14 — no meta level: floop does not learn from its own behaviour
|
||||
Emili (2026-10-13): after executing, floop should analyse its own answer — **offline, as a
|
||||
scheduled task, after having already replied** — to (a) grow the knowledge store (fill KG
|
||||
gaps observed in runs) and (b) learn from itself; and later, fine-tune the called LLMs and/or
|
||||
let dspy optimizers (MIPROv2-class) improve the Signature-docstring prompts from our own
|
||||
usage data.
|
||||
**Resolution (design in SCOPE.md §5):** a `SelfAnalysis` dspy signature consumes a completed
|
||||
run (report + stack + evidence + failures) and emits a structured critique, appended to the
|
||||
run dir and to a lessons bank (`runs/lessons.md`). Dspy optimizer trainsets come from
|
||||
critiques; the metric = post-hoc evaluator agreement (improvements adopted when measured,
|
||||
never silently shipped). The v2 router connection: PIPELINE §7 says v1's logs are v2's
|
||||
training data — the meta-level is the machinery that produces them.
|
||||
**Patch:** SCOPE.md §5; PIPELINE.md §7 pointer.
|
||||
|
||||
---
|
||||
|
||||
## Notes from the replay (not gaps — lessons)
|
||||
|
||||
- The E5 rejection (Shor-on-ECDSA article posing as "quantum attack on Bitcoin") was the
|
||||
type checker doing its job — the fleet config's `check` caught a cross-type confusion.
|
||||
Keep per-expert checks that know the *failure shapes* of their sources.
|
||||
- The knowledge expert ran degraded (search snippets only — page extraction unavailable)
|
||||
and should have downgraded confidence accordingly. Degraded-source confidence policy
|
||||
is a small open question, related to GAP-2.
|
||||
- The honest answer to the demo question is a function of t_or (and weakly of D, T);
|
||||
the literature-standard constant (~2.4k–13k logical qubits, one machine, no deadline)
|
||||
is the collapse of that function under "no clock constraints".
|
||||
The original entries (with the reasoning that produced them) live in git history — see
|
||||
the pre-rewrite versions of PIPELINE.md and SCOPE.md.
|
||||
Reference in New Issue
Block a user