research: his ruling on the dspy cache (--no-cache, not a bug) + the implementation plan

- RESEARCH-semantic-kg: measurement note reworded per his call — the
  disk cache is caching doing its job; --no-cache CLI flag for test
  runs, default unchanged.
- RESEARCH-derived-answers: the 5-phase plan appended (hygiene →
  taxonomy → temporal → prover → consumers), open decisions listed
  (DSL vocabulary, order primitives placement, translator location).
  Awaiting his approval; no code.
This commit is contained in:
2026-10-25 15:41:03 +01:00
parent 9cfc068ad6
commit 262f40b981
2 changed files with 77 additions and 3 deletions
+73 -1
View File
@@ -267,4 +267,76 @@ dependency for v1 of this.
- The ablation audit stays for the one job left to it: readings that
are NOT store-derivable (judge-visible ambiguity in free text).
- Branching (floop/branches.py) gains a cleaner trigger (a binding set)
but its death/merge semantics are untouched.
but its death/merge semantics are untouched.
## Implementation plan (proposed — awaiting his approval; no code yet)
Phases ordered by dependency; each closes with tests + live runs.
Phase 0 is main-bound and independent of the research direction.
### Phase 0 — hygiene (main; small, shippable alone)
1. (K5) fix: clean the judge's value at the output boundary
(_answer_from_rows) — regex anchored to TRAILING row-citation shapes
("(K5)", "(cited from rows K16 and K30)") so legitimate parentheticals
("(PSOE)") survive. Prompt side: value desc gains "answer only, no
row citations". Regression = the K5 repro pair (raw value → audit
runs and flags the Spain alternative).
2. --no-cache CLI flag (his ruling 25/10: the dspy disk cache is not a
bug; it stays the default): when set, configure_lm builds dspy.LM
with cache=False — a per-process bypass, the cache dir untouched.
For A/B and freshness testing.
3. Import assert at startup: the resolved floop/ and knowledge/ module
paths must be under the repo being run — the shared venv's editable
pth pins imports to MAIN's tree and ran main code inside the branch
worktree without any signal (run 085457). Abort loudly on mismatch.
### Phase 1 — conflict taxonomy at merge (this branch, store)
_classify 4 → 6 cases, signals in cost order: same quote_id →
co-asserted (conjunction, never a conflict); extracted windows →
temporal (interval arithmetic: disjoint = succession, overlapping =
alternatives); discriminant tokens + tail resolution against nodes →
alternatives vs paraphrase-merge (merge = same_as edge, append-only);
what survives with a functional relation = real contradiction. The
edge gains a class field; the alternatives bucket is exposed to the
audit and the render. Fixtures: the live 20-pair inventory (10
co-asserted, 3+1 temporal, 3 alternatives, 0 real).
### Phase 2 — temporal layer (this branch, extractor + store)
Typed Fact (feature/typed-facts vehicle) gains start/end/point/
granularity, orders [{before|after|concurrent, refs}], duration,
anchor (date | event node), immediacy — every field containment-
checked against the quote. Store: edge start/end columns + fact_order
table. _classify consumes interval arithmetic. Bounded backfill:
re-extract quotes of existing conflicting pairs with empty windows.
NO Allen labels anywhere — the algebra stays a computed view.
### Phase 3 — the query prover (the new core)
Hand-written goal-directed evaluator over SQLite: six operators
(lookup, temporal filter, order/select, setops, arithmetic
composition, path), typed DSL, proof term as the payload, re-execution
as the check. Translator question→DSL: one structured-output LLM call
(MASK/EXTRACT class), validated before execution. Wiring: the prover
becomes the real stop-check at machine._finish (derivability);
AnswerFromKG stays only as the fallback for non-translatable
questions. Regression: Pedro proves Rajoy as a closed path; "of what"
returns the three bindings as a set; rivers stay green; judge LLM
calls drop to zero on store-derivable paths.
### Phase 4 — consumers
The audit reduces to "is the binding set already multi?" (cheap,
deterministic) + ablation only for non-derivable readings. The branch
fork (floop/branches.py) starts from binding multiplicity. ANSWER and
any surviving judge render over proof terms, not free prose.
### Open decisions (his call, before Phase 3 coding)
- DSL vocabulary: the translator and the evaluator share one grammar —
its exact terms.
- Order primitives: inside Fact (same call) vs a separate pass.
- Translator location: inside INIT (the decomposition and the query
born together) vs a post-INIT step per question.