Emili's correction: the gate annotates the goal with the expected response type (answer/tool_call/chat/meta/plan_only); it never chooses paths, tools or experts. Deciding the next step is reasoning and goes through the loop (subquestions, ROUTE, experts, prover). tool_schema rows in, tool_call row out with provenance, tool_result as user-side observation, iterate like ReAct with evidenced steps. GAPS.md GAP-11/12 corrected in place.
6.0 KiB
SCOPE.md — floop beyond Q&A
Status: DESIGN for review — no code yet. Three additions from Emili's review of 2026-10-13 (floop as a drop-in LLM, CLI streaming, offline meta level), corrected the same day: the intent gate types the response; it never bypasses the loop (§2).
1. Reframing: floop as a drop-in LLM
floop exposes an LLM-like interface: messages + system + tools in → text (or tool_call) out, OpenAI-compatible. A Hermes agent (or any harness) should be able to point its model
provider at floop and behave exactly as before. Everything inside is the fractal loop — LLM
calls that translate/propose, typed evidence, engines that decide, a prover that gates
stopping. "Answer questions" is what the loop does for one response type; the contract with
the harness is broader.
2. The intent layer — a response-type gate, not a path switch
Every harness request first passes an intent classification — one LLM judgement + fixed-code
validation — that declares what kind of response is expected: answer | tool_call | chat | meta | plan_only (future). That is ALL the gate does.
What the gate does NOT do (Emili's correction, 2026-10-13): choose the processing path, pick tools, or decide which experts run. Deciding the next step — call this tool, ask that expert, stop here — is reasoning, and all reasoning goes through the loop: subquestions, ROUTE per question, experts as attendants, prover-gated stopping. The gate only annotates the goal with the expected response type (GoalSchema.response_type), the same way answer_type is declared and then tightened by evidence.
chat and meta are goal types too: the loop still runs and simply finds them trivially
derivable (a greeting needs no decomposition), or — for meta — schedules floop's own
maintenance (§5).
3. tool_call is an OUTPUT of the loop, not an alternative to it
A harness runs a ReAct loop: observe tool results, decide the next action, repeat. floop serves that loop with the same machinery it uses for questions:
- The harness's tool list + JSON schemas enter as typed evidence (
tool_schemarows). - "Which tool can satisfy this?", "what arguments does it need?", "is the last observation enough to answer?" are ordinary subquestions, routed to experts like any other: logic reasons over schemas, analytic/numeric compute argument values, knowledge supplies world facts. No LLM shortcut decides a tool directly.
- The loop's OUTPUT can be a
tool_call: a typed row (tool, args) whose provenance cites the schema rows and evidence that justify it. Fixed code validates it against the tool's schema before emission — the LLM proposes, code disposes. - The tool executes outside the LLM (harness-side when floop serves as the model —
same contract as any LLM). Its observation enters the table as a
tool_resultrow: a user-side fact with provenance (tool name, args, ts, payload) — like UserReply rows, never "verified", never silently retracted; conflicts go to the user. - Then the loop iterates on the new observation: re-decide — another tool, an expert, or stop (prover). Every step of the ReAct chain is evidenced and auditable: "thought" is replaced by computation, "observation" is typed before it enters the state.
Stopping for a tool-call goal: the prover's derivability instantiates as "the evidence supports a concrete (tool, args)" — same formal shape, different predicate. Misroutes degrade cheaply: a wrong response type is a type mismatch on output arrival — the same refusal/replan path any type mismatch takes; the reasoning was never skipped.
4. progress streaming + run logs (CLI) — IMPLEMENTED (CLI part)
Design: an event stream is produced on every run — one format, two channels.
- Always:
runs/<ts>-<slug>/run.logwith explicit flush (tail -f-able): timestamps, budget ticks, raw payloads, all technical detail. --verbose: the thinking subset prints to the screen (flushed,[T]lines,>depth prefixes). Thinking is the future user-facing "thinking" output of floop-as-LLM; log ⊇ thinking, and they will diverge.- (later, same events) the endpoint's streaming mode: SSE-style events for external consumers.
5. The meta level: floop learns from its own runs (offline, future)
After answering, floop analyses itself — as a scheduled task, not inside the serving loop. Design shape:
- Self-analysis run (a dspy signature, e.g.
SelfAnalysis): input = a completed run's report + question stack + evidence table (+ tool results, + which steps failed); output = structured critique — where decomposition over-split or under-split, where routing misfired, where the check layer should have caught something, budget spent well or wasted. The critique is appended to the run dir and to a lessons bank (runs/lessons.md). - Knowledge growth: the same scheduled task runs the knowledge gather offline — filling KG gaps observed in past runs (entities repeatedly unresolved → fetch proactively).
- Prompt improvement (dspy-native): our prompts are Signature docstrings; dspy optimizers (BootstrapFewShot now, MIPROv2-class later) compile improved prompts from the lessons bank + critiques — trainset = critiques with quality labels, metric = post-hoc evaluator agreement. Adopted only when measured.
- Fine-tuning path (later): logged trajectories become SFT data for the models we call.
Connection to the plan: v2's learned router (PIPELINE §7) needs exactly these logged trajectories + critiques as training data; the meta-level is how they get produced.
6. Doc ripple
- README: definition already repositioned; PIPELINE.md still to note the response-type gate
and the
tool_schema/tool_resultrow types (§5). - GAPS.md: GAP-11/12 carry the 2026-10-13 correction; GAP-13 (streaming) CLI part done.
7. Explicitly NOT now
No code for the gate, the endpoint, or self-analysis — this document only. Everything here is future work recorded while the project is being defined.