feat: useful-flow Phi + sensitivity primitives (+ example 08 system-simulation) - #6
Merged
Conversation
…n both languages Adds the cmg-native simulation capability the Tower simulations surfaced: score configurations by useful flow (Phi = quality/cost) and rank knobs by sensitivity (what to tune next). Configuration what-if + sensitivity is cmg's lane; flow-network min-cut stays in intelligence-flow. - core: usefulFlowScore + combineCost/combineQuality (TS + Python), beside compareRuns. - math: sensitivity + rankSensitivity, finite-difference gradient (TS + Python), beside errorSensitivity. - example 08-system-simulation in both languages: sweep a parameterized pipeline, score by Phi, pick the best, rank knobs by sensitivity. TS and Python output is byte-identical; each has a self-check + expected-output.txt. - docs/05-useful-flow-and-sensitivity.md: the math/principle (network flow for Phi, finite-difference gradient for sensitivity), framed for math / engineering / CS. - CHANGELOG entries (Change / Why / Domain influence / Languages). No modelgraph changes (cmg is standalone). Parity enforced. Domain-free. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the two simulation-derived primitives to both languages, plus a domain-free example that exercises them.
usefulFlowScore(core) - Phi = Q / C, the useful-flow-to-an-accepted-sink score (network flow / OR), withcombineCost/combineQualityhelpers.sensitivity/rankSensitivity(math) - finite-difference d(objective)/d(knob); ranking knobs answers "what to tune next".Parity
Primitives ship in TypeScript and Python; example 08 output is byte-identical across both (
expected-output.txt).Verify
🤖 Generated with Claude Code