Skip to content

feat(savings): ship Procedure Foundry evidence ledger#84

Open
Cranot wants to merge 1 commit into
mainfrom
codex/savings-platform-wire
Open

feat(savings): ship Procedure Foundry evidence ledger#84
Cranot wants to merge 1 commit into
mainfrom
codex/savings-platform-wire

Conversation

@Cranot

@Cranot Cranot commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • add roam savings with admissibility gates over joined live episodes
  • add privacy-preserving Claude/Codex transcript backfill and Procedure Foundry ranking
  • add producer-side --aggregate output that structurally excludes transcript-derived values
  • add capability displaces metadata and classify the new commands in agent modes
  • synchronize command counts and public command/changelog mirrors

Evidence

  • feature, capability, CLI, docs, and compatibility test matrix passes
  • Ruff format/check passes
  • pre-push FAST bundle passes 7/7, including whole-tree anti-leak and structural guards
  • producer aggregate on Prakteon: 26,408 historical episodes, 3/3 canaries, causal claims withheld

Safety

Historical frequency nominates interventions only. measurement_admissible, policy_admissible, and causal_savings_claimed remain false until prospective joined evidence satisfies the declared gates. Raw prompts, responses, paths, source, shell-command values, identifiers, and per-episode rows are excluded from --aggregate.

@github-actions

Copy link
Copy Markdown

roam-code Analysis

Mode: incremental (changed-only) — base 0506aede419c5446dff8d3ac31dbd7b3c32ff23d, 30 changed+dependent files

Health Score: 78/100 FAIR

health: Fair codebase (78/100) — 49 critical, 7 warnings, focus: god_components
pr-risk: High risk (60/100) — careful review needed (risk_level high) (driver: hotspot_score)

Health Metrics

Metric Value
Health Score 78/100
Tangle Ratio 0%
Propagation Cost 0.0013
Total Issues 65

PR Risk

Metric Value
Risk Score 60/100

Quality Gate: PASSED

Gate expression: health_score>=50

SARIF Upload

Metric Value
Category roam-code-self-analysis/self-analysis/py3.12
Results Uploaded 82
Full analysis output

health

{
  "_meta": {
    "cache_ttl_s": 300,
    "cacheable": true,
    "index_age_s": 3,
    "index_status": {
      "dirty_files": 0,
      "fresh": false,
      "head_commit": "ef1ad86d26eb",
      "hint": "index latest commit 932f8c46cf82 != HEAD ef1ad86d26eb — git-derived metrics (commits, churn, co-change, weather) may be stale. Run `roam index --force`.",
      "indexed_commit": "932f8c46cf82"
    },
    "latency_ms": null,
    "response_tokens": 4087,
    "roam_version": "13.9.0",
    "timestamp": "2026-07-16T20:21:14Z"
  },
  "actionable_count": 16,
  "actionable_cycles": 0,
  "agent_contract": {
    "confidence": null,
    "facts": [
      "Fair codebase (78/100) — 49 critical, 7 warnings, focus: god_components",
      "health score 78",
      "tangle ratio 0.0",
      "0.0013 propagation cost findings",
      "issue count 65"
    ],
    "next_commands": [
      "roam debt",
      "roam trends --days 30"
    ],
    "risks": []
  },
  "algebraic_connectivity": null,
  "algebraic_connectivity_available": false,
  "bottleneck_thresholds": {
    "p70": 658.2,
    "p90": 4380,
    "population": 2368,
    "utility_multiplier": 1.5
  },
  "category_severity": {
    "bottlenecks": {
      "critical": 15,
      "info": 0,
      "warning": 0
    },
    "cycles": {
      "critical": 0,
      "info": 0,
      "warning": 0
    },
    "god_components": {
      "critical": 34,
      "info": 9,
      "warning": 7
    },
    "layer_violations": {
      "critical": 0,
      "info": 0,
      "warning": 0
    }
  },
  "command": "health",
  "cycles_actionable": 0,
  "cycles_total": 17,
  "framework_filtered": 0,
  "health_score": 78,
  "ignored_cycles": 17,
  "imported_coverable_lines": 0,
  "imported_coverage_files": 0,
  "imported_coverage_pct": null,
  "imported_covered_lines": 0,
  "index_status": {
    "dirty_files": 0,
    "fresh": false,
    "head_commit": "ef1ad86d26eb",
    "hint": "index latest commit 932f8c46cf82 != HEAD ef1ad86d26eb — git-derived metrics (commits, churn, co-change, weather) may be stale. Run `roam index --force`.",
    "indexed_commit": "932f8c46cf82"
  },
  "issue_count": 65,
  "list_counts": {
    "bottlenecks": 15,
    "cycle_break_suggestions": 0,
    "cycles": 17,
    "god_components": 50,
    "layer_violations": 0,
    "next_steps": 2,
    "score_breakdown": 5
  },
  "project": "roam-code",
  "propagation_cost": 0.0013,
  "schema": "roam-envelope-v1",
  "schema_version": "1.1.0",
  "severity": {
    "critical": 49,
    "info": 26,
    "warning": 7
  },
  "summary": {
    "actionable_cycles": 0,
    "algebraic_connectivity": null,
    "algebraic_connectivity_available": false,
    "category_severity": {
      "bottlenecks": {
        "critical": 15,
        "info": 0,
        "warning": 0
      },
      "cycles": {
        "critical": 0,
        "info": 0,
        "warning": 0
      },
      "god_components": {
        "critical": 34,
        "info": 9,
        "warning": 7
      },
      "layer_violations": {
        "critical": 0,
        "info": 0,
        "warning": 0
      }
    },
    "cycles_actionable": 0,
    "cycles_definition": "Cycle counts derived from `roam.graph.cycles.find_cycles(G, min_size=2)` on the symbol graph. `cycles_total` = all SCCs of size >= 2; `cycles_actionable` = SCCs spanning >=2 files AND no test files (same-file and test-only cycles are informational). Run `roam health` for the per-cycle breakdown.",
    "cycles_total": 17,
    "detail_available": true,
    "god_components": 50,
    "god_components_definition": "God components: symbols where `(in_degree + out_degree) > 20` from the `graph_metrics` table, with utility-aware severity bands (standard >50=CRITICAL >30=WARNING; utility >150=CRITICAL >90=WARNING). Run `roam health` for the per-symbol breakdown. Legacy aliases: `god_objects` (fingerprint), `god_classes` (rules).",
    "health_score": 78,
    "health_score_definition": "weighted geometric mean (0-100) of 5 sigmoid health factors: tangle_ratio, god_components, bottlenecks, layer_violations, file_health (+coverage if available).",
    "ignored_cycles": 17,
    "imported_coverage_files": 0,
    "imported_coverage_pct": null,
    "issue_count": 65,
    "partial_success": true,
    "preserved_list_truncations": {},
    "propagation_cost": 0.0013,
    "severity": {
      "critical": 49,
      "info": 26,
      "warning": 7
    },
    "tangle_ratio": 0,
    "tangle_ratio_definition": "fraction of symbols inside non-trivial SCCs; higher = more cyclic coupling.",
    "total_cycles": 17,
    "truncated": true,
    "verdict": "Fair codebase (78/100) — 49 critical, 7 warnings, focus: god_components",
    "warnings_out": [
      "health_algebraic_connectivity_warning:RuntimeWarning:algebraic_connectivity compute failed (ModuleNotFoundError): No module named 'numpy'; returning 0.0 sentinel — value is NOT a legitimate disconnected-graph reading"
    ]
  },
  "tangle_ratio": 0,
  "total_cycles": 17,
  "utility_count": 34,
  "version": "13.9.0",
  "warnings_out": [
    "health_algebraic_connectivity_warning:RuntimeWarning:algebraic_connectivity compute failed (ModuleNotFoundError): No module named 'numpy'; returning 0.0 sentinel — value is NOT a legitimate disconnected-graph reading"
  ]
}

pr-risk

