Skip to content

dream(intelligence): #3475 expose fisherDecayRate via CLAUDE_FLOW_FISHER_DECAY env override (evaluated, ACCEPT-scoped) - #3476

Draft
ruvnet wants to merge 4 commits into
mainfrom
dream/2026-09-27-intelligence
Draft

ruvnet wants to merge 4 commits into
mainfrom
dream/2026-09-27-intelligence

Conversation

@ruvnet

@ruvnet ruvnet commented Sep 27, 2026

Copy link
Copy Markdown
Owner

1. Hypothesis

Given EWCConsolidator's fisherDecayRate (default 0.01) now correctly gating one consistent EMA direction across all three globalFisher-mutating sites (computeFisherMatrix(), recordGradient(), production-wired updateFisherFromConfidences() — post dream-cycle #3395), when a CLAUDE_FLOW_FISHER_DECAY env override is added — mirroring envPriorDecay()/envMaxUncertainty() in model-router.ts exactly (validated via Number.isFinite, range (0,1], silent fallback to the unchanged default on invalid/unset input) — then operators/future Dream Cycle nights should be able to experiment with different decay-rate values without a source change, subject to: (1) unset/invalid env leaves default behavior byte-identical; (2) an explicit constructor value still takes precedence; (3) all existing EWC tests remain green; (4) deterministic, $0 evaluation.

Deliberately scoped to making the parameter tunable, not finding a better value — see Darwin Results below for why the latter isn't claimed tonight.

Frozen before evaluation; not modified after seeing results.

2. Candidate

v3/@claude-flow/cli/src/memory/ewc-consolidation.ts (+21/-1, one file): adds envFisherDecayRate() (identical validation pattern to sibling envPriorDecay()), wires it as DEFAULT_EWC_CONFIG.fisherDecayRate = envFisherDecayRate() ?? 0.01. Confirmed by direct read that intelligence.ts:326's only production call site never passes an explicit fisherDecayRate, so the env var reaches production unshadowed. Includes a post-critique operator doc-note that the singleton reads the env var once at first construction (same behavior class as the already-merged envPriorDecay(), not a new regression).

v3/@claude-flow/cli/__tests__/ewc-fisher-decay-env-override.test.ts (new, 5 tests).

3. Evaluation Receipt

evaluated: accepted (ACCEPT-scoped). Real evaluator: Vitest 4.1.8, deterministic, $0, zero LLM calls, run against a freshly pnpm install-ed workspace (v3/'s pnpm workspace and @claude-flow/cli's dist/ were not pre-built in this checkout at session start).

Stash-isolated baseline (source reverted, test file kept): exactly 1/5 new tests fails against real baseline (0.158... not < 0.104... — the "wires the env var" discriminator), 4/5 pass both ways (correct non-discriminating controls). Candidate: 5/5 pass. Full @claude-flow/cli vitest suite: byte-identical 108 pre-existing failed-file set baseline vs. candidate (diffed, not just counted — the unbuilt-sibling-package/environmental class documented by nearly every prior dream-cycle night). tsc --noEmit: byte-identical 475 pre-existing errors, none in changed files. EWC-adjacent suites (ewc-fisher-ema-direction.test.ts, ewc-distill-confidence-gate.test.ts): 7/7 passing throughout, zero regression.

4. Baseline Comparison

