5.3 CodeGraph Blast-Radius Prevention & FinOps Routing
graphify index . && chinwag pr-notes inspect-prHow DELIVERY uses local structural call graphs (.codegraph) to prevent cross-module breakage and optimize multi-model inference costs.
5.3 CodeGraph Blast-Radius Prevention & FinOps Routing
graphify index . && chinwag pr-notes inspect-pr
Two questions determine whether an autonomous coding workflow saves money or creates technical debt:
- Structural Blast Radius: "If Agent A changes this trait signature in
core-types, how many downstream crates and tests will break?" - Model-Tier Efficiency: "Does this 40-line JSON schema migration require an ultra-tier reasoning model, or will a fast coding model pass every gate on the first try at a fraction of the cost?"
Chinwag Delivery-2 answers both questions deterministically before a single token of code generation is spent.
1. Local .codegraph Structural Dependency Index
Whenever chinwag init or chinwag tasks sync runs locally, Chinwag builds a compact, zero-source-leak structural dependency index at .chinwag/codegraph.bin (.codegraph).
For every module, public symbol, trait, and exported TypeScript/Rust/Python interface, .codegraph records:
- In-Degree (
fan_in): Number of downstream callers across the workspace. - Out-Degree (
fan_out): Number of upstream dependencies invoked. - Transitive Test Coverage Map: Exact test targets affected when a file changes.
- Historical 7-Day Survival Score (
SURV): Percentage of lines in this module that survived 7 days post-merge without emergency hotfixes.
# Inspect the structural blast radius of a proposed file scope locally (0 Cr)
chinwag tasks blast-radius --file-scope "crates/chinwag-crypto/src/hpke.rs"
[codegraph] Target: crates/chinwag-crypto/src/hpke.rs
• Exported Public Symbols: 6 (seal_v2, open_v2, verify_dual_sig, ...)
• Downstream Callers (fan_in): 19 modules across 4 crates
• Blast-Radius Tier: HIGH (Core Cryptographic Boundary)
• Mandatory Policy Floor: WP-03 (Dual-Agent Triad) + WP-11 (Crypto Review Gate)
• Selective Test Targets: cargo test -p chinwag-crypto -p chinwag-relay -p chinwag-cli
How .codegraph Prevents Merge Cascades
When Chinwag Reflex-1 sees a ticket touching a high-fan_in file (fan_in >= 10), it automatically:
- Rejects overlapping parallel
--file-scopeleases on dependent downstream modules until the upstream interface change lands. - Injects the exact downstream
cargo test/pnpm testtargets into the agent's localH1pre-handoff hook so downstream breakage is caught in the agent's ownShadow jjworkspace before review.
2. Smart Model-Tier FinOps Routing
Engineering teams frequently overspend by routing 100% of tickets · including CSS token tweaks, boilerplate CRUD endpoints, and README updates · through their slowest, highest-cost frontier reasoning tier.
Chinwag Delivery-2 analyzes each sub-task's .codegraph blast radius, estimated LOC, and historical 7-day code survival (SURV) to recommend the most cost-effective model tier that satisfies your quality floor:
| Blast-Radius Tier | Typical Task Profile | Recommended Execution Pattern | Typical Credit Spend |
|---|---|---|---|
Tier 1 · Leaf Module (fan_in <= 2, < 80 LOC) | Unit tests, docs, isolated UI components, schema adapters | Single fast coding model + local H1 / 176/176 DOM gate (0 Cr) + 1-way / 2-round handoff | 0 – 50 Cr |
Tier 2 · Standard Feature (fan_in 3..9, 80..150 LOC) | API handlers, state reducers, CLI subcommands | Cross-model Driver + Reviewer Pair (chinwag pair) | 100 Cr ($0.64 Growth) |
Tier 3 · Core / Security Boundary (fan_in >= 10 or Crypto/Auth) | Wire protocols, database migrations, auth middleware | Full Driver + Independent QA + Adversarial Reviewer Triad (chinwag triad) | 150 Cr ($0.96 Growth) |
**Tier 4 · Critical / High-Residual Quorum (Quad · ` | R^3 f |
3. Two-Loop Empirical Seat Selection & CI Quorum Gates (chinwag omp & chinwag-ci omp-gate)
Rather than hardcoding static model preferences that go stale whenever a frontier lab ships a new model release, Chinwag Delivery-2 (chinwag delivery enable) combines Loop 1 empirical defect-catch learning (OmpDictionaryStateV1 + 7-day SURV in .chinwag/state.crdb) with Loop 2 <5ms Coherence-Penalized Orthogonal Matching Pursuit (CP-OMP) (chinwag omp) and deterministic CI enforcement (Pillars 10 & 11 of chinwag-ci: chinwag-ci omp-gate and chinwag-ci policy-gate):
# 1. Enable Chinwag Delivery-2 autonomous seat routing & quorum sizing
chinwag delivery enable --repo .
# 2. Inspect live CP-OMP empirical dictionary & Gram-Schmidt residual risk per domain
chinwag omp status --repo . --json
# 3. Verify orthogonal quorum receipt & residual risk floor in CI (Pillar 10 of chinwag-ci, 0 Cr)
chinwag-ci omp-gate --policy chinwag.workflow.yaml --commit HEAD --json
# 4. Verify declarative workflow policy & zero-smalltalk .cwcard schema lock (Pillar 11, 0 Cr)
chinwag-ci policy-gate --policy chinwag.workflow.yaml --commit HEAD --json
Monthly FinOps Ledger & Cost Transparency
Run chinwag tasks finops at any time to inspect your organization's real-time credit velocity and model efficiency:
chinwag tasks finops --window 30d
[finops] Organization: acme-corp (Last 30 Days · 15 Developers)
• Merged Tasks: 184 tickets (96.2% 7-day code survival)
• Local Free Checks (0 Cr): 4,912 runs (H1 hooks, local Shadow-KV forks, Stage 1 UI gate, Copy gate)
• Two-Round 1:1 Handoffs (50 Cr): 1,320 convos (66,000 Cr)
• Broken-CI Wakeup & Fix (50 Cr): 132 cycles (6,600 Cr)
• Cross-Model Pair / Triad Runs: 198 sandboxes (132 Pair @ 100 Cr + 66 Triad @ 150 Cr = 23,100 Cr)
• Chinwag Vision-3 16-Surface QA: 308 billed runs (220 audits @ 100 Cr + 88 auto-patches @ 200 Cr = 39,600 Cr; 81% cache hit rate across 1,621 total runs!)
• Estimated CI Minutes Saved: 64.5 engineering hours prevented via pre-commit .codegraph checks
Next Steps
- Next: Direct
<20msCI Routing vs.++ TriageEscalation - Want maximum engineering velocity per credit? Reserve Your Organization Credit Pack →
Executable Tickets & Auto-Splitting
How Chinwag backs every Linear Issue and GitHub Project Item with 100% webhook-free Executable Tickets in the Chinwag Encrypted Artifact Store (<org>/chinwag-tasks.git), enforces synchronous Proof-of-Green board gates (200ms snap-back on fake Done), teleports in-flight tickets in <300ms, and auto-splits oversized specs (p90 > 150 LOC).
++ Triage & CI Recovery
How chinwag ci-report eliminates the 40-minute broken-build tax with Strike-1 direct routing & fix cycle (50 Cr) and Strike >= 2 ++ Triage root-cause synthesis & Pair re-assignment (100 Cr).