Skip to main content
Glama

rescore --gate verdict for an edited file

check_gate
Read-onlyIdempotent

Checks an edited source file's changed functions against complexity ceilings and ratchet marks, flagging a gate breach that predicts a verify refusal. Runs no tests.

Instructions

Checks an edited file by rescore --gate's rule: each changed function's ccn against its scope's ceiling, pardoned only while its crap is at or under its ratchet mark. The hook's commit gate pardons any marked function, so this is stricter and a breach predicts a verify refusal. Call it after an edit once get_function_brief states the rule. It runs no tests, and a breach reads gate.ok false, not an error. Marks are read only on a breach, so a clean gate skips a broken marks file. A tracked file is judged on its diff from HEAD, an untracked one in full.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesrepo-relative, or absolute inside repo, source file to judge as edited. Outside the repo, missing or a directory answers a config error, and an unchanged or unscoped file judges 0. A file a scope takes whose name is not UTF-8 answers gate.ok false with the name in gate.unread_files. repo may be any directory under the checkout, and path stays relative to the root it walks up to.
repoNopath to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
gateNothe verdict block
noteNofixed reminder that coverage is the baseline run's and complexity the working tree's; crapkit verify gives the real verdict
schemaNopayload schema version, 1
functionsNoevery function in the file, rescored
truncatedNopresent only when the whole answer was longer than one tool result the server sends (7,500 characters): each list, string or object field it cut, at any depth, keeps its start, and full is the CLI command that prints the whole answer
baseline_runNoid of the run whose coverage was reused
baseline_commitNothat run's commit, full sha

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed12 schema fields changedv0.8.1
    • changedInput schema / properties / path / description
      Previous value: -"repo-relative, or absolute inside repo, source file to judge as edited. Outside the repo or missing answers a config error, and an unchanged or unscoped file judges 0. repo may be any directory under the checkout, and path stays relative to the root it walks up to."New value: +"repo-relative, or absolute inside repo, source file to judge as edited. Outside the repo, missing or a directory answers a config error, and an unchanged or unscoped file judges 0. A file a scope takes whose name is not UTF-8 answers gate.ok false with the name in gate.unread_files. repo may be any directory under the checkout, and path stays relative to the root it walks up to."
    • changedInput schema / properties / repo / description
      Previous value: -"path to the scored repo's root (default: the repo the server was started in)"New value: +"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory"
    • changedOutput schema / properties / functions / items / properties / cov / description
      Previous value: -"branch coverage from the baseline run, 0.0 to 1.0"New value: +"from the baseline run: branch coverage inside the span, 0.0 to 1.0; statement coverage when the span has no branches, and invoked-or-not (1.0 or 0.0) when it has no statements; Python and/or add to ccn but coverage.py records no branch arc for them; 0.0 on an untested, excluded, no-lane or cc-only row"
    • changedOutput schema / properties / functions / items / properties / crap / description
      Previous value: -"score from fresh ccn and baseline cov"New value: +"score from fresh ccn and baseline cov: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row"
    • changedOutput schema / properties / functions / items / properties / flag / description
      Previous value: -"measured, untested, no-lane or cc-only: whether a lane artifact could measure this span"New value: +"measured, untested, excluded, no-lane or cc-only: whether a lane artifact could measure this span"
    • changedOutput schema / properties / functions / items / properties / flag / enum
      Previous value: -[
      -  "measured",
      -  "untested",
      -  "no-lane",
      -  "cc-only"
      -]New value: +[
      +  "measured",
      +  "untested",
      +  "excluded",
      +  "no-lane",
      +  "cc-only"
      +]
    • addedOutput schema / properties / functions / items / properties / unmeasured
      Added value: +{
      +  "description": "true when no measurement stands behind cov: the baseline run holds no row this function joins by name (it was added or renamed since), or its scope has no lane or asks for none. cov 0.0 is then a stand-in",
      +  "type": "boolean"
      +}
    • changedOutput schema / properties / gate / properties / breaches / items / properties / cov / description
      Previous value: -"baseline coverage"New value: +"from the baseline run: branch coverage inside the span, 0.0 to 1.0; statement coverage when the span has no branches, and invoked-or-not (1.0 or 0.0) when it has no statements; Python and/or add to ccn but coverage.py records no branch arc for them; 0.0 on an untested, excluded, no-lane or cc-only row"
    • changedOutput schema / properties / gate / properties / breaches / items / properties / crap / description
      Previous value: -"score"New value: +"score: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row"
    • changedOutput schema / properties / gate / properties / ok / description
      Previous value: -"true when breaches is empty; false is the verdict (CLI exit 6), delivered as a normal result"New value: +"true when breaches and unread_files are empty; false is the verdict (CLI exit 6, or 3 when a file's name is not UTF-8), delivered as a normal result"
    • addedOutput schema / properties / gate / properties / unread_files
      Added value: +{
      +  "description": "changed files no reader could read, so none of their functions was judged; any entry fails the gate (exit 6, or for a file whose name is not UTF-8 the exit-3 refusal, which check_gate answers as this verdict)",
      +  "items": {
      +    "description": "one changed file the gate refused unread",
      +    "properties": {
      +      "dirty": {
      +        "description": "always true here: the gate judges the working tree's changes since HEAD",
      +        "type": "boolean"
      +      },
      +      "path": {
      +        "description": "repo-relative path of the file, each byte that is not UTF-8 spelled \\xNN",
      +        "type": "string"
      +      },
      +      "reason": {
      +        "description": "the reader's refusal, naming the line and what to change",
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / truncated
      Added value: +{
      +  "description": "present only when the whole answer was longer than one tool result the server sends (7,500 characters): each list, string or object field it cut, at any depth, keeps its start, and full is the CLI command that prints the whole answer",
      +  "properties": {
      +    "fields": {
      +      "additionalProperties": {
      +        "properties": {
      +          "kept": {
      +            "description": "how many the answer keeps",
      +            "type": "integer"
      +          },
      +          "of": {
      +            "description": "how many the whole answer has",
      +            "type": "integer"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "description": "each cut field, named by its keys joined with dots (gate.breaches) -> kept and of: elements for a list, entries for an object, characters for a string",
      +      "type": "object"
      +    },
      +    "full": {
      +      "description": "the crapkit command that prints the whole answer, spelled for the server's shell",
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  2. Changed7 schema fields changedv0.8.0
    • changedInput schema / properties / path / description
      Previous value: -"repo-relative source file to judge as edited"New value: +"repo-relative, or absolute inside repo, source file to judge as edited. Outside the repo or missing answers a config error, and an unchanged or unscoped file judges 0. repo may be any directory under the checkout, and path stays relative to the root it walks up to."
    • addedOutput schema / properties / functions / items / properties / occurrence
      Added value: +{
      +  "description": "source creation order among functions sharing start, from 1; 0 on an older row with no recorded position",
      +  "type": "integer"
      +}
    • changedOutput schema / properties / functions / items / properties / remedy / description
      Previous value: -"decompose (ccn over ceiling), split-lines (another function shares its source lines, so coverage cannot tell them apart and no test lowers the score until the definitions sit on separate lines), add-tests (coverage short) or ok (nothing left to do)"New value: +"decompose (ccn over ceiling), split-lines (another function shares its source lines, or a Python def's body starts on the line its signature ends, where coverage.py reads it as the def statement, so coverage cannot tell them apart and no test lowers the score until they sit on separate lines), add-tests (coverage short) or ok (nothing left to do)"
    • changedOutput schema / properties / gate / properties / breaches / items / description
      Previous value: -"one judged function over its ceiling that no ratchet mark covers"New value: +"one judged function over its ceiling, unmarked or with its crap past its ratchet mark"
    • changedOutput schema / properties / gate / properties / breaches / items / properties / remedy / description
      Previous value: -"decompose (ccn over ceiling), split-lines (another function shares its source lines, so coverage cannot tell them apart and no test lowers the score until the definitions sit on separate lines), add-tests (coverage short) or ok (nothing left to do)"New value: +"decompose (ccn over ceiling), split-lines (another function shares its source lines, or a Python def's body starts on the line its signature ends, where coverage.py reads it as the def statement, so coverage cannot tell them apart and no test lowers the score until they sit on separate lines), add-tests (coverage short) or ok (nothing left to do)"
    • addedOutput schema / properties / gate / properties / ceilings / additionalProperties
      Added value: +{
      +  "type": "integer"
      +}
    • changedOutput schema / properties / gate / properties / ceilings / description
      Previous value: -"map of path to the ccn ceiling it was judged against"New value: +"map of repo-relative path to the ccn ceiling it was judged against"
  3. Changed4 schema fields changedv0.7.6
    • changedOutput schema / properties / functions / items / properties / remedy / description
      Previous value: -"decompose (ccn over ceiling), add-tests (coverage short) or ok (nothing left to do)"New value: +"decompose (ccn over ceiling), split-lines (another function shares its source lines, so coverage cannot tell them apart and no test lowers the score until the definitions sit on separate lines), add-tests (coverage short) or ok (nothing left to do)"
    • changedOutput schema / properties / functions / items / properties / remedy / enum
      Previous value: -[
      -  "decompose",
      -  "add-tests",
      -  "ok"
      -]New value: +[
      +  "decompose",
      +  "split-lines",
      +  "add-tests",
      +  "ok"
      +]
    • changedOutput schema / properties / gate / properties / breaches / items / properties / remedy / description
      Previous value: -"decompose (ccn over ceiling), add-tests (coverage short) or ok (nothing left to do)"New value: +"decompose (ccn over ceiling), split-lines (another function shares its source lines, so coverage cannot tell them apart and no test lowers the score until the definitions sit on separate lines), add-tests (coverage short) or ok (nothing left to do)"
    • changedOutput schema / properties / gate / properties / breaches / items / properties / remedy / enum
      Previous value: -[
      -  "decompose",
      -  "add-tests",
      -  "ok"
      -]New value: +[
      +  "decompose",
      +  "split-lines",
      +  "add-tests",
      +  "ok"
      +]
  4. Addedv0.6.0

TDQS

A4.4/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive, yet the description adds substantial behavioural context: it runs no tests, a breach returns gate.ok false rather than an error, marks are only read on a breach (so a clean gate tolerates a broken marks file), and tracked files are judged on their diff from HEAD while untracked files are judged in full. That is exactly the kind of non-obvious behaviour annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The governing rule and judging semantics are front-loaded, and every sentence carries information the agent cannot get from schema or annotations. Style is dense and jargon-heavy (ccn, crap, ratchet mark), which costs a little readability but not correctness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a non-trivial static-analysis gate with an output schema present, the description covers the rule, the trigger, the failure signal (gate.ok false), diff-vs-full-file judging, and known edge cases. Return-value shape is rightly left to the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and both parameters carry rich in-schema documentation (path semantics, edge cases, unread_files, repo default). The description itself adds no parameter-level detail, so this is the baseline 3 where the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence gives a precise verb and resource (checks an edited file) plus the exact rule it applies: changed-function ccn vs. scope ceiling, pardoned only while crap is under the ratchet mark. It also contrasts this with the hook's commit gate. It does not name or contrast any actual sibling tool (e.g., get_ratchet_report), so sibling differentiation is implied rather than stated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Call it after an edit once get_function_brief states the rule" gives an explicit trigger and a named prerequisite. It further characterises the alternative (the hook's commit gate is laxer, so a breach here predicts a verify refusal), telling the agent when this tool is the right choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.