Baseline Candidate
CLAUDE_FLOW_FISHER_DECAY=0.5, no explicit config Ignored — default stays 0.01 Wired in — single-call retention ~50% vs. default's ~99%
Out-of-range (1.5) / non-numeric / zero env value N/A (var doesn't exist yet) Falls back to unchanged default (0.01)
Explicit { fisherDecayRate: 0.01 } with env=0.9 set N/A Explicit config wins (retention matches 0.01 behavior, not 0.9's)
Full package failed-file set 108 files 108 files (byte-identical)
tsc --noEmit 475 pre-existing errors 475 (byte-identical)
EWC-adjacent suites 7/7 7/7

5. Darwin Lineage

Skipped — for a different reason than every prior night. fisherDecayRate genuinely is now a real, bounded, correctly-directioned scalar — Darwin's real interface (npx ruvector harness darwin <config> --execute, confirmed available) could in principle sweep it, unlike every prior candidate (binary correctness fixes with no continuous parameter). Not invoked because it requires a fitness function tied to a real downstream outcome, which doesn't exist yet for Fisher-decay values specifically. Declined to fabricate a synthetic proxy just to produce a Darwin result — see the linked issue's §6 and the gist for the concrete named follow-up.

6. Flywheel Evidence

No .claude-flow/flywheel/ state or signed @metaharness/flywheel bundle applies to this deterministic config-fix (confirmed via npx ruvector harness flywheel --help). Evidence retained as: 5 new discriminating tests, the linked issue, the committed gist, the stash-isolated comparison, and the independent adversarial critique transcript.

7. Reward Hack Check

No standalone reward-hack CLI reachable. Manual checklist, independently re-verified by the adversarial critic: no existing test weakened (diff purely additive); no gold/expected data touched; no cherry-picking (full suite and full EWC-adjacent suite both reported); no seed manipulation (deterministic, re-run 4x with zero flakiness); zero cost.

8. Security Review

Not security-sensitive. envFisherDecayRate() uses the identical safe pattern as sibling envPriorDecay()/envMaxUncertainty() (Number() + Number.isFinite + range check, silent-safe fallback, no eval/exec). Independently confirmed: no request-body/API/MCP-input path can set CLAUDE_FLOW_FISHER_DECAY — operator-set process env only, same trust boundary as the existing CLAUDE_FLOW_PRIOR_DECAY.

Independent adversarial critique (separate subagent, no authoring context): independently re-read the diff, ran all 5 new tests, independently reproduced the stash-isolated baseline-vs-candidate proof itself, re-ran the existing EWC suites (7/7), and traced intelligence.ts:326 to confirm no shadowing call site exists. Verdict: CONFIRMED-WITH-CAVEATS → both caveats closed same-session (operator doc-note added for the sticky-singleton env-read behavior; the gist itself is now committed to this branch, since the critic initially couldn't verify its own Darwin-scoping reasoning from a checkout that didn't yet have the file).

9. Regression Analysis

Byte-identical failed-test-file set (108 files) and tsc --noEmit error set (475) baseline vs. candidate across the full @claude-flow/cli package. intelligence.ts is the only production caller of getEWCConsolidator() and never passes fisherDecayRate explicitly (grep-confirmed across hooks-tools.ts/intelligence.ts/index.ts), so the env var reaches production in every real call path without being shadowed.

10. ADR

None — scoped, additive config-exposure change to an already-decided mechanism (the EMA direction was already fixed and decided by #3395), matching repo convention for this exact fix class (cf. #3350's identical priorDecay exposure, which also created no ADR).

11. Research Gist

docs/dream-cycle/dream-gist-2026-09-27.md (this branch) — full SOTA report: 5-role parallel research fan-out (deep researcher, competitor analyst, capabilities scan, memory scan, independent architecture reviewer), 3 competitor-comparison tables (intelligence/capabilities/memory, 4-7 rows each with real sourced grades), 5 scored intelligence candidates (this one selected, 4.65/5), and scan findings for capabilities (a real, tested, but completely unwired PluginIntegrityVerifier — ADR-145 P1, still Proposed) and memory (two still-live, independently-confirmed inefficiencies distinct from already-merged fixes).

12. Issue

Closes #3475 (full 15-section report: ledger check with GitHub-verified fates for the last 8 nights plus a newly-confirmed 09-23/09-25/09-26 no-run gap, research, evaluation receipt, adversarial critique, reward-hack check, security review, capabilities/memory scan findings, competitor comparison, witness).

13. Witness

Field Value
Session commit a5adb5aadc8378169c7ad9ddee8c942bc3f9f9a1
Gist SHA-256 (pre-witness content) 5a2cf06014446a1dea65bab2b0a73ba24df8c8c8a08442116e0c2e704cca7011
Witness stamp 538729fe5dd14cc49fa2decc1f7475de51d05367b3e04740318c2a635513323a

Verifier procedure: fetch docs/dream-cycle/dream-gist-2026-09-27.md from this branch, strip the witness table's three filled values back to PENDING, SHA-256 it, concatenate with the session commit above, SHA-256 again — result must equal the witness stamp. Self-verified end-to-end against the committed file before this description was written.

14. Merge Policy

Human review required. Do not self-merge. Do not autonomously promote Flywheel state.


🤖 Generated with RuFlo

https://claude.ai/code/session_017NSCBLZggg81jUaa8RvZV7


Generated by Claude Code

ruvnet added a commit that referenced this pull request Sep 27, 2026
…-run-gap notes

Records the 2026-09-26 batch merge clearing #3330/#3350/#3352/#3357/#3385/#3395
(GitHub-verified via pull_request_read), #3378's landing via batch PR #3443 +
npm publish #3452, and a new confirmed no-run gap on 2026-09-23/25/26. Appends
tonight's row (#3475/#3476, ACCEPT-scoped).

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017NSCBLZggg81jUaa8RvZV7
@ruvnet

ruvnet commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Backlog sweep 2026-10-09: still valid against main (fisherDecayRate is hardcoded to 0.01 in cli/src/memory/ewc-consolidation.ts:158), but DIRTY, so it needs a rebase before it can be considered. It targets the cli EWC consolidator and is independent of the neural-mode EWC rework (#3879). It adds a new env var, so it also needs its audit-env-var-precedence entry and a minor-bump decision from the integrator.

claude and others added 4 commits October 9, 2026 02:55
…CAY env override

EWCConsolidator's fisherDecayRate (default 0.01) gates the online-EMA
update across all three globalFisher-mutating sites, all of which now
share one correct direction (dream-cycle 2026-09-22, #3395). It had no
env override, unlike its closest sibling tunable, ModelRouter's
priorDecay (#3350's CLAUDE_FLOW_PRIOR_DECAY). This mirrors that exact
envPriorDecay()/envMaxUncertainty() pattern so the rate is tunable
without a source change, per constructor-value still taking
precedence. Evaluation, adversarial critique, and issue/PR references
land in follow-up commits on this branch.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017NSCBLZggg81jUaa8RvZV7
…ch gist + witness

Adversarial critique (CONFIRMED-WITH-CAVEATS) on the CLAUDE_FLOW_FISHER_DECAY
env override found the singleton-sticky env-read behavior (same class as the
already-merged CLAUDE_FLOW_PRIOR_DECAY, not a regression) worth documenting
for operators expecting live reload -- added to envFisherDecayRate()'s
docstring. Also commits tonight's full research gist (5-role parallel
fan-out, competitor comparison, capabilities/memory scan findings, witness
table self-verified against the documented verifier procedure).

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017NSCBLZggg81jUaa8RvZV7
…-run-gap notes

Records the 2026-09-26 batch merge clearing #3330/#3350/#3352/#3357/#3385/#3395
(GitHub-verified via pull_request_read), #3378's landing via batch PR #3443 +
npm publish #3452, and a new confirmed no-run gap on 2026-09-23/25/26. Appends
tonight's row (#3475/#3476, ACCEPT-scoped).

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017NSCBLZggg81jUaa8RvZV7
…-var escape hatch

CI's env-var-precedence audit (ADR-125/ADR-130, scripts/audit-env-var-precedence.mjs)
correctly failed on this PR: CLAUDE_FLOW_FISHER_DECAY is a new
CLAUDE_FLOW_*/RUFLO_* env var read with no CLI-flag override path,
which the audit flags by design. Registered it in KNOWN_ESCAPE_HATCHES
right next to CLAUDE_FLOW_PRIOR_DECAY, whose exact justification it
mirrors: EWCConsolidator is a process-lifetime singleton with no single
CLI invocation owning its lifetime, same as ModelRouter. Reproduced the
failure locally (node scripts/audit-env-var-precedence.mjs) before this
fix and confirmed it passes after.

Co-Authored-By: RuFlo <ruv@ruv.net>
Claude-Session: https://claude.ai/code/session_017NSCBLZggg81jUaa8RvZV7
@ruvnet
ruvnet force-pushed the dream/2026-09-27-intelligence branch from 7c7274a to 63f4d97 Compare October 9, 2026 02:57

ruvnet commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto current main (commit 63f4d97d, force-pushed) — the LEDGER.md conflict from the 2026-10-09 backlog sweep is resolved (kept both sides' rows/notes, nothing dropped), and confirmed clean of conflicts with the neural-mode EWC rework (#3879), which touches a different package entirely.

On the audit-env-var-precedence entry: that was already added in this PR's 3rd commit (7c7274a, pushed 2026-09-27, in response to CI's own first-run failure on this exact gate) — CLAUDE_FLOW_FISHER_DECAY is registered in KNOWN_ESCAPE_HATCHES right next to CLAUDE_FLOW_PRIOR_DECAY, whose exact justification it mirrors. Re-ran node scripts/audit-env-var-precedence.mjs against the rebased head just now — still passes. Re-ran the full EWC-adjacent test suite (12/12) against the rebased head too, no regressions.

Leaving the minor-version-bump call to you as the integrator, per your comment.


🤖 Generated with RuFlo


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dream Cycle 2026-09-27] intelligence: expose fisherDecayRate via env override + capabilities,memory scan

2 participants