{
  "_meta": {
    "cache_ttl_s": 60,
    "cacheable": true,
    "index_age_s": 6,
    "index_status": {
      "dirty_files": 0,
      "fresh": false,
      "head_commit": "ef1ad86d26eb",
      "hint": "index latest commit 932f8c46cf82 != HEAD ef1ad86d26eb — git-derived metrics (commits, churn, co-change, weather) may be stale. Run `roam index --force`.",
      "indexed_commit": "932f8c46cf82"
    },
    "latency_ms": null,
    "response_tokens": 3216,
    "roam_version": "13.9.0",
    "timestamp": "2026-07-16T20:21:16Z"
  },
  "actor": null,
  "agent_contract": {
    "confidence": null,
    "facts": [
      "High risk (60/100) — careful review needed (risk_level high) (driver: hotspot_score)",
      "risk score 60",
      "3 risk rank findings",
      "32 changed files",
      "5074 lines added"
    ],
    "next_commands": [],
    "risks": [
      "pr-risk: high (60/100) on 0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD — driver: hotspot_score",
      "High blast radius: 11192 of 42247 symbols affected (26.5%) on 0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD"
    ]
  },
  "author": null,
  "blast_radius_pct": 26.5,
  "bus_factor_risk": 0.57,
  "change_shape": "mixed",
  "changed_files": 32,
  "closest_historical_pattern": [
    "AGENTS.md",
    "CHANGELOG.md",
    "README.md",
    "docs/COMMANDS.md",
    "docs/ci-integration.md",
    "llms-install.md",
    "skills/roam/SKILL.md",
    "src/roam/capability.py",
    "src/roam/cli.py",
    "src/roam/commands/cmd_at.py",
    "src/roam/commands/cmd_brief.py",
    "src/roam/commands/cmd_diff.py",
    "src/roam/commands/cmd_grep.py",
    "src/roam/commands/cmd_help_search.py",
    "src/roam/commands/cmd_savings.py",
    "src/roam/commands/cmd_savings_backfill.py",
    "src/roam/commands/cmd_verify.py",
    "src/roam/competitor_site_data.py",
    "src/roam/modes/policy.py",
    "src/roam/procedure_mining.py",
    "src/roam/savings.py",
    "src/roam/transcript_backfill.py",
    "templates/distribution/landing-page/changelog.html",
    "templates/distribution/landing-page/docs/agent-contract.html",
    "templates/distribution/landing-page/docs/integration-tutorials.html",
    "templates/distribution/landing-page/llms.txt",
    "templates/distribution/landing-page/pricing.html",
    "templates/distribution/landing-page/setup.html",
    "tests/test_procedure_mining.py",
    "tests/test_savings.py",
    "tests/test_savings_aggregate.py",
    "tests/test_transcript_backfill.py"
  ],
  "closest_similarity": 1,
  "cluster_spread": 0.02,
  "clusters_touched": 267,
  "command": "pr-risk",
  "coupling_score": 0.03,
  "dead_code": [
    {
      "file": "src/roam/capability.py",
      "kind": "method",
      "name": "register"
    },
    {
      "file": "src/roam/capability.py",
      "kind": "method",
      "name": "by_category"
    },
    {
      "file": "src/roam/capability.py",
      "kind": "method",
      "name": "as_registry_catalog"
    },
    {
      "file": "src/roam/cli.py",
      "kind": "class",
      "name": "LazyGroup"
    },
    {
      "file": "src/roam/cli.py",
      "kind": "method",
      "name": "parse_args"
    },
    {
      "file": "src/roam/cli.py",
      "kind": "method",
      "name": "list_commands"
    },
    {
      "file": "src/roam/cli.py",
      "kind": "method",
      "name": "get_command"
    },
    {
      "file": "src/roam/cli.py",
      "kind": "method",
      "name": "resolve_command"
    },
    {
      "file": "src/roam/cli.py",
      "kind": "method",
      "name": "invoke"
    },
    {
      "file": "src/roam/cli.py",
      "kind": "method",
      "name": "format_help"
    }
  ],
  "dead_exports": 15,
  "familiarity": {
    "avg_familiarity": 1,
    "files": [],
    "files_assessed": 0
  },
  "findings": [
    {
      "claim": "pr-risk: high (60/100) on 0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD — driver: hotspot_score",
      "confidence": "heuristic",
      "evidence": {
        "actor": null,
        "author": null,
        "blast_radius_pct": 26.5,
        "bus_factor_risk": 0.569,
        "changed_files_count": 32,
        "commit_range": "0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD",
        "coupling_score": 0.026,
        "created_at_epoch": 1784233276,
        "diff_id": "7e678026c366",
        "familiarity_risk": 0,
        "file_list": [
          "AGENTS.md",
          "CHANGELOG.md",
          "README.md",
          "docs/COMMANDS.md",
          "docs/ci-integration.md",
          "llms-install.md",
          "skills/roam/SKILL.md",
          "src/roam/capability.py",
          "src/roam/cli.py",
          "src/roam/commands/cmd_at.py",
          "src/roam/commands/cmd_brief.py",
          "src/roam/commands/cmd_diff.py",
          "src/roam/commands/cmd_grep.py",
          "src/roam/commands/cmd_help_search.py",
          "src/roam/commands/cmd_savings.py",
          "src/roam/commands/cmd_savings_backfill.py",
          "src/roam/commands/cmd_verify.py",
          "src/roam/competitor_site_data.py",
          "src/roam/modes/policy.py",
          "src/roam/procedure_mining.py",
          "src/roam/savings.py",
          "src/roam/transcript_backfill.py",
          "templates/distribution/landing-page/changelog.html",
          "templates/distribution/landing-page/docs/agent-contract.html",
          "templates/distribution/landing-page/docs/integration-tutorials.html",
          "templates/distribution/landing-page/llms.txt",
          "templates/distribution/landing-page/pricing.html",
          "templates/distribution/landing-page/setup.html",
          "tests/test_procedure_mining.py",
          "tests/test_savings.py",
          "tests/test_savings_aggregate.py",
          "tests/test_transcript_backfill.py"
        ],
        "hotspot_score": 1,
        "label": "0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD",
        "lines_added": 5074,
        "lines_removed": 20,
        "minor_risk": 0,
        "novelty_score": 0,
        "reductive_change": false,
        "risk_level": "high",
        "risk_score": 60,
        "staged": false,
        "test_coverage_pct": 58.8,
        "top_driver": "hotspot_score"
      },
      "finding_id_str": "pr-risk:composite-risk-score:7e678026c366",
      "kind": "pr-risk:composite-risk-score",
      "severity": "high",
      "source_detector": "pr-risk",
      "source_version": "1.0.0",
      "subject_id": null,
      "subject_kind": "commit"
    },
    {
      "claim": "High blast radius: 11192 of 42247 symbols affected (26.5%) on 0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD",
      "confidence": "structural",
      "evidence": {
        "affected_symbols": 11192,
        "blast_radius_pct": 26.5,
        "changed_files_count": 32,
        "changed_symbol_ids_count": 800,
        "commit_range": "0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD",
        "created_at_epoch": 1784233276,
        "diff_id": "7e678026c366",
        "file_list": [
          "AGENTS.md",
          "CHANGELOG.md",
          "README.md",
          "docs/COMMANDS.md",
          "docs/ci-integration.md",
          "llms-install.md",
          "skills/roam/SKILL.md",
          "src/roam/capability.py",
          "src/roam/cli.py",
          "src/roam/commands/cmd_at.py",
          "src/roam/commands/cmd_brief.py",
          "src/roam/commands/cmd_diff.py",
          "src/roam/commands/cmd_grep.py",
          "src/roam/commands/cmd_help_search.py",
          "src/roam/commands/cmd_savings.py",
          "src/roam/commands/cmd_savings_backfill.py",
          "src/roam/commands/cmd_verify.py",
          "src/roam/competitor_site_data.py",
          "src/roam/modes/policy.py",
          "src/roam/procedure_mining.py",
          "src/roam/savings.py",
          "src/roam/transcript_backfill.py",
          "templates/distribution/landing-page/changelog.html",
          "templates/distribution/landing-page/docs/agent-contract.html",
          "templates/distribution/landing-page/docs/integration-tutorials.html",
          "templates/distribution/landing-page/llms.txt",
          "templates/distribution/landing-page/pricing.html",
          "templates/distribution/landing-page/setup.html",
          "tests/test_procedure_mining.py",
          "tests/test_savings.py",
          "tests/test_savings_aggregate.py",
          "tests/test_transcript_backfill.py"
        ],
        "label": "0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD",
        "staged": false,
        "total_symbols": 42247
      },
      "finding_id_str": "pr-risk:high-blast-radius-symbol-touched:7e678026c366",
      "kind": "pr-risk:high-blast-radius-symbol-touched",
      "severity": "high",
      "source_detector": "pr-risk",
      "source_version": "1.0.0",
      "subject_id": null,
      "subject_kind": "commit"
    }
  ],
  "hotspot_score": 1,
  "label": "0506aede419c5446dff8d3ac31dbd7b3c32ff23d..HEAD",
  "layer_spread": 0.68,
  "layers_touched": 21,
  "lines_added": 5074,
  "lines_removed": 20,
  "minor_risk": {
    "files": [],
    "files_assessed": 0,
    "minor_files": 0
  },
  "novelty_score": 0,
  "per_file": [
    {
      "blast": 10471,
      "churn": 318,
      "is_test": false,
      "lines_added": 8,
      "lines_removed": 0,
      "path": "src/roam/capability.py",
      "symbols": 36
    },
    {
      "blast": 9560,
      "churn": 3401,
      "is_test": false,
      "lines_added": 4,
      "lines_removed": 0,
      "path": "src/roam/cli.py",
      "symbols": 86
    },
    {
      "blast": 8258,
      "churn": 677,
      "is_test": false,
      "lines_added": 5,
      "lines_removed": 0,
      "path": "src/roam/modes/policy.py",
      "symbols": 18
    },
    {
      "blast": 880,
      "churn": 1013,
      "is_test": false,
      "lines_added": 1013,
      "lines_removed": 0,
      "path": "src/roam/procedure_mining.py",
      "symbols": 38
    },
    {
      "blast": 235,
      "churn": 9992,
      "is_test": false,
      "lines_added": 1,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_verify.py",
      "symbols": 349
    },
    {
      "blast": 73,
      "churn": 1406,
      "is_test": false,
      "lines_added": 1406,
      "lines_removed": 0,
      "path": "src/roam/transcript_backfill.py",
      "symbols": 105
    },
    {
      "blast": 68,
      "churn": 3561,
      "is_test": false,
      "lines_added": 1,
      "lines_removed": 1,
      "path": "src/roam/competitor_site_data.py",
      "symbols": 24
    },
    {
      "blast": 64,
      "churn": 1210,
      "is_test": false,
      "lines_added": 1210,
      "lines_removed": 0,
      "path": "src/roam/savings.py",
      "symbols": 39
    },
    {
      "blast": 55,
      "churn": 2061,
      "is_test": false,
      "lines_added": 1,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_diff.py",
      "symbols": 8
    },
    {
      "blast": 53,
      "churn": 1791,
      "is_test": false,
      "lines_added": 1,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_grep.py",
      "symbols": 25
    },
    {
      "blast": 46,
      "churn": 213,
      "is_test": false,
      "lines_added": 1,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_at.py",
      "symbols": 4
    },
    {
      "blast": 46,
      "churn": 944,
      "is_test": false,
      "lines_added": 1,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_brief.py",
      "symbols": 18
    },
    {
      "blast": 44,
      "churn": 132,
      "is_test": false,
      "lines_added": 1,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_help_search.py",
      "symbols": 2
    },
    {
      "blast": 43,
      "churn": 190,
      "is_test": false,
      "lines_added": 190,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_savings.py",
      "symbols": 1
    },
    {
      "blast": 43,
      "churn": 137,
      "is_test": false,
      "lines_added": 137,
      "lines_removed": 0,
      "path": "src/roam/commands/cmd_savings_backfill.py",
      "symbols": 2
    },
    {
      "blast": 10,
   
...(truncated)

roam-code analysis | Commands: health pr-risk

@github-actions

Copy link
Copy Markdown

Roam Agent Review

Verdict: SAFE (risk_level low)

blast-radius 0/100 · ai-likelihood 29/100 · rule violations 0 · critique high-severity 0

Verdict: SAFE. All structural signals clean at the configured thresholds.

Next steps

  • No structural concerns at the configured thresholds. Standard review still recommended.

Powered by roam-code — Apache 2.0, 100% local. Customize thresholds in .roam/rules.yml. Docs.

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.

2 participants