mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-04 06:21:59 +09:00
b7ee03e29464dfffa027580eaabfa9b8cfdf024e
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
189aceca1d |
feat(learning): the verified-outcome learning loop on classic hooks, for every ruflo project (ADR-512) (#4604)
* feat(learning): run the verified-outcome learning loop on classic hooks for every ruflo project (ADR-512) Until now only the opt-in ruflo-mods plugin recorded verified turns and showed lessons. Classic hooks (every `ruflo init` project) now do the same. They replay the session transcript (`transcript_path`) through the mod's own record and lesson code, bundled into .claude/helpers/learning-loop.cjs: - route: records the turns that finished, then prints the lessons that fit the new prompt - session-end: records the rest (PreCompact leaves the open turn open). This runs before the session-id dedup, which otherwise dropped SessionEnd after a PreCompact. It also starts a detached `ruflo hooks verified-ingest --quiet` - one implementation: plugins/ruflo-mods/scripts/build-learning-loop-helper.mjs bundles hooks/loop/transcript.ts; the bundle is committed, checked in mod-guidance CI, and is a signed critical helper that helper-refresh installs (manifest re-signed) - never twice: with its loop on, the mod adds `learning-loop` to RUFLO_MODS_OWNS - opt-out: .claude-flow/config.json learningLoop.enabled=false, or RUFLO_LEARNING_LOOP=0 Tests: mods-learning-loop-classic (replay matches the mod's records, offsets, the hook-handler run as a process, end to end classic record -> real ingest -> lesson in route output) and real-binary contract 6 (pinned claude, mock model, no plugin). ruflo-mods 0.14.0. Co-Authored-By: RuFlo <ruv@ruv.net> * docs(adr): ADR-512 cites PR #4604 Co-Authored-By: RuFlo <ruv@ruv.net> * ci: sign and exclude the classic-loop helper and real-binary test where the other helpers are (ADR-512) smoke-helper-signing-security copies the critical helpers into its fixture; it now copies learning-loop.cjs too. The ratchet's default run skips real-binary files, which need the claude binary (mods-real-binary runs them). Co-Authored-By: RuFlo <ruv@ruv.net> * test(mods): give the built-CLI tests the time their children get vitest's 5s default timed out mods-cli-bin on a loaded CI runner and reported only STACK_TRACE_ERROR (the timeout error carries the stack of the it() call). Each test runs the built CLI several times with a 120s child timeout. Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: r <r@x> |
||
|
|
243bc57f0b |
feat(learning): lessons say where the fix goes; reworded tasks learn together (ADR-511) (#4603)
* feat(learning): lessons say where the fix goes; reworded tasks learn together (ADR-511) The §7 evaluation (#4581) showed three limits on what the verified-outcome loop can learn: - a lesson named an agent, nothing the model can act on; - tasks naming different files merged into one lesson; - the same task worded differently never learned (15 reworded verified successes left 15 patterns at one success each, zero lessons). Changes: - mods: a verified turn records its screened edited source files; a lesson names the three its passing fixes edited most and leads with them; pick() weighs rare keywords (IDF) and drops matches far below the best. ruflo-mods 0.13.0. - cli: files are counted per pattern (successes only) into learned-lessons.json; SONA takes them as pattern anchors (never keywords), so reworded tasks that fixed the same file reinforce one pattern; tasks naming disjoint paths never merge. Lesson building moves to verified-lessons.ts. - eval: the harness gains --ablate, --test-index, --concurrency, --lessons, --save-lessons, --eval-sample, --calibrate and --max-turns; scripts/eval-learning-loop-corpus.mjs writes a validated 15+30-task corpus. Proved offline (tests): 15 reworded prompts form 5 lessons, up from 0; the first run's prompts form 5 lessons, up from 1; the right lesson ranks first for 30 of 30 eval prompts, with 1.07 lessons shown per prompt. Paid pilots (haiku, about $6.80) are directional and did not reach the gate: - 8-turn cap: off 2/10, on 4/10, lessons without files 1/10; - uncapped: 6/6 vs 6/6, cost within 1%. ADR-511 §5 has the details. Co-Authored-By: RuFlo <ruv@ruv.net> * docs(adr): ADR-511 cites PR #4603 Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: r <r@x> |
||
|
|
49fe0b362b |
feat(mods): compactSnapshot — pre-compaction snapshot + post-compaction reload (ADR-505) (#4591)
* feat(mods): compactSnapshot — pre-compaction transcript snapshot + one-shot reload block (ADR-505) New ruflo-mods option compactSnapshot (default on). On a main-loop manual/auto/plugin session.compact it writes the transcript about to be summarized to .claude-flow/sessions/compactions/snapshot-<n>.jsonl (role, text <= 2000 chars, tool names/ids only; each line screened; 400 messages / 2 MiB; ten rotating slots), beside the compaction so it is never blocked, delayed or rewritten. The next non-slash prompt after a compaction that stood gets one [RUFLO_AFTER_COMPACT] context block (<= 2000 chars) from lessons shown this session, the last 5 loop outcomes, open swarm/claim ids and the snapshot path. ruflo doctor warns when snapshots exist and git would commit them. Co-Authored-By: RuFlo <ruv@ruv.net> * test(mods): isolate the ADR-505 doctor test from global git excludes; note precompute inference Co-Authored-By: RuFlo <ruv@ruv.net> * docs(adr): ADR-505 status names PR #4591 Co-Authored-By: RuFlo <ruv@ruv.net> * fix(mods): compactSnapshot screens raw message text before JSON encoding (ADR-505) JSON escaping put a backslash before quotes and encoded newlines, so the key-assignment rule missed "api_key": "..." / password="..." and the line-start role-tag rule missed a \nsystem: line; those were written to the snapshot in plaintext. messageLine now screens the raw cut text and the tool names, plus the encoded line as before. Negative-control test added. Co-Authored-By: RuFlo <ruv@ruv.net> * chore(ruflo-mods): 0.10.0 for ADR-505 --------- Co-authored-by: r <r@x> |
||
|
|
38112e0042 |
feat(mods): learning-loop gaming defences — taints, re-verify, anomaly gate (ADR-503) (#4590)
* feat(learning-loop): gaming defences for verified outcomes (ADR-503) The verified-outcome loop (ADR-502) trusts a verifier's exit status, but the model chooses what that verifier checks. Four downgrade-only layers: - mod: a verified-success record carries taints when the turn edited a test file (edited-tests), a verifier config (edited-verifier-config), or decided on a weakened/narrowed command (narrowed-verifier); a per-process session token is written on every record. The outcome word never changes. - CLI: a success with a taint not listed in .claude-flow/config.json learningLoop.allowTaint is counted under `tainted` and never reaches SONA. - CLI: opt-in re-verify (learningLoop.reverify, off by default) re-runs a rotating allowlisted manifest check in a temp detached git worktree at HEAD with a timeout; failure, timeout or error downgrades to unknown. Only an explicit verified-ingest re-verifies; hot callers defer. - CLI: anomaly gate holds would-be lessons that are perfect-and-tainted, only-narrowed, or from one session, listed as `held: <id> (<reason>)`. Adds scripts/eval-learning-loop.mjs (manual, plan-only unless --run). Co-Authored-By: RuFlo <ruv@ruv.net> * docs(adr): ADR-503 status names PR #4590 Co-Authored-By: RuFlo <ruv@ruv.net> * fix(learning-loop): shell edits of tests taint; test the real re-verify runner (ADR-503) - A Bash command that writes, moves or deletes a test file or verifier config (rm, mv, cp, tee, truncate, sed -i/perl -i, output redirection, git rm/checkout/restore/...) now sets edited-tests / edited-verifier-config like an Edit of that file. Before this change, Edit src/a.ts + `sed -i 's/it(/it.skip(/' src/a.test.ts` + `npm test` produced an untainted verified-success. Downgrade-only: reads and test runs earn nothing. - gitWorktreeRunner is now tested against a throwaway git repo: pass, fail, missing script, timeout (hung script's process verified dead), non-repo error. After each run only the main worktree remains and no ruflo-reverify-* dir is left. A negative control (kill only the direct child) makes the timeout test fail. - ADR-503 implementation notes record both, plus the interpreter-write gap. Co-Authored-By: RuFlo <ruv@ruv.net> * test(learning-loop): give the hung-check re-verify test an 8s budget for cold CI runners Co-Authored-By: RuFlo <ruv@ruv.net> * chore(ruflo-mods): 0.9.0 for ADR-503 Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: r <r@x> |
||
|
|
375e846c66 |
feat(mods): verified-outcome learning loop, on by default (learningLoop, #4581, ADR-502) (#4583)
* feat(mods): verified-outcome learning loop (learningLoop, #4581, ADR-502) ruflo-mods 0.8.0 adds the learningLoop option (default off). Each main-loop turn becomes a trajectory whose outcome is verified-success/verified-failure only when a recognised test/build/typecheck/lint command ran after the turn's last edit and the shell's exit status said so; otherwise unknown. A masked status (|| true, pipes, ;, background, substitution) verifies nothing, and the model's own words are never read. The CLI ingests the records (ruflo hooks verified-ingest, the hooks_intelligence_verified-ingest MCP tool, and automatically from hooks_route and hooks_session-end): only verified records train SONA, unknown ones are counted; each id once; PII-redacted. It writes learned-lessons.json, and the mod adds at most three cited lessons at or above the 0.6 gate to a matching prompt. doctor --component learning-loop reports whether outcomes reach SONA. Stages 5-7 of #4581 (pane, autonomous /loop-run, GEPA self-tuning) are deferred; the on-by-default evaluation has not been run. Co-Authored-By: RuFlo <ruv@ruv.net> * fix(mods): learning loop needs an edit to verify; redact e-mails before writing (#4581) A turn that edited nothing is unknown (a verifier verifies a change). The mod replaces e-mail addresses in the stored task; ADR-502 states the privacy limit (broader PII redaction runs at CLI ingest). Co-Authored-By: RuFlo <ruv@ruv.net> * feat(mods): learningLoop on by default (#4581) Maintainer decision: ship the learning loop on by default. Set the learningLoop option to false to turn it off. ADR-502 records that the issue's 30-task evaluation has not been run yet. Co-Authored-By: RuFlo <ruv@ruv.net> * fix(cli): ADR-112 guidance on hooks_intelligence_verified-ingest (#4581) Co-Authored-By: RuFlo <ruv@ruv.net> --------- Co-authored-by: r <r@x> |