floop v0.1: design docs + executable dspy draft
Root: README, PIPELINE, ALGORITHM, GAPS, RUNLOG (design + first executable runs). code/: v0.1 draft on dspy 3.4 (INIT/ROUTE/EXPERT/MISSING/ANSWER as dspy calls, machine as fixed code, stub engines — honest Unverified). knowledge/: DESIGN.md for the KG-first knowledge expert (pre-implementation).
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# floop/code — v0.1 draft implementation
|
||||
|
||||
A **draft**: every deciding stage (formal checks, the prover, real engines) is a
|
||||
stub, so the draft runs with only LLM calls (as decided) and every answer is
|
||||
honestly marked **UNVERIFIED**. The architecture — states, laws, control flow —
|
||||
is the real v0.1 shape; only the formal layer is missing.
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
cd floop/code
|
||||
.venv/bin/python run_app.py "What information do I need to plan a trip to Tokyo?" # any question
|
||||
FLOOP_LM=ollama-cloud .venv/bin/python run_app.py "..." # cloud LM instead of local
|
||||
```
|
||||
|
||||
`config.yaml` holds the budget knobs and the two LM providers (no keys in code:
|
||||
`ollama-cloud` reads `OLLAMA_API_KEY` from the environment).
|
||||
|
||||
## What is real vs stub (the honest map)
|
||||
|
||||
| Stage (ALGORITHM.md) | Status | Where |
|
||||
|---|---|---|
|
||||
| INIT — epistemic decomposition (LLM call) | real (dspy.Predict) | `floop/dspy_modules.py` |
|
||||
| MISSING — gap decomposition on stuck goal | real (dspy) | `floop/dspy_modules.py` |
|
||||
| ROUTE — one LLM judgement over the catalogue | real (dspy) | `floop/dspy_modules.py` |
|
||||
| Expert attendants (the draft answer) | **STUB engine**: LLM call, `verified=False` | `floop/engine.py` |
|
||||
| Arrival check (type check + contradiction) | **STUB**: only UNKNOWN refusal | `machine._append_checked` |
|
||||
| Prover (stop condition, derivability) | **STUB**: question stack terminal | `machine._finish` |
|
||||
| `user` expert | not wired — explicit failure row | `floop/engine.py` |
|
||||
| Backtracking / retraction (TMS) | not in the draft (§5 comes with the prover) | — |
|
||||
| The machine (stack, dependency order, budget, recursion) | real fixed code | `floop/machine.py`, `floop/state.py` |
|
||||
| Evidence table (append-only, provenance, no prose) | real | `floop/state.py` |
|
||||
|
||||
Laws kept: the table only ever receives typed payloads (never LLM prose); rows
|
||||
carry provenance + trace; the machine — not the LLM — owns sequencing, budget,
|
||||
retries and stopping; answer synthesis sees only evidence rows and cites them.
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
config.yaml budget + LM providers
|
||||
run_app.py CLI entry
|
||||
floop/state.py EvidenceTable, QuestionStack, Budget, slot instantiation (#En -> value)
|
||||
floop/llm.py dspy LM configuration (OpenAI-compatible endpoints)
|
||||
floop/dspy_modules.py every LLM call as a dspy module (INIT, ROUTE, EXPERT, MISSING, ANSWER)
|
||||
floop/engine.py engine interface + draft stub engines
|
||||
floop/machine.py FloopRun — the loop; recursion for the `floop` attendant
|
||||
tests/state.py unit tests (no LLM)
|
||||
```
|
||||
|
||||
## Next steps (design order from the docs)
|
||||
|
||||
1. Real check layer on expert arrival (well-formedness per expert kind) — the
|
||||
#1 failure mode is misformalization; keep it BEFORE engines.
|
||||
2. `knowledge` expert with real search + verbatim quotes (one vertical E2E).
|
||||
3. Prover for the stop condition (clingo/Z3) — replaces the stub derivability.
|
||||
4. Log every run (v2's router will eat these trajectories).
|
||||
Reference in New Issue
Block a user