Skip to content

Score-contract tooling: audit_score_inputs, rule_probe --diff-lines, contract_pr_check, worktree_env, score-contract-audit skill (child of #2908) #2916

Closed

Description

@squid-protocol

Tooling that #2908's efficiency assessment asks for before Phase 2, so that a score contract costs a fraction of a session the way a rule contract does (rule-contract-audit skill + contract-audit-scout). Each item is small and independent; a build-tier agent can do any of them from this text.

  • tests/tools/audit_score_inputs.py <risk_metric> — generalise tests/tools/audit_documentation_inputs.py (risk_documentation score contract (draft) + per-file input decomposition audit (#2908 Phase 0) #2910). One adapter per _calc_* in an EQUATION_CASES-style table: which file_data columns feed which call arguments (the SHORT_KEY_MAP names: arch_api, def_doc, state_heat_triggers, …), how fid/irc/ot are obtained (_language_constants), how mp is obtained (_get_locational_multipliers(file_path)). Reproduce every recorded risk_<metric> from its recorded inputs; print one row per file, a CLUSTER table keyed by the dominant input, a SENSITIVITY table (score vs that input over its corpus range), and --summary (one paragraph: n files, residuals, dominant input, points-per-unit). Exit 1 on residual. Start with the five formulas that carry open-defect cells or a length leak: documentation, api_exposure, tech_debt, cognitive_load, verification.
  • tests/tools/rule_probe.py --diff-lines before.json after.json [--context 2] — list lost and gained matched lines per corpus with counts, multi-line matches shown with context. The c api rule counts top-level variable declarations as public surface (a.c reads api 5 for 3 functions; +25.0% sits at the band edge) #2907 session wrote this twice; its first rule candidate lost 21 Doom K&R definitions that only this listing showed.
  • tests/tools/contract_pr_check.py [--rules|--score] --corpus <kr-worktree> — run in parallel from the current worktree: the extraction tests for touched languages (git diff --name-only), rosetta_audit.py --allow-regressions, crucible_check.py, then bless_scope.py on the pre/post fixtures, audit_check.py; print a PR-body block with the four standard sections (Measured / Corpus / Golden masters / Tests) filled from the tools' own output.
  • tests/tools/worktree_env.sh <name> [--corpus] — fetch; create or checkout --detach origin/main the engine worktree at ~/nyx_projects/gitgalaxy-worktrees/<name> (and the corpus twin); refuse inside the primary checkout; print the five exports (PYTHONPATH GITGALAXY_PATH GALAXYSCOPE_BIN LANGUAGE_CRUCIBLE_PATH KEYWORD_ROSETTA_PATH) as copy-paste lines. Every environment trap of the Epic: risk_documentation becomes a per-unit coverage ratio (Phase 4 score contract; child of #2812) #2908 session (wrong-path worktree, background job from a drifted cwd, stale corpus worktree producing a phantom mismatch) is this script not existing.
  • .claude/agents/contract-audit-scout.md — the environment section names /srv/storage_16tb/projects/gitgalaxy/v6/.venv; on this machine the venv is ~/nyx_projects/gitgalaxy/.venv (full precision: .crucible_venvs/full_precision). Fix, and add the three tools above to its job list.
  • .claude/skills/score-contract-audit/SKILL.md + docs/_score_contract_template.md — the score-layer twin of rule-contract-audit: same tier table and never-delegate list; phases = Epic: risk_documentation becomes a per-unit coverage ratio (Phase 4 score contract; child of #2812) #2908's with exact commands; the D-decision and acceptance-table templates; the contract-doc sections from docs/risk_documentation_contract.md.
  • tests/tools/bless_scope.py --from-head — take the pre-bless fixture from git show HEAD: itself so the recipe is one command, and add --summary (files × leaf keys, one line each) for the PR body.

Child of #2908 (and of #2812 Phase 4, whose commensurability audit these feed).

Activity

  1. added
    metricsHeuristics, risk exposures, and topological math updates
    refactorStructural cleanup or optimization without altering behavior
    testingUnit, integration, and E2E pipeline verification
    on Sep 9, 2026
  2. added a commit that references this issue on Sep 9, 2026
    fba51ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    metricsHeuristics, risk exposures, and topological math updatesrefactorStructural cleanup or optimization without altering behaviortestingUnit, integration, and E2E pipeline verification

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions