Implements the execution-branching design over ambiguous answers — the fork per reading with shared knowledge and a conditional final answer.
Why: the knowledge audit flags several defensible readings (ambiguous + alternatives), but nothing downstream knew what to do with them: passing alternatives into the next question's context only moves the coin-flip into answer_kg (rejected), and run L showed ANSWER collapsing two flagged readings into one chosen reading — the exact behaviour he rejected. The blessed design: one execution branch per reading, acquired knowledge shared, conditional answer.
Lazy — a branch is born only when the ambiguous row has an open dependent subtree (frozen at fork time, same questions for every branch).
A branch is a world — the dependent subtree is re-created inside the branch (branch-scoped qids B1.Q2); the shared table is read through a BranchView that binds the ambiguous row to the branch's reading (a view — the table is never mutated; the original keeps all readings) and hides other branches' rows.
Shared — every branch's new rows land in the ONE table tagged provenance['branch']; KG/seen-index shared by construction. No fork: a later branch reuses an earlier one's gathering.
Death — contradiction, dead end (all questions failed), or natural merge (same normalized answer → one conclusion). Never an absurdity judge.
Nesting — an ambiguous row inside a branch opens sub-branches under it (origin=<branch id>); the parent carries its children's conditional. Branch cap 6, extras dropped and NAMED.
Conditional answer — _finish composes the final answer by fixed code: if you meant the PM reading -> Rajoy | if you meant Socialist International -> Papandreou. Single survivor renders plain. FORK/BRANCH lines WARN on screen and log.
Docs: ALGORITHM.md §6-bis; README honest-map row. Tests:tests/branches.py — 5 E2E (fork + conditional, lazy no-fork, dead-branch honesty, natural merge, nested sub-branches). Suite 18/18. Live smoke (ollama-cloud, warm agent KG) runs clean through the new paths.
How to test:cd code && uv run python tests/branches.py; his local Pedro run over his accumulated KG is the real-detector proof (the agent's warm KG didn't hold a second reading this time — the fork fires when the audit flags).
Implements the execution-branching design over ambiguous answers — the fork per reading with shared knowledge and a conditional final answer.
**Why:** the knowledge audit flags several defensible readings (`ambiguous` + alternatives), but nothing downstream knew what to do with them: passing alternatives into the next question's context only moves the coin-flip into answer_kg (rejected), and run L showed ANSWER collapsing two flagged readings into one chosen reading — the exact behaviour he rejected. The blessed design: one execution branch per reading, acquired knowledge shared, conditional answer.
**Mechanism** (`floop/branches.py` + `machine._run_branch`):
- **Lazy** — a branch is born only when the ambiguous row has an open dependent subtree (frozen at fork time, same questions for every branch).
- **A branch is a world** — the dependent subtree is re-created inside the branch (branch-scoped qids `B1.Q2`); the shared table is read through a `BranchView` that binds the ambiguous row to the branch's reading (a view — the table is never mutated; the original keeps all readings) and hides other branches' rows.
- **Shared** — every branch's new rows land in the ONE table tagged `provenance['branch']`; KG/seen-index shared by construction. No fork: a later branch reuses an earlier one's gathering.
- **Death** — contradiction, dead end (all questions failed), or natural merge (same normalized answer → one conclusion). Never an absurdity judge.
- **Nesting** — an ambiguous row inside a branch opens sub-branches under it (`origin=<branch id>`); the parent carries its children's conditional. Branch cap 6, extras dropped and NAMED.
- **Conditional answer** — `_finish` composes the final answer by fixed code: `if you meant the PM reading -> Rajoy | if you meant Socialist International -> Papandreou`. Single survivor renders plain. FORK/BRANCH lines WARN on screen and log.
**Docs:** ALGORITHM.md §6-bis; README honest-map row. **Tests:** `tests/branches.py` — 5 E2E (fork + conditional, lazy no-fork, dead-branch honesty, natural merge, nested sub-branches). Suite 18/18. Live smoke (ollama-cloud, warm agent KG) runs clean through the new paths.
**How to test:** `cd code && uv run python tests/branches.py`; his local Pedro run over his accumulated KG is the real-detector proof (the agent's warm KG didn't hold a second reading this time — the fork fires when the audit flags).
His branching design (22-23/10, consolidated; now coded): when an
expert returns SEVERAL defensible readings of one question (the
knowledge ablation audit's ambiguous + alternatives payload), a
question that DEPENDS on that row must not inherit the coin-flip.
The old behaviour: alternatives were passed in the router context
(rejected — it only moves the guess into answer_kg) or collapsed
inside the ANSWER prompt (run L: 'Papandreou was the predecessor' —
the exact rejected behaviour).
The mechanism (floop/branches.py + machine._run_branch):
- LAZY: a branch is born only when the ambiguous row has an OPEN
dependent subtree (open_subtree, frozen at fork time so every
branch of the fork copies the same questions); an ambiguity nobody
needs stays a note.
- A branch is a WORLD, not a fork of the run: the dependent subtree
is re-created inside the branch with branch-scoped qids (B1.Q2),
and the shared evidence table is read through a BranchView that
BINDS the ambiguous row to the branch's reading (a VIEW — the table
is never mutated, the original row keeps all readings) and hides
other branches' rows.
- SHARED: acquired knowledge lands in the ONE table, tagged
provenance['branch']; the KG/seen-index live in the expert, shared
by construction. A later branch reuses an earlier one's gathering.
- DEATH: by contradiction, dead end (all branch questions failed) or
NATURAL MERGE (same normalized answer as another branch — one
conclusion, recorded merged). Never an absurdity judge.
- NESTING: an ambiguous row answered inside a branch (with its own
dependent) opens sub-branches under it (origin=<branch id>); the
parent carries its children's conditional as its answer. Branch
cap (6) drops and NAMES extra readings — never silent.
- CONDITIONAL ANSWER: _finish composes the final answer by FIXED
CODE over surviving branches — 'if you meant X -> A | if you meant
Y -> B'; single survivor renders plain. Never a synthesis prompt
choosing a reading inside itself.
- WARNINGS: FORK/BRANCH lines on screen AND log ([W]) — the fork is
a machine judgement worth a human's eye, and META's lessons bank
counts them.
Docs: ALGORITHM.md §6-bis (the mechanism as a law); README honest map
row. Tests: tests/branches.py — 5 E2E (fork+conditional, lazy no-fork,
dead-branch honesty, natural merge, nested sub-branches). Suite 18/18.
Live smoke (ollama-cloud, warm agent KG): the Pedro question runs
clean through the new paths (8 calls, 52s, honest answer; the fork
did not fire — the audit found no second reading in that KG; the
mechanism is proven by the E2E tests, the real-detector proof is his
local run over his accumulated KG).
onibot
merged commit 302e50120c into main2026-10-23 16:29:44 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements the execution-branching design over ambiguous answers — the fork per reading with shared knowledge and a conditional final answer.
Why: the knowledge audit flags several defensible readings (
ambiguous+ alternatives), but nothing downstream knew what to do with them: passing alternatives into the next question's context only moves the coin-flip into answer_kg (rejected), and run L showed ANSWER collapsing two flagged readings into one chosen reading — the exact behaviour he rejected. The blessed design: one execution branch per reading, acquired knowledge shared, conditional answer.Mechanism (
floop/branches.py+machine._run_branch):B1.Q2); the shared table is read through aBranchViewthat binds the ambiguous row to the branch's reading (a view — the table is never mutated; the original keeps all readings) and hides other branches' rows.provenance['branch']; KG/seen-index shared by construction. No fork: a later branch reuses an earlier one's gathering.origin=<branch id>); the parent carries its children's conditional. Branch cap 6, extras dropped and NAMED._finishcomposes the final answer by fixed code:if you meant the PM reading -> Rajoy | if you meant Socialist International -> Papandreou. Single survivor renders plain. FORK/BRANCH lines WARN on screen and log.Docs: ALGORITHM.md §6-bis; README honest-map row. Tests:
tests/branches.py— 5 E2E (fork + conditional, lazy no-fork, dead-branch honesty, natural merge, nested sub-branches). Suite 18/18. Live smoke (ollama-cloud, warm agent KG) runs clean through the new paths.How to test:
cd code && uv run python tests/branches.py; his local Pedro run over his accumulated KG is the real-detector proof (the agent's warm KG didn't hold a second reading this time — the fork fires when the audit flags).