{"at":"2026-11-23T00:38:54.712Z","dir":"sent","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"didrun-lab","version":"0.1.0"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T00:38:55.037Z","dir":"received","era":"server_discover","message":{"error":{"code":-32601,"message":"unknown method 'server/discover'"},"id":1,"jsonrpc":"2.0"}}
{"at":"2026-11-23T00:38:55.137Z","dir":"sent","era":"initialize","message":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"didrun-lab","version":"0.1.0"},"protocolVersion":"2025-11-25"}}}
{"at":"2026-11-23T00:38:55.435Z","dir":"received","era":"initialize","message":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"tools":{}},"instructions":"crapkit scores every function as ccn^2 x (1 - coverage)^3 + ccn; these twelve tools read scores and source without running test suites or editing source files. Calls can write caches, initialize or migrate the snapshot store, and fill rollups. get_next_item takes no claim; check_gate runs rescore and records no verification run. Every tool needs crapkit init. check_config, get_ratchet_report and list_coupled_files need no run, get_next_item, get_function_brief and check_gate need a coverage run, and the other six need a snapshot store, which crapkit inventory or crapkit coverage makes. A tool called before what it needs answers with a one-line pointer instead of data. Start with get_next_item for one function to fix, list_worklist for the whole ranking, get_function_brief for everything about one function, and check_gate after an edit to learn whether the file clears rescore --gate, which is stricter than the commit hook.","protocolVersion":"2025-06-18","serverInfo":{"name":"crapkit","version":"0.8.1"}}}}
{"at":"2026-11-23T00:38:55.435Z","dir":"sent","era":"initialize","message":{"jsonrpc":"2.0","method":"notifications/initialized"}}
{"at":"2026-11-23T00:38:55.435Z","dir":"sent","era":"initialize","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}}}
{"at":"2026-11-23T00:38:55.436Z","dir":"received","era":"initialize","message":{"id":2,"jsonrpc":"2.0","result":{"tools":[{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Returns the next function to fix as a work packet, the newest trusted run's worst row by crap. Use it to start a fix, list_worklist to survey the same run by risk, and get_function_brief once a function is chosen. It runs no tests, and empty true means the queue is spent, not the work, so read reasons. Filters cut before top counts: top 3 with exclude [\"tests/\"] returns the three worst rows outside tests, and an unknown scope name is a config error.","inputSchema":{"properties":{"exclude":{"description":"skip rows whose path or long function name contains any of these fragments (one --exclude each)","items":{"type":"string"},"type":"array"},"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"},"scope":{"description":"restrict the ranking to these declared scopes (exact [[scope]] names from crapkit.toml, one --scope each)","items":{"type":"string"},"type":"array"},"top":{"description":"return the next N packets as items instead of one item (N >= 1, default 1)","type":"integer"}},"type":"object"},"name":"get_next_item","outputSchema":{"properties":{"commands":{"description":"the call that answers stale and scored_changes; run it as given","properties":{"refresh":{"description":"crapkit coverage --reuse-unchanged: the cheapest run that brings scored_changes to 0 and clears stale","type":"string"}},"type":"object"},"commit":{"description":"that run's commit, full sha","type":"string"},"empty":{"description":"true when the queue has nothing to hand out; then reasons is present and item and items are absent","type":"boolean"},"item":{"description":"the one packet, present when empty is false and top is absent or 1","properties":{"authors":{"description":"distinct authors of those commits","type":"integer"},"ccn":{"description":"min(ccn_std, ccn_mod): the complexity the gate and the ratchet judge","type":"integer"},"ccn_std":{"description":"standard cyclomatic complexity","type":"integer"},"cognitive":{"description":"Sonar-spec cognitive complexity, reporting only, never gated","type":"integer"},"commits":{"description":"commits touching the file in the churn window","type":"integer"},"cov":{"description":"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","type":"number"},"crap":{"description":"the score: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row","type":"number"},"end":{"description":"last line, 1-based inclusive","type":"integer"},"est_splits":{"description":"0 when ccn <= target, else ceil(ccn / target): roughly how many functions this must become","type":"integer"},"est_uncovered_paths":{"description":"(1 - cov) x ccn rounded half to even, so 2.5 reads 2: decision paths no test walks","type":"integer"},"flag":{"description":"measured, untested, excluded, no-lane or cc-only: whether a lane artifact could measure this span","enum":["measured","untested","excluded","no-lane","cc-only"],"type":"string"},"function":{"description":"lizard long name with the spaced parameter list; get_function_brief and get_function_history accept it as name","type":"string"},"handle":{"description":"short name form: the bare identifier, or (anonymous)#N for a function lizard could not name; it names a position, not a line, so it survives the edit this item asks for; pass it back as name","type":"string"},"nesting":{"description":"maximum nesting depth","type":"integer"},"nloc":{"description":"non-comment lines of code","type":"integer"},"occurrence":{"description":"source creation order among functions sharing start, from 1; 0 on an older row with no recorded position","type":"integer"},"path":{"description":"repo-relative source path, forward slashes","type":"string"},"remedy":{"description":"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)","enum":["decompose","split-lines","add-tests","ok"],"type":"string"},"scope":{"description":"the declared scope that owns the file","type":"string"},"start":{"description":"first line, 1-based inclusive","type":"integer"},"target":{"description":"this scope's effective ceiling: the highest CRAP a function may carry, and so also the highest ccn","type":"integer"},"uncovered_lines":{"description":"line numbers no test ran; [] when the span is fully covered; null when no artifact could answer, then uncovered_lines_note says why","items":{"type":"integer"},"type":["array","null"]},"uncovered_lines_note":{"description":"present only when uncovered_lines is null: the reason and the move (stale artifact, no test imports the file, coverage_optional scope)","type":"string"},"unmeasured":{"description":"true when no measurement stands behind cov: flag no-lane (no lane covers the scope) or cc-only (the scope asks for no coverage). cov 0.0 and est_uncovered_paths are then stand-ins, not a count of paths no test walks","type":"boolean"}},"type":"object"},"items":{"description":"up to top packets in crap-descending order, present when empty is false and top is above 1","items":{"description":"a packet, same shape as item","properties":{"authors":{"description":"distinct authors of those commits","type":"integer"},"ccn":{"description":"min(ccn_std, ccn_mod): the complexity the gate and the ratchet judge","type":"integer"},"ccn_std":{"description":"standard cyclomatic complexity","type":"integer"},"cognitive":{"description":"Sonar-spec cognitive complexity, reporting only, never gated","type":"integer"},"commits":{"description":"commits touching the file in the churn window","type":"integer"},"cov":{"description":"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","type":"number"},"crap":{"description":"the score: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row","type":"number"},"end":{"description":"last line, 1-based inclusive","type":"integer"},"est_splits":{"description":"0 when ccn <= target, else ceil(ccn / target): roughly how many functions this must become","type":"integer"},"est_uncovered_paths":{"description":"(1 - cov) x ccn rounded half to even, so 2.5 reads 2: decision paths no test walks","type":"integer"},"flag":{"description":"measured, untested, excluded, no-lane or cc-only: whether a lane artifact could measure this span","enum":["measured","untested","excluded","no-lane","cc-only"],"type":"string"},"function":{"description":"lizard long name with the spaced parameter list; get_function_brief and get_function_history accept it as name","type":"string"},"handle":{"description":"short name form: the bare identifier, or (anonymous)#N for a function lizard could not name; it names a position, not a line, so it survives the edit this item asks for; pass it back as name","type":"string"},"nesting":{"description":"maximum nesting depth","type":"integer"},"nloc":{"description":"non-comment lines of code","type":"integer"},"occurrence":{"description":"source creation order among functions sharing start, from 1; 0 on an older row with no recorded position","type":"integer"},"path":{"description":"repo-relative source path, forward slashes","type":"string"},"remedy":{"description":"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)","enum":["decompose","split-lines","add-tests","ok"],"type":"string"},"scope":{"description":"the declared scope that owns the file","type":"string"},"start":{"description":"first line, 1-based inclusive","type":"integer"},"target":{"description":"this scope's effective ceiling: the highest CRAP a function may carry, and so also the highest ccn","type":"integer"},"uncovered_lines":{"description":"line numbers no test ran; [] when the span is fully covered; null when no artifact could answer, then uncovered_lines_note says why","items":{"type":"integer"},"type":["array","null"]},"uncovered_lines_note":{"description":"present only when uncovered_lines is null: the reason and the move (stale artifact, no test imports the file, coverage_optional scope)","type":"string"},"unmeasured":{"description":"true when no measurement stands behind cov: flag no-lane (no lane covers the scope) or cc-only (the scope asks for no coverage). cov 0.0 and est_uncovered_paths are then stand-ins, not a count of paths no test walks","type":"boolean"}},"type":"object"},"type":"array"},"reasons":{"description":"why the queue is empty, present only when empty is true; the stop condition is empty true with skipped_claimed and no_lane_over_target both 0 or absent and scored_changes 0","properties":{"all_remaining_at_or_under_target":{"description":"present only when candidates remained but every one has remedy ok: the queue is finished","type":"integer"},"below_floor":{"description":"rows under worklist_floor, every one at or under its ceiling","type":"integer"},"churn_window_months":{"description":"the window those counts used, echoed back","type":"integer"},"excluded_by_flag":{"description":"rows an exclude fragment matched","type":"integer"},"no_churn_in_window":{"description":"rows in files with no commits in the churn window","type":"integer"},"no_lane":{"description":"rows above the floor whose scope no lane covers","type":"integer"},"no_lane_over_target":{"description":"the subset of no_lane rows over their ceiling: debt the queue may not rank; non-zero means work remains","type":"integer"}},"type":"object"},"run_id":{"description":"id of the run these numbers come from: the newest trusted run (a coverage run, or a verify run whose verdict passed)","type":"integer"},"schema":{"description":"payload schema version, 1","type":"integer"},"scored_changes":{"description":"how many files the run scored hold other content now than the run recorded, deleted files included; 0 means the numbers describe the files on disk; null when crapkit cannot compare: the run recorded no content (crapkit 0.8.0 or older wrote it) or git failed reading the tree; treat null like any count above 0 and run commands.refresh","type":["integer","null"]},"shallow":{"description":"true when this checkout is a shallow clone: commits, authors and the churn the ranking reads count only the commits the clone holds; set fetch-depth: 0 on the checkout or run git fetch --unshallow for the real counts","type":"boolean"},"skipped_claimed":{"description":"rows another session's claim hid; present only when non-zero, and list_claims names the holders","type":"integer"},"skipped_no_lane":{"description":"rows above the floor that no lane measures, kept out of the ranking because their cov 0 is a tooling gap, not a testing gap","type":"integer"},"stale":{"description":"true when the run's commit is not HEAD. It judges the commit, not the files: an amend or a commit that touched no scored file sets it, and an uncommitted edit leaves it false; scored_changes counts the files whose content moved. Schema 2 redefines it as that content difference","type":"boolean"},"truncated":{"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"}},"type":"object"},"title":"Next function to fix"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Lists the newest trusted run's whole risk ranking, every admitted function ordered by ccn times recency-weighted churn. Use it to survey a repo or split work, and get_next_item for the one packet to fix now. It runs no tests and keeps finished rows, so it never empties. Churn is cached per HEAD: after a commit, or on first use, the next read walks git log. git ls-files and git status count changed scored files (scored_changes). scope narrows before top caps, and an unknown scope is a config error. repo may be any directory under the measured checkout.","inputSchema":{"properties":{"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"},"scope":{"description":"restrict the ranking to these declared scopes (exact [[scope]] names from crapkit.toml, one --scope each)","items":{"type":"string"},"type":"array"},"top":{"description":"cap the active list (default: the config's worklist_top, 50)","type":"integer"}},"type":"object"},"name":"list_worklist","outputSchema":{"properties":{"active":{"description":"the ranking: functions in files with churn in the window, risk descending, cut at top or worklist_top","items":{"description":"one ranked function","properties":{"authors":{"description":"distinct authors of those commits","type":"integer"},"ccn":{"description":"min(ccn_std, ccn_mod): what the gate judges","type":"integer"},"ccn_std":{"description":"standard cyclomatic complexity","type":"integer"},"commits":{"description":"commits touching the file in the churn window","type":"integer"},"cov":{"description":"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; null on an inventory-only run","type":["number","null"]},"crap":{"description":"the score from the ranked run, ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row; null on an inventory-only run","type":["number","null"]},"end":{"description":"last line, inclusive","type":"integer"},"flag":{"description":"measured, untested, excluded, no-lane or cc-only; null on an inventory-only run","enum":["measured","untested","excluded","no-lane","cc-only",null],"type":["string","null"]},"function":{"description":"lizard long name with the spaced parameter list; pass it to get_function_brief as name","type":"string"},"handle":{"description":"short name form: the bare identifier, or (anonymous)#N for a function lizard could not name; pass it to get_function_brief as name","type":"string"},"nloc":{"description":"non-comment lines of code","type":"integer"},"occurrence":{"description":"source creation order among functions sharing start, from 1; 0 on an older row with no recorded position","type":"integer"},"path":{"description":"repo-relative source path, forward slashes","type":"string"},"ratchet_mark":{"description":"the committed ratchet mark on this function, read under its own ratchet key; null when it carries none or the repo has no marks file","type":["number","null"]},"remedy":{"description":"decompose, split-lines, add-tests or ok, as the run judged it; null on an inventory-only run. A row a lane measures reaches get_next_item unless its remedy is ok. After a crapkit.toml ceiling edit no run has scored, get_next_item's own remedy decides that, and it can differ from this one","enum":["decompose","split-lines","add-tests","ok",null],"type":["string","null"]},"risk":{"description":"ccn x weight, four decimals: the sort key","type":"number"},"scope":{"description":"the declared scope that owns the file","type":"string"},"start":{"description":"first line, 1-based","type":"integer"},"weight":{"description":"recency-weighted churn of the file; 1.0 on every file when commits share one timestamp","type":"number"}},"type":"object"},"type":"array"},"active_total":{"description":"active rows admitted before the cap: what top or worklist_top hid","type":"integer"},"churn_window_months":{"description":"months of git history the churn weights cover, counted back from the commit date of HEAD","type":"integer"},"commands":{"description":"the call that answers stale and scored_changes; run it as given","properties":{"refresh":{"description":"crapkit coverage --reuse-unchanged: the cheapest run that brings scored_changes to 0 and clears stale","type":"string"}},"type":"object"},"commit":{"description":"that run's commit, full sha","type":"string"},"dormant_count":{"description":"ranked functions whose file had no commits in the window","type":"integer"},"dormant_top":{"description":"the first 10 dormant functions, same shape as active: sleeping hazards kept out of the queue","items":{"description":"one ranked function","properties":{"authors":{"description":"distinct authors of those commits","type":"integer"},"ccn":{"description":"min(ccn_std, ccn_mod): what the gate judges","type":"integer"},"ccn_std":{"description":"standard cyclomatic complexity","type":"integer"},"commits":{"description":"commits touching the file in the churn window","type":"integer"},"cov":{"description":"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; null on an inventory-only run","type":["number","null"]},"crap":{"description":"the score from the ranked run, ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row; null on an inventory-only run","type":["number","null"]},"end":{"description":"last line, inclusive","type":"integer"},"flag":{"description":"measured, untested, excluded, no-lane or cc-only; null on an inventory-only run","enum":["measured","untested","excluded","no-lane","cc-only",null],"type":["string","null"]},"function":{"description":"lizard long name with the spaced parameter list; pass it to get_function_brief as name","type":"string"},"handle":{"description":"short name form: the bare identifier, or (anonymous)#N for a function lizard could not name; pass it to get_function_brief as name","type":"string"},"nloc":{"description":"non-comment lines of code","type":"integer"},"occurrence":{"description":"source creation order among functions sharing start, from 1; 0 on an older row with no recorded position","type":"integer"},"path":{"description":"repo-relative source path, forward slashes","type":"string"},"ratchet_mark":{"description":"the committed ratchet mark on this function, read under its own ratchet key; null when it carries none or the repo has no marks file","type":["number","null"]},"remedy":{"description":"decompose, split-lines, add-tests or ok, as the run judged it; null on an inventory-only run. A row a lane measures reaches get_next_item unless its remedy is ok. After a crapkit.toml ceiling edit no run has scored, get_next_item's own remedy decides that, and it can differ from this one","enum":["decompose","split-lines","add-tests","ok",null],"type":["string","null"]},"risk":{"description":"ccn x weight, four decimals: the sort key","type":"number"},"scope":{"description":"the declared scope that owns the file","type":"string"},"start":{"description":"first line, 1-based","type":"integer"},"weight":{"description":"recency-weighted churn of the file; 1.0 on every file when commits share one timestamp","type":"number"}},"type":"object"},"type":"array"},"floor":{"description":"the effective worklist_floor: rows under this ccn are listed only when over their ceiling or in a hot file","type":"integer"},"run_id":{"description":"id of the run these numbers come from: the newest trusted run (a coverage run, or a verify run whose verdict passed)","type":"integer"},"schema":{"description":"payload schema version, 1","type":"integer"},"scored_changes":{"description":"how many files the run scored hold other content now than the run recorded, deleted files included; 0 means the numbers describe the files on disk; null when crapkit cannot compare: the run recorded no content (crapkit 0.8.0 or older wrote it) or git failed reading the tree; treat null like any count above 0 and run commands.refresh","type":["integer","null"]},"shallow":{"description":"true when this checkout is a shallow clone: commits, authors and the churn the ranking reads count only the commits the clone holds; set fetch-depth: 0 on the checkout or run git fetch --unshallow for the real counts","type":"boolean"},"stale":{"description":"true when the run's commit is not HEAD. It judges the commit, not the files: an amend or a commit that touched no scored file sets it, and an uncommitted edit leaves it false; scored_changes counts the files whose content moved. Schema 2 redefines it as that content difference","type":"boolean"},"truncated":{"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"}},"type":"object"},"title":"Risk ranking of every function"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Lists every run in the store, oldest first by id. Use it to see which commit the other tools answer from, get_trend for totals and get_function_history for one function. Marking the baseline run costs one git ancestry check per trusted run's commit, newest first, down to it: one when it is the newest, on any branch, none with no trusted run. repo may be any directory under the checkout, and a relative path resolves from the server's start directory. With no crapkit.toml above it, or no snapshot store yet, it answers isError true with the command to run.","inputSchema":{"properties":{"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"type":"object"},"name":"list_runs","outputSchema":{"properties":{"runs":{"description":"every run in the store, oldest first","items":{"description":"one run","properties":{"baseline":{"description":"true on the one run verify compares against today, not always the newest candidate","type":"boolean"},"commit":{"description":"the commit the run measured, full sha","type":"string"},"created_at":{"description":"UTC timestamp, ISO 8601","type":"string"},"findings":{"description":"findings a verify run recorded, 0 otherwise","type":"integer"},"id":{"description":"run id, the run_id other payloads cite","type":"integer"},"kind":{"description":"inventory, coverage, partial, verify, hook or legacy; only coverage, legacy and passing verify runs can be trusted baselines","enum":["inventory","coverage","partial","verify","hook","legacy"],"type":"string"},"lanes":{"description":"names of the lanes that ran; empty on an inventory run","items":{"type":"string"},"type":"array"},"verdict_ok":{"description":"the verify verdict; null on every kind that renders none","type":["boolean","null"]}},"type":"object"},"type":"array"},"schema":{"description":"payload schema version, 1","type":"integer"},"truncated":{"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"}},"type":"object"},"title":"Scored run history"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Returns per-run totals for every trusted run, oldest first, with a grade per scope. Use it for the whole repo's trajectory. Use get_function_history for one function and get_ratchet_report for marked debt. It runs no lane and spawns no git. The first call on a large store sums every run into a rollup cache and takes seconds. Later calls read the cache back. repo may be any directory under a checkout where crapkit init and crapkit coverage have run. One with no snapshot store yet answers isError true with the setup pointer.","inputSchema":{"properties":{"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"type":"object"},"name":"get_trend","outputSchema":{"properties":{"runs":{"description":"one row per trusted run, oldest first","items":{"description":"one run's totals","properties":{"avg":{"description":"mean crap per function, four decimals","type":"number"},"by_scope":{"additionalProperties":{"description":"one scope's totals","properties":{"crap_load":{"description":"exact sum of crap over the scope (math.fsum), two decimals","type":"number"},"functions":{"description":"functions scored in the scope","type":"integer"},"grade":{"description":"A+ at zero over_target, then A under 2% over, B under 5%, C under 10%, D under 20%, else F","enum":["A+","A","B","C","D","F"],"type":"string"},"over_target":{"description":"of those, over the scope's ceiling","type":"integer"}},"type":"object"},"description":"scope name to that scope's totals and grade","type":"object"},"commit":{"description":"the run's commit, full sha","type":"string"},"crap_load":{"description":"exact sum of every function's crap (math.fsum), two decimals","type":"number"},"created_at":{"description":"UTC timestamp, ISO 8601","type":"string"},"functions":{"description":"functions scored","type":"integer"},"over_target":{"description":"functions over their scope's ceiling","type":"integer"},"run_id":{"description":"run id","type":"integer"}},"type":"object"},"type":"array"},"schema":{"description":"payload schema version, 1","type":"integer"},"target":{"description":"the [crapkit] target: the default ceiling, the highest CRAP a function may carry, and so also the highest ccn, that every scope inherits unless it sets its own","type":"integer"},"truncated":{"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"}},"type":"object"},"title":"Debt trend per run"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Returns one function's start-editing packet from the newest trusted run: scored row, uncovered lines and the refresh, test, gate and verify command lines, none of them run. Use it once a function is chosen. Skip it for picking what to fix, that is get_next_item, and for a score across runs, get_function_history. Twins come from the run's stored index, whose first build takes seconds. name must live in path. A miss is a tool error (isError true, the exit-1 error object) whose message lists the file's functions.","inputSchema":{"properties":{"name":{"description":"the long_name get_next_item printed (classify( score , late )), the bare identifier (classify, or route for a Rust `route cmd : & Cmd`), a fragment of either, the line the function starts on, or a handle such as NAME#2 for a twin or (anonymous)#2; exact match first","type":"string"},"path":{"description":"source file, repo-relative or absolute inside the repo; a backslash separates folders on Windows only","type":"string"},"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"required":["path","name"],"type":"object"},"name":"get_function_brief","outputSchema":{"properties":{"attempts":{"description":"every claim ever taken on this function, oldest first; [] on a first attempt, and a row with closed null is a claim still open","items":{"description":"one claim","properties":{"closed":{"description":"UTC timestamp it was released, null while open","type":["string","null"]},"opened":{"description":"UTC timestamp the claim was taken","type":"string"}},"type":"object"},"type":"array"},"churn":{"description":"the file's churn, or null when it had no commits in the window","properties":{"authors":{"description":"distinct authors","type":"integer"},"commits":{"description":"commits touching the file in the window","type":"integer"},"weight":{"description":"recency-weighted churn","type":"number"}},"type":["object","null"]},"commands":{"description":"the rest of the loop as whole command lines for this file and scope; run them as given","properties":{"gate":{"description":"the crapkit rescore PATH --gate call for this file: what check_gate runs","type":"string"},"refresh":{"description":"crapkit coverage --reuse-unchanged: the cheapest run that brings scored_changes to 0 and clears stale","type":"string"},"refresh_writes_run":{"description":"always true: refresh writes a coverage run to the store; other commands can also write caches or test artifacts","type":"boolean"},"scoped_tests":{"description":"the crapkit test-scoped call for this literal file, or null when the scope declares no [crapkit.scoped_tests] template","type":["string","null"]},"scoped_tests_note":{"description":"present only when scoped_tests is null: names the scope missing a template","type":"string"},"verify":{"description":"the crapkit verify call: the only authoritative verdict","type":"string"}},"type":"object"},"commit":{"description":"that run's commit, full sha","type":"string"},"coupling":{"description":"up to 5 change-coupling partners at support 5 and confidence 0.5, strongest first; empty when none qualify; list_coupled_files has the repo-wide list","items":{"description":"a change-coupling partner","properties":{"confidence":{"description":"the larger of support / commits(a) and support / commits(b), 0 to 1","type":"number"},"is_test":{"description":"true when the partner is a test file: outside the scored corpus, still the file the edit breaks","type":"boolean"},"path":{"description":"the coupled file","type":"string"},"support":{"description":"commits in which both files changed","type":"integer"}},"type":"object"},"type":"array"},"duplication_twins":{"description":"up to 10 near-duplicate functions at similarity 0.8, best first; empty is normal; list_duplicate_functions has the repo-wide pairs","items":{"description":"a near-duplicate function","properties":{"contained":{"description":"true when the twin and this function nest in one file, one defined inside the other","type":"boolean"},"end":{"description":"last line","type":"integer"},"long_name":{"description":"the twin's long name","type":"string"},"nloc":{"description":"non-comment lines","type":"integer"},"path":{"description":"repo-relative path of the twin","type":"string"},"similarity":{"description":"shared shingles over the smaller function's, 0 to 1","type":"number"},"start":{"description":"first line","type":"integer"}},"type":"object"},"type":"array"},"est_splits":{"description":"0 when ccn <= target, else ceil(ccn / target)","type":"integer"},"est_uncovered_paths":{"description":"(1 - cov) x ccn rounded half to even, so 2.5 reads 2","type":"integer"},"file_functions":{"description":"every scored function in the same file: where an extracted helper lands, and which names are taken","items":{"description":"one scored function","properties":{"ccn":{"description":"complexity","type":"integer"},"crap":{"description":"score: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row","type":"number"},"end":{"description":"last line","type":"integer"},"function":{"description":"long name","type":"string"},"occurrence":{"description":"source creation order among functions sharing start, from 1; 0 on an older row with no recorded position","type":"integer"},"remedy":{"description":"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)","enum":["decompose","split-lines","add-tests","ok"],"type":"string"},"start":{"description":"first line","type":"integer"}},"type":"object"},"type":"array"},"file_totals":{"description":"the file rolled up","properties":{"crap_load":{"description":"exact sum of crap over the file (math.fsum), two decimals","type":"number"},"functions":{"description":"scored functions in the file","type":"integer"},"over_target":{"description":"of those, over their own scope's ceiling","type":"integer"}},"type":"object"},"function":{"description":"the resolved lizard long name, whichever name form was asked with","type":"string"},"gate_rule":{"description":"what check_gate will judge this edit by","properties":{"binds":{"description":"the gate's scope rule as one fixed sentence: changed functions only; a ratchet mark pardons standing debt at or under it","type":"string"},"ceiling":{"description":"the ccn the gate compares against, same as target","type":"integer"},"diff_uncovered_max":{"description":"configured ceiling on changed lines with no coverage; null means warn only","type":["integer","null"]},"mark_age_days":{"description":"age of that mark, counted from the newest commit that touched the ratchet file","type":["integer","null"]},"ratchet_mark":{"description":"the mark this function carries; an edit at or under it passes the gate, above it fails with exit 6","type":["number","null"]}},"type":"object"},"handle":{"description":"short name form: the bare identifier or (anonymous)#N, the same value get_next_item prints","type":"string"},"lane":{"description":"the lane whose artifact produced cov and uncovered_lines, verbatim from the config; null when no lane covers the scope","properties":{"artifact":{"description":"coverage artifact path it writes","type":"string"},"command":{"description":"the lane's test command as declared","type":"string"},"cwd":{"description":"working directory the lane runs in, empty for the root","type":"string"},"env":{"description":"environment overrides declared for the lane","properties":{},"type":"object"},"name":{"description":"lane name","type":"string"},"parser":{"description":"artifact parser, coveragepy or istanbul","type":"string"},"timeout_seconds":{"description":"declared timeout, 0 for none","type":"integer"}},"type":["object","null"]},"notes":{"description":"prose the config carries for whoever edits here","properties":{"repo":{"description":"repo-wide notes lines from crapkit.toml, or null","items":{"type":"string"},"type":["array","null"]},"scope":{"description":"this scope's notes lines, or null","items":{"type":"string"},"type":["array","null"]}},"type":"object"},"params":{"description":"parameters in declaration order, so a test can call the function without opening the file","items":{"description":"one parameter","properties":{"name":{"description":"parameter name as declared","type":"string"},"type":{"description":"type annotation as lizard printed it, or null when unannotated","type":["string","null"]}},"type":"object"},"type":"array"},"path":{"description":"the resolved file, repo-relative","type":"string"},"ratchet_mark":{"description":"the committed ratchet mark, or null when the function carries none or the repo has no ratchet file","type":["number","null"]},"regrowth":{"description":"did this get fixed before","properties":{"history":{"description":"one [run_id, ccn] pair for every stored run that scored the function, whatever its kind, oldest first","items":{"description":"[run_id, ccn]","items":{"type":"integer"},"type":"array"},"type":"array"},"regrown":{"description":"true when ccn fell across runs and later rose again: an earlier decomposition did not hold","type":"boolean"}},"type":"object"},"remedy":{"description":"decompose, split-lines, add-tests or ok: the branch the session takes; scored.remedy carries the same value","enum":["decompose","split-lines","add-tests","ok"],"type":"string"},"run_id":{"description":"id of the run these numbers come from: the newest trusted run (a coverage run, or a verify run whose verdict passed)","type":"integer"},"schema":{"description":"payload schema version, 1","type":"integer"},"scored":{"description":"the whole scored row from the run","properties":{"ccn":{"description":"min(ccn_std, ccn_mod)","type":"integer"},"ccn_mod":{"description":"modified cyclomatic complexity (a switch counts once)","type":"integer"},"ccn_std":{"description":"standard cyclomatic complexity","type":"integer"},"cognitive":{"description":"cognitive complexity, reporting only","type":"integer"},"cov":{"description":"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","type":"number"},"crap":{"description":"the score: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row","type":"number"},"end":{"description":"last line, inclusive","type":"integer"},"flag":{"description":"measured, untested, excluded, no-lane or cc-only: whether a lane artifact could measure this span","enum":["measured","untested","excluded","no-lane","cc-only"],"type":"string"},"long_name":{"description":"lizard long name with the spaced parameter list","type":"string"},"nesting":{"description":"maximum nesting depth","type":"integer"},"nloc":{"description":"non-comment lines of code","type":"integer"},"occurrence":{"description":"source creation order among functions sharing start, from 1; 0 on an older row with no recorded position","type":"integer"},"params":{"description":"parameter count","type":"integer"},"path":{"description":"repo-relative source path","type":"string"},"remedy":{"description":"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)","enum":["decompose","split-lines","add-tests","ok"],"type":"string"},"scope":{"description":"the scope that owns the file","type":"string"},"start":{"description":"first line, 1-based","type":"integer"}},"type":"object"},"scored_changes":{"description":"how many files the run scored hold other content now than the run recorded, deleted files included; 0 means the numbers describe the files on disk; null when crapkit cannot compare: the run recorded no content (crapkit 0.8.0 or older wrote it) or git failed reading the tree; treat null like any count above 0 and run commands.refresh","type":["integer","null"]},"shallow":{"description":"true when this checkout is a shallow clone: churn and gate_rule.mark_age_days count only the commits the clone holds; set fetch-depth: 0 on the checkout or run git fetch --unshallow for the real counts","type":"boolean"},"source":{"description":"the function's own text, start to end inclusive, newlines intact: editable without reading the file","type":"string"},"stale":{"description":"true when the run's commit is not HEAD. It judges the commit, not the files: an amend or a commit that touched no scored file sets it, and an uncommitted edit leaves it false; scored_changes counts the files whose content moved. Schema 2 redefines it as that content difference","type":"boolean"},"target":{"description":"this scope's effective ceiling: the highest CRAP a function may carry, and so also the highest ccn; the same value as gate_rule.ceiling","type":"integer"},"truncated":{"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"},"uncovered_lines":{"description":"line numbers no test ran; [] when the span is fully covered; null when no artifact could answer, then uncovered_lines_note says why","items":{"type":"integer"},"type":["array","null"]},"uncovered_lines_note":{"description":"present only when uncovered_lines is null: the reason and the move (stale artifact, no test imports the file, coverage_optional scope)","type":"string"},"unmeasured":{"description":"true when no measurement stands behind cov: flag no-lane (no lane covers the scope) or cc-only (the scope asks for no coverage). cov 0.0 and est_uncovered_paths are then stand-ins, not a count of paths no test walks","type":"boolean"},"versions":{"description":"what produced these numbers","properties":{"analysis_version":{"description":"the metric's own version; marks and scores from two versions are not one series","type":"integer"},"crapkit":{"description":"crapkit version","type":"string"},"lizard":{"description":"lizard version","type":"string"},"python":{"description":"interpreter version","type":"string"}},"type":"object"}},"type":"object"},"title":"Start-editing packet for one function"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Returns one function's ccn, coverage, crap and flag per run, oldest first, plus its ratchet mark. Use it to tell improving from decaying or regrown, and get_function_brief to start an edit. history true spawns git log -L capped at 10 commits, and tests true is null unless the lane recorded contexts. name matches the long names any run scored in path, so a fragment returns one entry per match, and a bare twin name picks the worst twin. A same-line twin's history skips runs stored before same-line positions. repo may be any directory under the checkout.","inputSchema":{"properties":{"history":{"description":"also list the commits that touched this function (git log -L), as commits","type":"boolean"},"name":{"description":"the long_name get_next_item printed (classify( score , late )), the bare identifier (classify, or route for a Rust `route cmd : & Cmd`), a fragment of either, the line the function starts on, or a handle such as NAME#2 for a twin or (anonymous)#2; exact match first","type":"string"},"path":{"description":"source file, repo-relative or absolute inside the repo; a backslash separates folders on Windows only","type":"string"},"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"},"tests":{"description":"also list the tests covering this function (coverage.py contexts), as tests","type":"boolean"}},"required":["path","name"],"type":"object"},"name":"get_function_history","outputSchema":{"properties":{"functions":{"description":"the functions name resolved to, in store order","items":{"description":"one function the name resolved to","properties":{"commits":{"description":"with history true: up to 10 commits that touched the span, newest first; null otherwise, and null with commits_note when the function is not in the newest run","items":{"description":"one commit","properties":{"body":{"description":"the rest of the message","type":"string"},"date":{"description":"commit date, YYYY-MM-DD","type":"string"},"sha":{"description":"abbreviated sha","type":"string"},"subject":{"description":"first line of the message","type":"string"}},"type":"object"},"type":["array","null"]},"commits_note":{"description":"present only when commits is null for a reason: the reason","type":"string"},"history":{"description":"the score per run that measured the function, oldest first","items":{"description":"one run's measurement","properties":{"ccn":{"description":"complexity in that run","type":"integer"},"commit":{"description":"the run's commit, full sha","type":"string"},"cov":{"description":"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; null on an inventory run","type":["number","null"]},"crap":{"description":"score: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row; null on an inventory run","type":["number","null"]},"created_at":{"description":"UTC timestamp, ISO 8601","type":"string"},"flag":{"description":"measured, untested, excluded, no-lane or cc-only; null on an inventory-only run","enum":["measured","untested","excluded","no-lane","cc-only",null],"type":["string","null"]},"kind":{"description":"inventory, coverage, partial, verify, hook or legacy","enum":["inventory","coverage","partial","verify","hook","legacy"],"type":"string"},"run_id":{"description":"the run","type":"integer"}},"type":"object"},"type":"array"},"long_name":{"description":"the resolved long name; several entries when name matched by substring or the signature changed across runs","type":"string"},"ratchet_mark":{"description":"the committed ratchet mark, or null","type":["number","null"]},"ratchet_mark_note":{"description":"present only when the repo has no ratchet file, so null means no file rather than no mark","type":"string"},"tests":{"description":"with tests true: test ids whose coverage context ran the span; null when the lane recorded no contexts or the function is not in the newest run","items":{"type":"string"},"type":["array","null"]},"tests_note":{"description":"present only when tests is null for want of contexts: how to record them (dynamic_context = test_function and a --show-contexts report)","type":"string"},"uncovered_lines":{"description":"lines no test ran in the newest run; [] when fully covered; null when no artifact could answer or the function is not in the newest run","items":{"type":"integer"},"type":["array","null"]},"uncovered_lines_note":{"description":"present only when uncovered_lines is null: the reason","type":"string"}},"type":"object"},"type":"array"},"name":{"description":"the name argument as given","type":"string"},"path":{"description":"the file asked about","type":"string"},"schema":{"description":"payload schema version, 1","type":"integer"},"truncated":{"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"}},"type":"object"},"title":"One function's score across runs"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Checks that crapkit.toml agrees with the repo: typo keys, empty scopes, missing lane cwds, runners that fail to start. Run it first when any tool answers strangely or the ranking misses a file, and list_runs when only the history is in question. It needs no run, probes each runner once per lane directory and environment, runs no lane, and any problem arrives with isError true. repo can be any directory under the checkout, and one with no crapkit.toml above it answers a pointer, never a parent's config.","inputSchema":{"properties":{"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"type":"object"},"name":"check_config","outputSchema":{"properties":{"analysis_version":{"description":"the analysis semantics version; with the lizard version it stamps every ratchet mark, so a bump refuses old marks until the repo re-seeds","type":"integer"},"lanes":{"description":"per declared lane","items":{"description":"one declared lane","properties":{"artifact":{"description":"coverage artifact path","type":"string"},"artifact_present":{"description":"whether the artifact is on disk now","type":"boolean"},"commit":{"description":"commit stamped on the artifact, null for a lane that never ran","type":["string","null"]},"name":{"description":"lane name","type":"string"},"refusal":{"description":"why --reuse-artifacts will not score the lane's artifact on disk: the lane's last attempt wrote no artifact and the file predates it, or .crapkit/artifacts.json cannot be read; null when reuse would score it","type":["string","null"]},"seconds":{"description":"how long the lane took last time, null when it never ran","type":["number","null"]}},"type":"object"},"type":"array"},"newest_run":{"description":"the newest run, or null when nothing has run","properties":{"id":{"description":"run id","type":"integer"},"kind":{"description":"run kind","enum":["inventory","coverage","partial","verify","hook","legacy"],"type":"string"},"verdict_ok":{"description":"verify verdict, null on other kinds","type":["boolean","null"]}},"type":["object","null"]},"problems":{"description":"FAIL findings as sentences naming the fix; non-empty is exit 1 and the result carries isError true","items":{"type":"string"},"type":"array"},"resources":{"description":"effective resource policy; limits and estimates, not sampled utilization","properties":{"available_cpus":{"description":"CPUs visible to this process","type":"integer"},"budget_directory":{"description":"coordination directory; status does not create it","type":"string"},"coordination":{"description":"worker slot ownership scope","type":"string"},"cpu_probe":{"description":"CPU affinity or fallback probe used","type":"string"},"default_chunks_per_worker":{"description":"chunk target used by automatic pool sizing","type":"integer"},"default_source_bytes_per_worker":{"description":"source-byte target for automatic spawn sizing; null for other start methods","type":["integer","null"]},"estimated_pool_memory_mb":{"description":"estimated memory for the allowed worker count","type":"integer"},"inherited_analysis_workers":{"description":"valid inherited worker ceiling or null","type":["integer","null"]},"log_max_bytes":{"description":"byte limit per current and backup lane log; zero is unlimited","type":"integer"},"memory_budget_mb":{"description":"inherited memory sizing hint or null","type":["integer","null"]},"memory_is_hard_limit":{"description":"false: memory policy sizes workers without an OS allocation limit","type":"boolean"},"pool_worker_limit":{"description":"per-pool ceiling after CPU, memory and inherited limits","type":"integer"},"requested_analysis_workers":{"description":"configured per-pool ceiling; zero selects the default","type":"integer"},"serial_fallback":{"description":"busy slots allow serial work without waiting","type":"boolean"},"shared_pool_limit":{"description":"shared numbered pool slot ceiling","type":"integer"},"test_retention_count":{"description":"deprecated, always 0: crapkit applies no test evidence retention","type":"integer"},"test_retention_days":{"description":"deprecated, always 0: crapkit applies no test evidence retention","type":"integer"},"worker_memory_estimate_mb":{"description":"memory estimate per analysis worker","type":"integer"}},"type":"object"},"schema":{"description":"payload schema version, 1","type":"integer"},"store":{"description":"the run store","properties":{"path":{"description":".crapkit/crap.sqlite, repo-relative","type":"string"},"present":{"description":"whether the store exists","type":"boolean"},"size_bytes":{"description":"its size, 0 on a fresh repo","type":"integer"}},"type":"object"},"truncated":{"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"},"versions":{"description":"the tools behind every number","properties":{"crapkit":{"description":"crapkit version","type":"string"},"lizard":{"description":"lizard version, null when not importable (a FAIL)","type":["string","null"]},"python":{"description":"interpreter version","type":"string"}},"type":"object"},"warnings":{"description":"WARN findings: unmeasured directories, scopes with a lane but no scoped_tests template, artifacts written outside .crapkit, lanes without results_artifact; exit stays 0","items":{"type":"string"},"type":"array"}},"type":"object"},"title":"Config and repo health check"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Lists file pairs that keep landing in the same commits over the churn window, strongest first, at most 50. Use it before editing a file to learn what an edit drags along, and list_duplicate_functions for copied code. It reads a cached ranking, not the scored run, and walks git log again only when HEAD, the churn window or the clone depth moved. An empty list means no pair cleared both thresholds, not a missing run: min_support 5 needs five shared commits, and min_confidence 0.5 means the rarer file moved with its partner half the time.","inputSchema":{"properties":{"min_confidence":{"description":"minimum P(pair changes together), 0 to 1 (default 0.5)","type":"number"},"min_support":{"description":"minimum shared commits before a pair counts (default 5)","type":"integer"},"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"type":"object"},"name":"list_coupled_files","outputSchema":{"properties":{"pairs":{"description":"pairs clearing both thresholds, ordered by support x confidence descending, at most 50","items":{"description":"one coupled pair","properties":{"confidence":{"description":"the larger of support / commits(a) and support / commits(b), 0 to 1, four decimals","type":"number"},"files":{"description":"the two repo-relative paths, sorted; any path in the history can appear, tests and docs included","items":{"type":"string"},"type":"array"},"support":{"description":"commits in which both files changed, commits over 30 files excluded","type":"integer"}},"type":"object"},"type":"array"},"schema":{"description":"payload schema version, 1","type":"integer"},"truncated":{"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"},"window_months":{"description":"months of git history the pairs were counted over, back from the commit date of HEAD (the config's churn_window_months)","type":"integer"}},"type":"object"},"title":"Files that change together"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Lists near-duplicate function pairs in the newest run, at most 50. Use it before a refactor so twins are folded together, and get_function_brief for one function's twins. It reads the run's stored index, whose first build takes seconds on a large repo, skips functions with under 8 lines of their own and nested pairs, and an empty list means no pair reached similarity. similarity is shared shingles over the smaller function: 1.0 admits only a function found whole inside another, 0.8 four lines in five, and repo may be any directory under the checkout.","inputSchema":{"properties":{"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"},"similarity":{"description":"containment threshold, shared over smaller, 0 to 1 (default 0.8)","type":"number"}},"type":"object"},"name":"list_duplicate_functions","outputSchema":{"properties":{"pairs":{"description":"pairs at or above similarity, best containment first, at most 50","items":{"description":"one near-duplicate pair","properties":{"contained":{"description":"always false here: pairs whose spans nest in one file are dropped before ranking; kept so pairs and get_function_brief's duplication_twins share one shape","type":"boolean"},"functions":{"description":"the two functions of the pair","items":{"description":"one member","properties":{"end":{"description":"last line","type":"integer"},"long_name":{"description":"lizard long name","type":"string"},"nloc":{"description":"non-comment lines","type":"integer"},"path":{"description":"repo-relative path","type":"string"},"start":{"description":"first line","type":"integer"}},"type":"object"},"type":"array"},"similarity":{"description":"shared shingles over the smaller function's shingles, 0 to 1, four decimals","type":"number"}},"type":"object"},"type":"array"},"run_id":{"description":"the newest run whose rows were compared","type":"integer"},"schema":{"description":"payload schema version, 1","type":"integer"},"truncated":{"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"}},"type":"object"},"title":"Near-duplicate function pairs"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Reports the ratchet debt burn-down: open marks with their age, repayments and policy findings. Use it to judge whether marked debt is repaid or piling up, and get_function_history for one function's mark. It reads the marks file and its git history only, and ages count from the newest commit touching that file, never the clock. Open marks are the file's rows, committed or not. A deleted or emptied file reports the marks its history last held as open, none repaid, and no file with no history reports zeros. repo may be any directory under the checkout.","inputSchema":{"properties":{"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"type":"object"},"name":"get_ratchet_report","outputSchema":{"properties":{"anchor_ts":{"description":"unix seconds of the newest commit that touched the ratchet file; every age and window counts back from here, never from the wall clock; 0 with no ratchet history","type":"integer"},"dropped_last_30d":{"description":"marks repaid in the 30 days before anchor_ts","type":"integer"},"dropped_last_90d":{"description":"marks repaid in the 90 days before anchor_ts","type":"integer"},"dropped_total":{"description":"marks repaid over the whole committed history","type":"integer"},"oldest":{"description":"up to 20 open marks, oldest first","items":{"description":"one open mark","properties":{"age_days":{"description":"days the mark has stood, counted back from anchor_ts","type":"integer"},"long_name":{"description":"the marked function's long name","type":"string"},"path":{"description":"repo-relative path","type":"string"}},"type":"object"},"type":"array"},"open":{"description":"marks open on disk, working tree included: an uncommitted seed counts","type":"integer"},"policy_violations":{"description":"null when no debt policy is configured, [] when the policy ran clean, else the findings as sentences","items":{"type":"string"},"type":["array","null"]},"schema":{"description":"payload schema version, 1","type":"integer"},"shallow":{"description":"true when this checkout is a shallow clone: ages and repayments count only the commits the clone holds; set fetch-depth: 0 on the checkout or run git fetch --unshallow for the real counts, and crapkit ratchet report --enforce refuses to judge the debt policy there (exit 4)","type":"boolean"},"truncated":{"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"},"uncommitted":{"description":"marks the working tree and the newest committed ratchet file disagree on: added, repaid or tightened but not committed","type":"integer"}},"type":"object"},"title":"Ratchet debt burn-down"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"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.","inputSchema":{"properties":{"path":{"description":"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.","type":"string"},"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"required":["path"],"type":"object"},"name":"check_gate","outputSchema":{"properties":{"baseline_commit":{"description":"that run's commit, full sha","type":"string"},"baseline_run":{"description":"id of the run whose coverage was reused","type":"integer"},"functions":{"description":"every function in the file, rescored","items":{"description":"one rescored function","properties":{"ccn":{"description":"complexity measured fresh from the working tree","type":"integer"},"cov":{"description":"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","type":"number"},"crap":{"description":"score from fresh ccn and baseline cov: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row","type":"number"},"end":{"description":"last line","type":"integer"},"flag":{"description":"measured, untested, excluded, no-lane or cc-only: whether a lane artifact could measure this span","enum":["measured","untested","excluded","no-lane","cc-only"],"type":"string"},"function":{"description":"long name","type":"string"},"occurrence":{"description":"source creation order among functions sharing start, from 1; 0 on an older row with no recorded position","type":"integer"},"path":{"description":"repo-relative path","type":"string"},"remedy":{"description":"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)","enum":["decompose","split-lines","add-tests","ok"],"type":"string"},"scope":{"description":"the scope that owns the file","type":"string"},"stale_coverage":{"description":"always true: complexity is the working tree's, coverage is the baseline run's","type":"boolean"},"start":{"description":"first line","type":"integer"},"unmeasured":{"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"}},"type":"object"},"type":"array"},"gate":{"description":"the verdict block","properties":{"breaches":{"description":"the failing functions; empty when ok","items":{"description":"one judged function over its ceiling, unmarked or with its crap past its ratchet mark","properties":{"ccn":{"description":"fresh complexity","type":"integer"},"ceiling":{"description":"the ceiling it exceeds","type":"integer"},"cov":{"description":"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","type":"number"},"crap":{"description":"score: ccn^2 x (1 - cov)^3 + ccn, or ccn on a cc-only or excluded row","type":"number"},"function":{"description":"long name","type":"string"},"key_name":{"description":"the ratchet key form of the name","type":"string"},"path":{"description":"repo-relative path","type":"string"},"remedy":{"description":"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)","enum":["decompose","split-lines","add-tests","ok"],"type":"string"},"start":{"description":"first line","type":"integer"}},"type":"object"},"type":"array"},"ceilings":{"additionalProperties":{"type":"integer"},"description":"map of repo-relative path to the ccn ceiling it was judged against","properties":{},"type":"object"},"judged":{"description":"functions the working tree changed since HEAD, an untracked file counted in full; 0 on an unchanged path","type":"integer"},"ok":{"description":"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","type":"boolean"},"unread_files":{"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"},"untracked":{"description":"rescored paths git tracks nothing of, judged in full","items":{"type":"string"},"type":"array"}},"type":"object"},"note":{"description":"fixed reminder that coverage is the baseline run's and complexity the working tree's; crapkit verify gives the real verdict","type":"string"},"schema":{"description":"payload schema version, 1","type":"integer"},"truncated":{"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"}},"type":"object"},"title":"rescore --gate verdict for an edited file"},{"annotations":{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true},"description":"Lists open claims on queue items, oldest first. Use it when get_next_item answers empty or skipped_claimed above 0, and use get_function_brief to see one function's own attempts. No tool here writes a claim: the CLI releases a stale one with crapkit claims release PATH NAME, and verify closes one at the ceiling. repo may be any directory under the checkout, since the server walks up to the nearest crapkit.toml. No crapkit.toml above it answers an init pointer, and one with no snapshot store yet a coverage pointer, both as isError true.","inputSchema":{"properties":{"repo":{"description":"path to the scored repo's root (default: the repo the server was started in); a leading ~ is the home directory","type":"string"}},"type":"object"},"name":"list_claims","outputSchema":{"properties":{"claims":{"description":"open claims, oldest first","items":{"description":"one open claim","properties":{"commit":{"description":"HEAD when the claim was taken, not the run's commit","type":"string"},"created_at":{"description":"UTC timestamp, ISO 8601","type":"string"},"handle":{"description":"the short name it was handed out under: bare identifier or (anonymous)#N; null on a claim taken before handles existed","type":["string","null"]},"id":{"description":"claim id","type":"integer"},"long_name":{"description":"the function's long name","type":"string"},"path":{"description":"repo-relative source file","type":"string"}},"type":"object"},"type":"array"},"open":{"description":"number of open claims","type":"integer"},"schema":{"description":"payload schema version, 1","type":"integer"},"truncated":{"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"}},"type":"object"},"title":"Open queue claims"}]}}}
