Public report of JuliusBrussee/caveman, published 24 October 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Watchdog signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 24 October 2026, 13:11 UTC · Survey ID cd_b8c11b3607b747048f19884f5b31642a
JuliusBrussee/caveman
Measured 24 October 2026, 13:01 UTC, at code version 1f951fb
No regression since the last survey
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Down 3 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 136,996 lines of product code in 19 projects, tests not counted · Estimated rebuild effort: about 1.6 person-years · Weakest lens: Code Health, 47
Findings by how serious they are
33 critical1828 serious160 minor
13 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
24 October 2026, 13:01 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
87of 92 dimensions measured by tools. The other 5 are advisory notes from an AI model, which explain the code but don't count towards the score.
1997of 2021 findings point to an exact file and line, so you can open each one in the code. The other 24 concern the repository as a whole, such as missing documentation.
92dimensions across 7 lenses, read from 136,996 lines of product code in 19 projects.
JuliusBrussee/caveman scores 56 out of 100 and is rated Adequate, while five of its seven lenses score higher still: Maturity at 84, Architecture at 83 and Performance at 75, all rated Strong, and Security and Compliance at 81 and Production Readiness at 65, both rated Adequate.
The score is lower than those five because the weakest lens counts most, and here that is Code Health, which scores 47 and is rated Weak. Its Type Safety dimension scores 1.7 out of 10, and until that reaches 4, Code Health can't be rated higher than Adequate. The first actions are to migrate the remaining .js/.jsx files to TypeScript and to declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh, and if Code Health rose to 70, the score would rise from 56 to about 63.
33 findings are critical: 14 in Static Analysis (SAST), nine in Dependency Vulnerabilities, five in Page structure, two in Circular Imports, two in Dependency Hygiene and one in IaC & Container Security.
Watchdog couldn't measure 13 dimensions in this code, among them Code Coverage, Test Reliability and Navigability, so they are left out of the score. The product code is 136,996 lines, which would take an estimated 1.6 person-years, around €240,000, to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Code Health rose from 47 to 70, the lowest score rated Strong, the score would rise from 56 to about 63.
Code composition: what the lines of code are
Product code 59%Tests 41%
New since the last survey: 402 findings
These 402 critical or serious findings weren't in the previous survey, on 10 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 329 findings
These 329 critical or serious findings were in the previous survey, on 10 October 2026, and are gone from this one. The first 100 are listed here.
€79,000 to €400,000, for 1,313 to 4,165 hours of work, about 1.6 person-years for 1 to 4 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.8 at a score of 56. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 136,996 lines of product code
How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Migrate the remaining .js/.jsx files to TypeScript.
Raises the score by about 4 points · Medium effort · Type Safety
2
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Raises the score by about 3 points · Medium effort · Page structure
3
Enforce accessibility in the toolchain: add an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have, then assert with @axe-core/playwright in tests, then gate axe/pa11y/Lighthouse in CI.
Raises the score by about 3 points · Medium effort · A11y enforcement
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €240,000 to build again, about 1.6 person-years of work. Its weakest lens is Code Health, at 47 (Weak). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Migrate the remaining .js/.jsx files to TypeScript. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.8 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 6% to 13% on every change. The history of the code shows how much it changes: about 445,874 lines over the last 90 days, which is about 1,808,267 lines a year. At that pace, the extra work comes to an estimated 252.6 to 1515.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
198 modules, with 159 dependencies between them. One loop runs through 2 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 158 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
github.com/JuliusBrussee/caveman/engine/compressors uses github.com/JuliusBrussee/caveman/engine/tokens, so a change to github.com/JuliusBrussee/caveman/engine/tokens can break github.com/JuliusBrussee/caveman/engine/compressors, while a change to github.com/JuliusBrussee/caveman/engine/compressors can't break github.com/JuliusBrussee/caveman/engine/tokens.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/engine/compressors uses a module listed above it, which is the healthy direction.
12→20 github.com/JuliusBrussee/caveman/mcp uses github.com/JuliusBrussee/caveman/enginepart of a loop✕
Connections
4 pairs of types, where a type in github.com/JuliusBrussee/caveman/mcp uses a type in github.com/JuliusBrussee/caveman/engine.
github.com/JuliusBrussee/caveman/mcp uses github.com/JuliusBrussee/caveman/engine, so a change to github.com/JuliusBrussee/caveman/engine can break github.com/JuliusBrussee/caveman/mcp, while a change to github.com/JuliusBrussee/caveman/mcp can't break github.com/JuliusBrussee/caveman/engine.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/config uses a type in github.com/JuliusBrussee/caveman/proxy/providers.
github.com/JuliusBrussee/caveman/proxy/internal/config uses github.com/JuliusBrussee/caveman/proxy/providers, so a change to github.com/JuliusBrussee/caveman/proxy/providers can break github.com/JuliusBrussee/caveman/proxy/internal/config, while a change to github.com/JuliusBrussee/caveman/proxy/internal/config can't break github.com/JuliusBrussee/caveman/proxy/providers.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/config uses a module listed above it, which is the healthy direction.
23 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/gateway uses a type in github.com/JuliusBrussee/caveman/proxy/providers.
github.com/JuliusBrussee/caveman/proxy/internal/gateway uses github.com/JuliusBrussee/caveman/proxy/providers, so a change to github.com/JuliusBrussee/caveman/proxy/providers can break github.com/JuliusBrussee/caveman/proxy/internal/gateway, while a change to github.com/JuliusBrussee/caveman/proxy/internal/gateway can't break github.com/JuliusBrussee/caveman/proxy/providers.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/gateway uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/gateway uses a type in github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
github.com/JuliusBrussee/caveman/proxy/internal/gateway uses github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice, so a change to github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice can break github.com/JuliusBrussee/caveman/proxy/internal/gateway, while a change to github.com/JuliusBrussee/caveman/proxy/internal/gateway can't break github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/gateway uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/gateway uses a type in github.com/JuliusBrussee/caveman/shared/platform/cost.
github.com/JuliusBrussee/caveman/proxy/internal/gateway uses github.com/JuliusBrussee/caveman/shared/platform/cost, so a change to github.com/JuliusBrussee/caveman/shared/platform/cost can break github.com/JuliusBrussee/caveman/proxy/internal/gateway, while a change to github.com/JuliusBrussee/caveman/proxy/internal/gateway can't break github.com/JuliusBrussee/caveman/shared/platform/cost.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/gateway uses a module listed above it, which is the healthy direction.
4 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime uses a type in github.com/JuliusBrussee/caveman/engine/ccr.
github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime uses github.com/JuliusBrussee/caveman/engine/ccr, so a change to github.com/JuliusBrussee/caveman/engine/ccr can break github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime, while a change to github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime can't break github.com/JuliusBrussee/caveman/engine/ccr.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime uses a type in github.com/JuliusBrussee/caveman/proxy/internal/sessionusage.
github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime uses github.com/JuliusBrussee/caveman/proxy/internal/sessionusage, so a change to github.com/JuliusBrussee/caveman/proxy/internal/sessionusage can break github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime, while a change to github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime can't break github.com/JuliusBrussee/caveman/proxy/internal/sessionusage.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/nativeruntime uses a module listed above it, which is the healthy direction.
8 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/providers/anthropic uses a type in github.com/JuliusBrussee/caveman/proxy/providers.
github.com/JuliusBrussee/caveman/proxy/providers/anthropic uses github.com/JuliusBrussee/caveman/proxy/providers, so a change to github.com/JuliusBrussee/caveman/proxy/providers can break github.com/JuliusBrussee/caveman/proxy/providers/anthropic, while a change to github.com/JuliusBrussee/caveman/proxy/providers/anthropic can't break github.com/JuliusBrussee/caveman/proxy/providers.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/providers/anthropic uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/providers/anthropic uses a type in github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
github.com/JuliusBrussee/caveman/proxy/providers/anthropic uses github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice, so a change to github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice can break github.com/JuliusBrussee/caveman/proxy/providers/anthropic, while a change to github.com/JuliusBrussee/caveman/proxy/providers/anthropic can't break github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/providers/anthropic uses a module listed above it, which is the healthy direction.
14 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/providers/bedrock uses a type in github.com/JuliusBrussee/caveman/proxy/providers.
github.com/JuliusBrussee/caveman/proxy/providers/bedrock uses github.com/JuliusBrussee/caveman/proxy/providers, so a change to github.com/JuliusBrussee/caveman/proxy/providers can break github.com/JuliusBrussee/caveman/proxy/providers/bedrock, while a change to github.com/JuliusBrussee/caveman/proxy/providers/bedrock can't break github.com/JuliusBrussee/caveman/proxy/providers.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/providers/bedrock uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/providers/bedrock uses a type in github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
github.com/JuliusBrussee/caveman/proxy/providers/bedrock uses github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice, so a change to github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice can break github.com/JuliusBrussee/caveman/proxy/providers/bedrock, while a change to github.com/JuliusBrussee/caveman/proxy/providers/bedrock can't break github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/providers/bedrock uses a module listed above it, which is the healthy direction.
packages.cli.src uses packages.cli.src.device-auth_generated, so a change to packages.cli.src.device-auth_generated can break packages.cli.src, while a change to packages.cli.src can't break packages.cli.src.device-auth_generated.
Position
Below the diagonal: packages.cli.src uses a module listed above it, which is the healthy direction.
packages.sdk.typescript.src.middleware.runtime uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.sdk.typescript.src.middleware.runtime, while a change to packages.sdk.typescript.src.middleware.runtime can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.sdk.typescript.src.middleware.runtime uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/engine uses github.com/JuliusBrussee/caveman/engine/ccr, so a change to github.com/JuliusBrussee/caveman/engine/ccr can break github.com/JuliusBrussee/caveman/engine, while a change to github.com/JuliusBrussee/caveman/engine can't break github.com/JuliusBrussee/caveman/engine/ccr.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/engine uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/engine uses github.com/JuliusBrussee/caveman/engine/tokens, so a change to github.com/JuliusBrussee/caveman/engine/tokens can break github.com/JuliusBrussee/caveman/engine, while a change to github.com/JuliusBrussee/caveman/engine can't break github.com/JuliusBrussee/caveman/engine/tokens.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/engine uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/engine uses github.com/JuliusBrussee/caveman/engine/compressors, so a change to github.com/JuliusBrussee/caveman/engine/compressors can break github.com/JuliusBrussee/caveman/engine, while a change to github.com/JuliusBrussee/caveman/engine can't break github.com/JuliusBrussee/caveman/engine/compressors.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/engine uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/engine uses github.com/JuliusBrussee/caveman/mcp, so a change to github.com/JuliusBrussee/caveman/mcp can break github.com/JuliusBrussee/caveman/engine, while a change to github.com/JuliusBrussee/caveman/engine can't break github.com/JuliusBrussee/caveman/mcp.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/engine uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/cloudlink uses a type in github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
github.com/JuliusBrussee/caveman/proxy/internal/cloudlink uses github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice, so a change to github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice can break github.com/JuliusBrussee/caveman/proxy/internal/cloudlink, while a change to github.com/JuliusBrussee/caveman/proxy/internal/cloudlink can't break github.com/JuliusBrussee/caveman/proxy/providers/jsonsplice.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/cloudlink uses a module listed above it, which is the healthy direction.
9 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/cloudlink uses a type in github.com/JuliusBrussee/caveman/proxy/internal/gateway.
github.com/JuliusBrussee/caveman/proxy/internal/cloudlink uses github.com/JuliusBrussee/caveman/proxy/internal/gateway, so a change to github.com/JuliusBrussee/caveman/proxy/internal/gateway can break github.com/JuliusBrussee/caveman/proxy/internal/cloudlink, while a change to github.com/JuliusBrussee/caveman/proxy/internal/cloudlink can't break github.com/JuliusBrussee/caveman/proxy/internal/gateway.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/cloudlink uses a module listed above it, which is the healthy direction.
packages.cli uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.cli, while a change to packages.cli can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.cli uses a module listed above it, which is the healthy direction.
packages.cli uses packages.cli.src, so a change to packages.cli.src can break packages.cli, while a change to packages.cli can't break packages.cli.src.
Position
Below the diagonal: packages.cli uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.common uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.middleware.typescript.src.common, while a change to packages.middleware.typescript.src.common can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.middleware.typescript.src.common uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.common uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.common, while a change to packages.middleware.typescript.src.common can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.common uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.langchain-model uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.middleware.typescript.src.langchain-model, while a change to packages.middleware.typescript.src.langchain-model can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.middleware.typescript.src.langchain-model uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.langchain-model uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.langchain-model, while a change to packages.middleware.typescript.src.langchain-model can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.langchain-model uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.strands uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.middleware.typescript.src.strands, while a change to packages.middleware.typescript.src.strands can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.middleware.typescript.src.strands uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.strands uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.strands, while a change to packages.middleware.typescript.src.strands can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.strands uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/browse uses github.com/JuliusBrussee/caveman/mcp, so a change to github.com/JuliusBrussee/caveman/mcp can break github.com/JuliusBrussee/caveman/browse, while a change to github.com/JuliusBrussee/caveman/browse can't break github.com/JuliusBrussee/caveman/mcp.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/browse uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/browse uses github.com/JuliusBrussee/caveman/engine, so a change to github.com/JuliusBrussee/caveman/engine can break github.com/JuliusBrussee/caveman/browse, while a change to github.com/JuliusBrussee/caveman/browse can't break github.com/JuliusBrussee/caveman/engine.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/browse uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/mem uses github.com/JuliusBrussee/caveman/engine/ccr, so a change to github.com/JuliusBrussee/caveman/engine/ccr can break github.com/JuliusBrussee/caveman/mem, while a change to github.com/JuliusBrussee/caveman/mem can't break github.com/JuliusBrussee/caveman/engine/ccr.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/mem uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/mem uses github.com/JuliusBrussee/caveman/engine/tokens, so a change to github.com/JuliusBrussee/caveman/engine/tokens can break github.com/JuliusBrussee/caveman/mem, while a change to github.com/JuliusBrussee/caveman/mem can't break github.com/JuliusBrussee/caveman/engine/tokens.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/mem uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/mem uses github.com/JuliusBrussee/caveman/engine, so a change to github.com/JuliusBrussee/caveman/engine can break github.com/JuliusBrussee/caveman/mem, while a change to github.com/JuliusBrussee/caveman/mem can't break github.com/JuliusBrussee/caveman/engine.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/mem uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/proxy/internal/store uses github.com/JuliusBrussee/caveman/engine/tokens, so a change to github.com/JuliusBrussee/caveman/engine/tokens can break github.com/JuliusBrussee/caveman/proxy/internal/store, while a change to github.com/JuliusBrussee/caveman/proxy/internal/store can't break github.com/JuliusBrussee/caveman/engine/tokens.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/store uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/store uses a type in github.com/JuliusBrussee/caveman/proxy/internal/sessionusage.
github.com/JuliusBrussee/caveman/proxy/internal/store uses github.com/JuliusBrussee/caveman/proxy/internal/sessionusage, so a change to github.com/JuliusBrussee/caveman/proxy/internal/sessionusage can break github.com/JuliusBrussee/caveman/proxy/internal/store, while a change to github.com/JuliusBrussee/caveman/proxy/internal/store can't break github.com/JuliusBrussee/caveman/proxy/internal/sessionusage.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/store uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/store uses a type in github.com/JuliusBrussee/caveman/proxy/providers.
github.com/JuliusBrussee/caveman/proxy/internal/store uses github.com/JuliusBrussee/caveman/proxy/providers, so a change to github.com/JuliusBrussee/caveman/proxy/providers can break github.com/JuliusBrussee/caveman/proxy/internal/store, while a change to github.com/JuliusBrussee/caveman/proxy/internal/store can't break github.com/JuliusBrussee/caveman/proxy/providers.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/store uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/store uses a type in github.com/JuliusBrussee/caveman/shared/platform/cost.
github.com/JuliusBrussee/caveman/proxy/internal/store uses github.com/JuliusBrussee/caveman/shared/platform/cost, so a change to github.com/JuliusBrussee/caveman/shared/platform/cost can break github.com/JuliusBrussee/caveman/proxy/internal/store, while a change to github.com/JuliusBrussee/caveman/proxy/internal/store can't break github.com/JuliusBrussee/caveman/shared/platform/cost.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/store uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/store uses a type in github.com/JuliusBrussee/caveman/proxy/internal/gateway.
github.com/JuliusBrussee/caveman/proxy/internal/store uses github.com/JuliusBrussee/caveman/proxy/internal/gateway, so a change to github.com/JuliusBrussee/caveman/proxy/internal/gateway can break github.com/JuliusBrussee/caveman/proxy/internal/store, while a change to github.com/JuliusBrussee/caveman/proxy/internal/store can't break github.com/JuliusBrussee/caveman/proxy/internal/gateway.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/store uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/proxy/internal/store uses github.com/JuliusBrussee/caveman/engine, so a change to github.com/JuliusBrussee/caveman/engine can break github.com/JuliusBrussee/caveman/proxy/internal/store, while a change to github.com/JuliusBrussee/caveman/proxy/internal/store can't break github.com/JuliusBrussee/caveman/engine.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/store uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.ai-sdk uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.ai-sdk, while a change to packages.middleware.typescript.src.ai-sdk can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.ai-sdk uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.ai-sdk uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src.ai-sdk, while a change to packages.middleware.typescript.src.ai-sdk can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src.ai-sdk uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.anthropic uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.anthropic, while a change to packages.middleware.typescript.src.anthropic can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.anthropic uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.anthropic uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src.anthropic, while a change to packages.middleware.typescript.src.anthropic can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src.anthropic uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.google uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.google, while a change to packages.middleware.typescript.src.google can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.google uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.google uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src.google, while a change to packages.middleware.typescript.src.google can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src.google uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.mastra uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.middleware.typescript.src.mastra, while a change to packages.middleware.typescript.src.mastra can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.middleware.typescript.src.mastra uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.mastra uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.mastra, while a change to packages.middleware.typescript.src.mastra can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.mastra uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.mastra uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src.mastra, while a change to packages.middleware.typescript.src.mastra can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src.mastra uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.mcp uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.middleware.typescript.src.mcp, while a change to packages.middleware.typescript.src.mcp can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.middleware.typescript.src.mcp uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.mcp uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.mcp, while a change to packages.middleware.typescript.src.mcp can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.mcp uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.mcp uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src.mcp, while a change to packages.middleware.typescript.src.mcp can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src.mcp uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.openai uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.openai, while a change to packages.middleware.typescript.src.openai can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.openai uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.openai uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src.openai, while a change to packages.middleware.typescript.src.openai can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src.openai uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.transport uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.middleware.typescript.src.transport, while a change to packages.middleware.typescript.src.transport can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.middleware.typescript.src.transport uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.transport uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src.transport, while a change to packages.middleware.typescript.src.transport can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src.transport uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src.transport uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src.transport, while a change to packages.middleware.typescript.src.transport can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src.transport uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses a type in github.com/JuliusBrussee/caveman/engine/ccr.
github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses github.com/JuliusBrussee/caveman/engine/ccr, so a change to github.com/JuliusBrussee/caveman/engine/ccr can break github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse, while a change to github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse can't break github.com/JuliusBrussee/caveman/engine/ccr.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses github.com/JuliusBrussee/caveman/mcp, so a change to github.com/JuliusBrussee/caveman/mcp can break github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse, while a change to github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse can't break github.com/JuliusBrussee/caveman/mcp.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses github.com/JuliusBrussee/caveman/engine, so a change to github.com/JuliusBrussee/caveman/engine can break github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse, while a change to github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse can't break github.com/JuliusBrussee/caveman/engine.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses github.com/JuliusBrussee/caveman/browse, so a change to github.com/JuliusBrussee/caveman/browse can break github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse, while a change to github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse can't break github.com/JuliusBrussee/caveman/browse.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/browse/cmd/caveman-browse uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses github.com/JuliusBrussee/caveman/engine/ccr, so a change to github.com/JuliusBrussee/caveman/engine/ccr can break github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy, while a change to github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy can't break github.com/JuliusBrussee/caveman/engine/ccr.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses a type in github.com/JuliusBrussee/caveman/proxy/internal/sessionusage.
github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses github.com/JuliusBrussee/caveman/proxy/internal/sessionusage, so a change to github.com/JuliusBrussee/caveman/proxy/internal/sessionusage can break github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy, while a change to github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy can't break github.com/JuliusBrussee/caveman/proxy/internal/sessionusage.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses a type in github.com/JuliusBrussee/caveman/proxy/internal/config.
github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses github.com/JuliusBrussee/caveman/proxy/internal/config, so a change to github.com/JuliusBrussee/caveman/proxy/internal/config can break github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy, while a change to github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy can't break github.com/JuliusBrussee/caveman/proxy/internal/config.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses a module listed above it, which is the healthy direction.
7 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses a type in github.com/JuliusBrussee/caveman/proxy/internal/store.
github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses github.com/JuliusBrussee/caveman/proxy/internal/store, so a change to github.com/JuliusBrussee/caveman/proxy/internal/store can break github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy, while a change to github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy can't break github.com/JuliusBrussee/caveman/proxy/internal/store.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/cmd/caveman-proxy uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a type in github.com/JuliusBrussee/caveman/engine/ccr.
github.com/JuliusBrussee/caveman/proxy/internal/middleware uses github.com/JuliusBrussee/caveman/engine/ccr, so a change to github.com/JuliusBrussee/caveman/engine/ccr can break github.com/JuliusBrussee/caveman/proxy/internal/middleware, while a change to github.com/JuliusBrussee/caveman/proxy/internal/middleware can't break github.com/JuliusBrussee/caveman/engine/ccr.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a type in github.com/JuliusBrussee/caveman/engine/tokens.
github.com/JuliusBrussee/caveman/proxy/internal/middleware uses github.com/JuliusBrussee/caveman/engine/tokens, so a change to github.com/JuliusBrussee/caveman/engine/tokens can break github.com/JuliusBrussee/caveman/proxy/internal/middleware, while a change to github.com/JuliusBrussee/caveman/proxy/internal/middleware can't break github.com/JuliusBrussee/caveman/engine/tokens.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a type in github.com/JuliusBrussee/caveman/engine/compressors.
github.com/JuliusBrussee/caveman/proxy/internal/middleware uses github.com/JuliusBrussee/caveman/engine/compressors, so a change to github.com/JuliusBrussee/caveman/engine/compressors can break github.com/JuliusBrussee/caveman/proxy/internal/middleware, while a change to github.com/JuliusBrussee/caveman/proxy/internal/middleware can't break github.com/JuliusBrussee/caveman/engine/compressors.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/proxy/internal/middleware uses github.com/JuliusBrussee/caveman/engine, so a change to github.com/JuliusBrussee/caveman/engine can break github.com/JuliusBrussee/caveman/proxy/internal/middleware, while a change to github.com/JuliusBrussee/caveman/proxy/internal/middleware can't break github.com/JuliusBrussee/caveman/engine.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a module listed above it, which is the healthy direction.
7 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a type in github.com/JuliusBrussee/caveman/proxy/internal/store.
github.com/JuliusBrussee/caveman/proxy/internal/middleware uses github.com/JuliusBrussee/caveman/proxy/internal/store, so a change to github.com/JuliusBrussee/caveman/proxy/internal/store can break github.com/JuliusBrussee/caveman/proxy/internal/middleware, while a change to github.com/JuliusBrussee/caveman/proxy/internal/middleware can't break github.com/JuliusBrussee/caveman/proxy/internal/store.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/middleware uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.sdk.typescript.src.middleware.types, so a change to packages.sdk.typescript.src.middleware.types can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.sdk.typescript.src.middleware.types.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.sdk.typescript.src.middleware.runtime, so a change to packages.sdk.typescript.src.middleware.runtime can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.sdk.typescript.src.middleware.runtime.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.common, so a change to packages.middleware.typescript.src.common can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.common.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.langchain-model, so a change to packages.middleware.typescript.src.langchain-model can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.langchain-model.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.strands, so a change to packages.middleware.typescript.src.strands can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.strands.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.ai-sdk, so a change to packages.middleware.typescript.src.ai-sdk can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.ai-sdk.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.anthropic, so a change to packages.middleware.typescript.src.anthropic can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.anthropic.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.google, so a change to packages.middleware.typescript.src.google can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.google.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.mastra, so a change to packages.middleware.typescript.src.mastra can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.mastra.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.mcp, so a change to packages.middleware.typescript.src.mcp can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.mcp.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.openai, so a change to packages.middleware.typescript.src.openai can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.openai.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
packages.middleware.typescript.src uses packages.middleware.typescript.src.transport, so a change to packages.middleware.typescript.src.transport can break packages.middleware.typescript.src, while a change to packages.middleware.typescript.src can't break packages.middleware.typescript.src.transport.
Position
Below the diagonal: packages.middleware.typescript.src uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a type in github.com/JuliusBrussee/caveman/engine/ccr.
github.com/JuliusBrussee/caveman/proxy/internal/standalone uses github.com/JuliusBrussee/caveman/engine/ccr, so a change to github.com/JuliusBrussee/caveman/engine/ccr can break github.com/JuliusBrussee/caveman/proxy/internal/standalone, while a change to github.com/JuliusBrussee/caveman/proxy/internal/standalone can't break github.com/JuliusBrussee/caveman/engine/ccr.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a type in github.com/JuliusBrussee/caveman/proxy/providers.
github.com/JuliusBrussee/caveman/proxy/internal/standalone uses github.com/JuliusBrussee/caveman/proxy/providers, so a change to github.com/JuliusBrussee/caveman/proxy/providers can break github.com/JuliusBrussee/caveman/proxy/internal/standalone, while a change to github.com/JuliusBrussee/caveman/proxy/internal/standalone can't break github.com/JuliusBrussee/caveman/proxy/providers.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a type in github.com/JuliusBrussee/caveman/proxy/internal/config.
github.com/JuliusBrussee/caveman/proxy/internal/standalone uses github.com/JuliusBrussee/caveman/proxy/internal/config, so a change to github.com/JuliusBrussee/caveman/proxy/internal/config can break github.com/JuliusBrussee/caveman/proxy/internal/standalone, while a change to github.com/JuliusBrussee/caveman/proxy/internal/standalone can't break github.com/JuliusBrussee/caveman/proxy/internal/config.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a module listed above it, which is the healthy direction.
8 pairs of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a type in github.com/JuliusBrussee/caveman/proxy/internal/gateway.
github.com/JuliusBrussee/caveman/proxy/internal/standalone uses github.com/JuliusBrussee/caveman/proxy/internal/gateway, so a change to github.com/JuliusBrussee/caveman/proxy/internal/gateway can break github.com/JuliusBrussee/caveman/proxy/internal/standalone, while a change to github.com/JuliusBrussee/caveman/proxy/internal/standalone can't break github.com/JuliusBrussee/caveman/proxy/internal/gateway.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a module listed above it, which is the healthy direction.
github.com/JuliusBrussee/caveman/proxy/internal/standalone uses github.com/JuliusBrussee/caveman/engine, so a change to github.com/JuliusBrussee/caveman/engine can break github.com/JuliusBrussee/caveman/proxy/internal/standalone, while a change to github.com/JuliusBrussee/caveman/proxy/internal/standalone can't break github.com/JuliusBrussee/caveman/engine.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a type in github.com/JuliusBrussee/caveman/proxy/internal/store.
github.com/JuliusBrussee/caveman/proxy/internal/standalone uses github.com/JuliusBrussee/caveman/proxy/internal/store, so a change to github.com/JuliusBrussee/caveman/proxy/internal/store can break github.com/JuliusBrussee/caveman/proxy/internal/standalone, while a change to github.com/JuliusBrussee/caveman/proxy/internal/standalone can't break github.com/JuliusBrussee/caveman/proxy/internal/store.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a type in github.com/JuliusBrussee/caveman/proxy/internal/middleware.
github.com/JuliusBrussee/caveman/proxy/internal/standalone uses github.com/JuliusBrussee/caveman/proxy/internal/middleware, so a change to github.com/JuliusBrussee/caveman/proxy/internal/middleware can break github.com/JuliusBrussee/caveman/proxy/internal/standalone, while a change to github.com/JuliusBrussee/caveman/proxy/internal/standalone can't break github.com/JuliusBrussee/caveman/proxy/internal/middleware.
Position
Below the diagonal: github.com/JuliusBrussee/caveman/proxy/internal/standalone uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 47% · Weak · gated by D1, D2, R1 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
38
High / Critical
A02:2025 — Security Misconfiguration
16
High / Critical
A03:2025 — Software Supply Chain Failures
13
High / Critical
Roadmap
Begin by migrating the remaining JavaScript files to TypeScript to establish type safety, while simultaneously correcting page structure by adding essential semantic landmarks and titles. Next, integrate automated accessibility checks into the CI pipeline to enforce compliance on rendered pages, ensuring focus styles, reduced motion preferences, and color contrast meet standards. Finally, reduce cyclomatic complexity in branch-heavy functions to improve maintainability and code clarity.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Migrate the remaining .js/.jsx files to TypeScript.
Enforce accessibility in the toolchain: add an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have, then assert with @axe-core/playwright in tests, then gate axe/pa11y/Lighthouse in CI.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Bring the 21 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with Server.proxy (cyclomatic 267), install.uninstall (cyclomatic 171), uninstall (cyclomatic 171).
Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 33
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 1828
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 160
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 13
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 87 of 92 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 5 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 92 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1997 of 2021 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: this repository's production source spans .ts, .go, and our analyzer cannot run the .go test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 65.4% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `vitest --coverage`, `jest --coverage`, `bun test --coverage --coverage-reporter=lcov`, or `nyc`, or `go test -coverprofile=coverage.out ./...`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 2,387 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 407 test source file(s) (.go, .py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability not included — the JavaScript/TypeScript suite (node:test via `pnpm install --frozen-lockfile --ignore-scripts` in the repository root (643 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in browse/ (4 tests); node:test via `npm ci --ignore-scripts` in extension/ (13 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in mcp/ (2 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in mem/js/ (5 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in packages/cli/ (1364 tests); node:test via `npm ci --ignore-scripts` in packages/device-auth/ (4 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in packages/middleware/typescript/ (137 tests); node:test via `npm ci --ignore-scripts` in packages/pi-extension/ (129 tests); node:test via `npm ci --ignore-scripts` in packages/sdk/typescript/ (275 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in packages/subagent-tax/ (51 tests); node:test via `pnpm install --frozen-lockfile --ignore-scripts` in shrink/ (1 tests)) did not finish re-running within its budget: too large to re-run within its budget.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Go module (go.mod/go.sum), but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its Go dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares REDACTED, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (92 contributor(s) across 1828 commit(s) sampled, automation and bot accounts excluded). One of them holds 85% of the history; the other 91 hold 0.2% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `packages/middleware/typescript/src/ai-sdk.ts`, `packages/middleware/typescript/src/compatibility.ts`, `packages/shared/contracts/scripts/validate-continuous-improvement.mjs`, `proxy/internal/translate/jsonfast.go` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in packages/middleware/python/caveman_middleware/google.py, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (deploy/docker-compose.yml). compose up failed (exit 15 — the compose project is invalid) — error while interpolating services.caveman-proxy.environment.CAVEMAN_AUTH_TOKEN: required variable CAVEMAN_AUTH_TOKEN is missing a value: required - put it in deploy/.env, generate with "openssl rand -hex 32"; runtime evidence skipped.
C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Go, Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Go, Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
PF3 Async & latency hygiene — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1490 further occurrence(s) are not listed individually; the score already reflects all 1530.
R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 76 further occurrence(s) are not listed individually; the score already reflects all 116.
S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 442 further occurrence(s) are not listed individually; the score already reflects all 482.
X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 37 further occurrence(s) are not listed individually; the score already reflects all 77.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
D42 Runtime Threat Enforcement: Runtime enforcement is read from committed policy files — a Tetragon/Falco/Kyverno stack installed cluster-wide (Helm release, platform add-on) with no in-repo trace can't be credited, and a committed policy is declared intent, not proof the engine is running and blocking in the live cluster.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (5): D19, D20, D21, D22, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
515 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Server.proxy at 267. A further 5 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being ai-sdk.attested at 23 — they are counted neither in the figure above nor in this dimension's score.
+ 467 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 21 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with Server.proxy (cyclomatic 267), install.uninstall (cyclomatic 171), uninstall (cyclomatic 171). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 21 together lifts Cyclomatic Complexity from 2.0 to about 3.4/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 649 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 57 bodies over 60 down to 60 or less in Cognitive Complexity — start with Server.proxy (cognitive 339), uninstall (cognitive 334), install.uninstall (cognitive 326). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 57 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.5 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 28 FileTooLong finding(s) in God Classes — start with REDACTED (2), main.go (2), compress.py (2). — One of this dimension's main actionable groups (28 warning-level).
Resolve the 16 FunctionTooLong finding(s) in God Classes — start with REDACTED (3), main.go (2), REDACTED (2). — One of this dimension's main actionable groups (16 warning-level).
Resolve the 10 MethodTooLong finding(s) in God Classes — start with REDACTED (3), chatgpt.go, stats.go. — One of this dimension's main actionable groups (10 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
166 duplicated block group(s) detected. Measured on part of this repository only: .ts (27% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
+ 45 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 17 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with retrieve_tool.go (4), chat_in.go (2), content_compress.go (2). — One of this dimension's main actionable groups (17 warning-level).
Resolve the 14 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with REDACTED (2), compress.py (2), cdp.go. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 14 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with compress.py (3), metadata_route.go, source_codex.go. — One of this dimension's main actionable groups (14 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling9.5 / 10Stronggated by 1 serious finding✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
17 production modules (npm+Go+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence, with abstractness counted on 11 of the 17 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
Off the main sequence: @caveman-ai/sdk
What to do
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with middleware.go, config.go, adapter.go. — One of this dimension's main actionable groups (3 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
All 2 mechanizable ADR(s) are enforced: 2 by analyzers, 0 by tests. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
✓ On the Gold path — maintain.
Detailed fixes: d7_recommendation.md.
Do you agree with this assessment?
D9 · Test Distribution9.8 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
5324 test methods: 5240 unit, 15 integration, 12 BDD, 57 e2e. The JavaScript/TypeScript suite contributes 2387 `it`/`test` case(s) across 246 test file(s) declaring at least one; its tier split is read from package names and paths only. The Python suite contributes 549 test function(s) across 44 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only. The Go suite contributes 2388 test case(s) across 350 `_test.go` file(s) declaring at least one — every `func Test…(t *testing.T)` that `go test` would collect, plus the suite methods a testify-style runner reaches; a table-driven case list counts once, so this is a floor. Its tier split is INFERRED from file names, paths and build constraints, not declared: 44 of those file(s) use Go's external test package (`package x_test`), which is a visibility boundary rather than a pyramid tier and was not read as one.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Stronggated by 2 serious findings✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
26 skipped (26 with a documented reason), 1 zero-assertion, 1 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2387 tests. Measured on the JavaScript/TypeScript suite only — at least 407 test source file(s) (.go, .py) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: langchain-model loads and runs without langchain installedpackages/middleware/typescript/tests/adapters.test.mjs:33
Fixed-sleep synchronisation: Enter typed ahead before the first screen is shown never accepts the plan unseenpackages/cli/tests/onboard-interactive.runtime.mjs:105
Skipped (documented): untracked sessions keep their record proxy when a new wrap requests compression · ×26packages/cli/tests/wrap-restart.runtime.mjs:148
What to do
Resolve the 1 No assertions finding(s) in Test Quality — start with adapters.test.mjs. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Fixed-sleep synchronisation finding(s) in Test Quality — start with onboard-interactive.runtime.mjs. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
8 outdated, 0 author-deprecated direct Go module(s), 0 pinning or checksum defect(s). 12 of 12 direct requirement(s) were graded against proxy.golang.org (0 not served there, 2 publishing no tagged release to be behind). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from go.mod and go.sum there.
Outdated: github.com/Microsoft/go-winio · ×8
What to do
Maintain Dependency Hygiene — already on the Gold path. — No findings, and enforcement is at this dimension's ceiling.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 1 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 1 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (0 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares a Go module (go.mod/go.sum) and REDACTED, and the licences of those dependency graphs were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: REDACTED (251×167=41917); REDACTED (72×267=19224); REDACTED (46×171=7866) Repeated repair below the complexity floor: packages/cli/tests/native-enable.runtime.mjs (61 of 75 changes were fixes); packages/cli/tests/onboard-setup.runtime.mjs (20 of 22 changes were fixes); packages/cli/tests/onboard-interactive.runtime.mjs (15 of 21 changes were fixes)
Resolve the 107 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (3), compress.py (2), REDACTED (2). — One of this dimension's main actionable groups (107 warning-level).
Resolve the 67 Repeated repair finding(s) in Churn × Complexity Hotspots — start with portable-command.runtime.mjs (2), native-enable.runtime.mjs, onboard-setup.runtime.mjs. — One of this dimension's main actionable groups (67 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
2 deducted task-comment markers across 136996 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The repository's root README is the project overview and an A/B-test citation banner (Caveman makes your AI agent say less and read less; Adobe Research), while browse/README documents a local MCP server named caveman-browse with install/build/run commands. The docs/README is a comprehensive Caveman technical reference covering installation, runtime behavior, agent-facing tools, and hosted-service deployment, plus an outline of Start here/Runtime/Agent-facing tools/Building on Caveman. engine/README explains the Caveman Engine locally; evals/README measures real token compression across three arms; extension/README describes caveman mode for ChatGPT/Gemini; mcp/README links to the in-process Caveman Engine and tools; mem/README covers CLI, MCP, thin clients, guarantees. All documents are clipped by the scanner but their outlines list every section present. The repository's READMEs are well written for their directories: shrink/ documents tool-catalog compression (inferred structural preservation, bounded input), caveman-learn skill shows install, the learn report, and the applied-result record; Firefox extension/firefox/ is a focused feature doc with load/load-test commands; Caveman CLI docs cover usage examples, guarantees, and binary licensing; subagent-tax is an excellent benchmark tool that explains exactly what it measures (schema weight, tokens) and why each row matters. All READMEs are well-structured per their scope. The READMEs for the skills directories (caveman-review, caveman-stats, caveman, ultracave, megacave) are each a directory-level documentation of what they contain and how to invoke their commands. The root repository's architecture/Docs markdown files provide comprehensive design docs, so the per-directory READMEs are focused on deployment/consumption rather than the project overview. All five skills have clear What-it-does sections plus usage examples (invoke commands, show output), with one skill (caveman) also having a measured comparison to plain Answer concisely., and each document is clipped by the scanner mid-sentence, so unshown trailing sections are not flagged as missing.
Documentation: no project overview · ×2README.md
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR QualityExemplary◐ Sampled · advisory
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
0 naming inconsistencies across 0 sampled symbols.
✓ On the Gold path — maintain.
Detailed fixes: d21_recommendation.md.
Do you agree with this assessment?
D22 · Internal API ConsistencyWeak◐ Sampled · advisory
What it measures: Whether the internal API surface is consistent and coherent.
Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.
5 API inconsistencies across a 400-member sample of 254 exposed types.
Inconsistent parameter signatures for framework-specific wrapper functions. Some accept `manifest_bytes` (Anthropic, LangChain), some accept `runtime_key` (Autogen), and others accept neither. This forces consumers to guess which optional arguments are required for which framework.
Inconsistent parameter signatures for agent wrapper functions. Similar to the model wrappers, `manifest_bytes` is present in LangChain but not others, and `runtime_key` is present in Autogen but not others.
Inconsistent invocation patterns. The Agno integration exposes a high-level `invoke`/`ainvoke` API similar to LangChain's standard `BaseChatModel`, but the Langchain integration itself exposes low-level `wrap_model_call` hooks instead of a direct `invoke` method on the middleware class. This creates a confusing API surface where one framework feels like a drop-in replacement and the other feels like a hook-based interceptor.
Inconsistent token counting APIs. Agno's `count_tokens` takes no arguments (likely using internal state), while Autogen's `count_tokens` requires `messages` and `tools`. This inconsistency makes it difficult to write generic code that works across frameworks.
Duplicate intent with different type names. `_usage.UsageReader` and `google._Usage` have identical method signatures (`feed`, `event`, `finish`) and field structures (`sse`, `decoder`, `text`, etc.). This suggests code duplication rather than a unified usage tracking interface.
What to do
Resolve the 1 Inconsistent parameter signatures for framework-specific wrapper… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Inconsistent parameter signatures for agent wrapper functions. Similar… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Inconsistent invocation patterns. The Agno integration exposes a… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d22_recommendation.md · top locations in Appendix A, every location in findings.md.
1 of 19 build units (Python, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
38 finding(s): 0 critical, 14 high, 20 medium, 4 low. semgrep hit a parse error in 6 file(s) — `REDACTED` (lines 47–126), `REDACTED`, `packages/middleware/typescript/src/ai-sdk.ts` (lines 21–22), `packages/middleware/typescript/src/compatibility.ts` (line 33), `packages/shared/contracts/scripts/validate-continuous-improvement.mjs`, … (+1 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 5 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 15 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
Resolve the 9 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (9 issue-level).
Resolve the 3 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 10 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (6), REDACTED (4). — One of this dimension's main actionable groups (10 warning-level).
Resolve the 5 Low IaC finding(s) in IaC & Container Security — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (5 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
1 of 316 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is evals/plot.py. Counted over 316 of the 383 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned files with no living knowledge
Orphaned fileevals/plot.py:1
✓ On the Gold path — maintain.
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn — language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction — baseline misconfigs stay with D31). Deterministic.
What it measures: Whether Kubernetes workloads confine the kernel boundary — a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer — shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.
2/2 workload(s) run every container under a seccomp profile; 0/2 declare an AppArmor/SELinux profile.
What to do
Improve Kernel & Syscall Confinement — currently 8.0/10. — 2/2 workload(s) run every container under a seccomp profile; 0/2 declare an AppArmor/SELinux profile.
What it measures: Whether the Kubernetes deployment wires runtime threat enforcement — a detection engine (Tetragon/Falco) and/or an admission-control policy gate (Kyverno / OPA Gatekeeper / PodSecurity). Presence of committed policy, not a runtime guarantee.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a runtime threat-detection engine (Tetragon TracingPolicy / Falco) and an admission-control policy (Kyverno / OPA Gatekeeper / PodSecurity). Reward-leaning; NotApplicable without workloads. Deterministic.
Resolve the 1 No runtime threat detection finding(s) in Runtime Threat Enforcement. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d42_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 2 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC2 · Forms & labels10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Do you agree with this assessment?
AC3 · Page structure3.5 / 10Weak✓ Tool-verified
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×5) — extension/popup.html:2, extension/scripts/firefox-e2e.mjs:147, extension/store-assets/compare.html:2, …
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). — extension/scripts/firefox-e2e.mjs:147
A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>. (×3) — extension/store-assets/compare.html:2, extension/store-assets/listing.html:2, extension/store-assets/promo.html:2
An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label. — extension/store-assets/listing.html:72
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.slider::before` moves (`transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — extension/popup.css:156
`.review` moves (`transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — extension/popup.css:293
`.review .review-arrow` moves (`transition: transform 0.15s ease, color 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — extension/popup.css:318
`#caveman-indicator` moves (`transition: transform 0.16s ease, border-color 0.16s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — extension/src/indicator.css:30
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
No accessibility enforcement found — no a11y linter (an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have) and no axe/pa11y/Lighthouse in tests or CI. Start by running that check over your rendered pages in CI. What was searched, so you can tell an absence from a miss: the 5 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility in the toolchain: add an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have, then assert with @axe-core/playwright in tests, then gate axe/pa11y/Lighthouse in CI.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 5 of 20 project(s) that lack one — worth up to 0.5 pts.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
2 ADR-shaped document(s) detected by content — `tests/caveman-compress/project-notes.md`, `tests/caveman-compress/project-notes.original.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
What to do
Move ADRs under docs/adr/ (or docs/adrs/) and name them NNNN-title.md so they're easy to find.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
INSTALL.md names `.cursor/rules/caveman.mdc`, but no file or folder `.cursor/rules/caveman.mdc` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — INSTALL.md:186
INSTALL.md names `.github/copilot-instructions.md`, but no file or folder `.github/copilot-instructions.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — INSTALL.md:455
docs/PACKAGE_RELEASES.md names the package `@caveman-ai/middleware@latest`, but no REDACTED of the workspace declares or depends on it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/PACKAGE_RELEASES.md:116
evals/README.md names `snapshots/fidelity.json`, but no file or folder `snapshots/fidelity.json` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — evals/README.md:78
docs/technical/agent-profile-registry.md documents the environment variable `WRAP_BASE_URL_ENV_VARS`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/technical/agent-profile-registry.md:21
docs/technical/configuration.md documents the environment variable `CAVEMAN_MCP`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/technical/configuration.md:66
docs/technical/context-recovery.md documents the environment variable `SQLITE_FCNTL_PERSIST_WAL`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/technical/context-recovery.md:145
docs/technical/deploy.md names `deploy/.env`, but no file or folder `deploy/.env` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/technical/deploy.md:99
docs/technical/learn.md names `mem/mem.db`, but no file or folder `mem/mem.db` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/technical/learn.md:88
docs/technical/provider-authentication.md names OpenAI 1, but the manifest declares `openai` 7.12.1. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/technical/provider-authentication.md:46
docs/technical/testing-and-benchmarks.md runs `node --test --test-force-exit tests/*.js`, but `tests/*.js` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/technical/testing-and-benchmarks.md:58
packages/sdk/typescript/README.md runs `node quickstart.mjs`, but `quickstart.mjs` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — packages/sdk/typescript/README.md:66
What to do
Reconcile the README with reality: INSTALL.md names `.cursor/rules/caveman.mdc`, but no file or folder `.cursor/rules/caveman.mdc` exists; INSTALL.md names `.github/copilot-instructions.md`, but no file or folder `.github/copilot-instructions.md` exists; docs/PACKAGE_RELEASES.md names the package `@caveman-ai/middleware@latest`, but no REDACTED of the workspace declares or depends on it; evals/README.md names `snapshots/fidelity.json`, but no file or folder `snapshots/fidelity.json` exists; docs/technical/agent-profile-registry.md documents the environment variable `WRAP_BASE_URL_ENV_VARS`, but no code, script or configuration file names it.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability8.2 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 4/10 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `browse`, `mcp`, `packages/subagent-tax`, `shrink` and 1 more.
`integrations/compile.mjs` reports through `console.*` at line 50 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — integrations/compile.mjs:50
`integrations/compile.mjs` reports through `console.*` at line 184 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — integrations/compile.mjs:184
`skills/compile.mjs` reports through `console.*` at line 33 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — skills/compile.mjs:33
`skills/compile.mjs` reports through `console.*` at line 257 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — skills/compile.mjs:257
`skills/compile.mjs` reports through `console.*` at line 276 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — skills/compile.mjs:276
`skills/compile.mjs` reports through `console.*` at line 289 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — skills/compile.mjs:289
`skills/compile.mjs` reports through `console.*` at line 295 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — skills/compile.mjs:295
`skills/compile.mjs` reports through `console.*` at line 297 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — skills/compile.mjs:297
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Do you agree with this assessment?
P5 · DR & Backup7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`http.Client{` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — shared/platform/ssrf/ssrf.go:528, shared/platform/ssrf/ssrf.go:532
What to do
Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.
Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.
Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.
What to do
Raise allocation-aware density on the hot paths — currently 321 use(s) across 93,319 production line(s) (~3.4/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
Go: on hot paths, reuse buffers and objects through sync.Pool, preallocate slices and maps with make([]T, 0, n) / make(map[K]V, n), size builders with Grow, append with strconv.Append*, and reslice with buf[:0] instead of allocating anew.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
`mkdtempSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — extension/scripts/firefox-e2e.mjs:121
`mkdirSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — extension/scripts/firefox-e2e.mjs:122
`spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — extension/scripts/firefox-e2e.mjs:129, extension/scripts/firefox-e2e.mjs:250
`cpSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — extension/scripts/firefox-e2e.mjs:131
`readFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — extension/scripts/firefox-e2e.mjs:135, extension/scripts/firefox-e2e.mjs:139
`writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — extension/scripts/firefox-e2e.mjs:137, extension/scripts/firefox-e2e.mjs:143
`rmSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — extension/scripts/firefox-e2e.mjs:255
`readFileSync` in `callback to providersAdd` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:474
`mkdirSync` in `skills` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:2594
`writeFileSync` in `skills` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:2595
`mkdirSync` in `setupInstallLocked` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:3235
`readdirSync` in `setupInstallLocked` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:3238
`unlinkSync` in `setupInstallLocked` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:3240
`unlinkSync` in `anonymous function` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — REDACTED:3920, REDACTED:3930
`spawnSync` in `agentShortcut` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:6380
`existsSync` in `agentShortcut` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:6406
`mkdirSync` in `syncPendingLocalScan` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:13149
`writeFileSync` in `syncPendingLocalScan` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:13150
`statSync` in `syncLocalSavings` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:13217
`readFileSync` in `syncLocalPracticeFindings` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:13388
`readFileSync` in `shrink` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:16558
`chmodSync` in `writeRawConfig` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — REDACTED:21944
`existsSync` in `planModules` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/modules/apply.ts:382
`mkdirSync` in `ensureModuleBinaries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/modules/index-file.ts:134
`chmodSync` in `ensureModuleBinaries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/modules/index-file.ts:172
`readFileSync` in `endRuntimes` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/modules/stop.ts:73
`unlinkSync` in `endRuntimes` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/modules/stop.ts:73
`mkdirSync` in `runCliWithApi` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/tests/_cli.mjs:144
`writeFileSync` in `runCliWithApi` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/tests/_cli.mjs:145
`mkdtempSync` in `test("every shipped profile's selected supported transport preserves recovery through the real compression engine")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/tests/agent-compression-conformance.runtime.mjs:426
`mkdirSync` in `test("every shipped profile's selected supported transport preserves recovery through the real compression engine")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — packages/cli/tests/agent-compression-conformance.runtime.mjs:432, packages/cli/tests/agent-compression-conformance.runtime.mjs:433
`copyFileSync` in `test("every shipped profile's selected supported transport preserves recovery through the real compression engine")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/tests/agent-compression-conformance.runtime.mjs:436
`chmodSync` in `test("every shipped profile's selected supported transport preserves recovery through the real compression engine")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/tests/agent-compression-conformance.runtime.mjs:437
`execFileSync` in `test("every shipped profile's selected supported transport preserves recovery through the real compression engine")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/tests/agent-compression-conformance.runtime.mjs:439
`writeFileSync` in `test("every shipped profile's selected supported transport preserves recovery through the real compression engine")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/tests/agent-compression-conformance.runtime.mjs:443
What to do
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety1.7 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
70 typed · 349 plain JS — the untyped files are agents/check-profile-scope.mjs, agents/compile.mjs, agents/delegate/caveman-delegate-mcp.mjs, agents/delegate/portable-process.mjs, agents/delegate/portable-process.test.mjs, agents/drift-report.mjs (+343 more).
What to do
Migrate the remaining .js/.jsx files to TypeScript.
React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.
10 duplicated blocks under the repository root have copies in at least two of the sibling directories agents, browse, installer, integrations, mcp, packages (+3 more sibling(s) not listed) — 9 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — browse/bin/caveman-browse.mjs:12
7 of the duplicated blocks reported below have copies in at least two of the sibling directories cli, pi-extension, shared, subagent-tax under packages/. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — REDACTED:22419
supabase/functions/blocks-telemetry/ingest.ts:40 · supabase/functions/cli-telemetry/ingest.ts:33 — the two spans are one implementation copied and then locally edited — 457 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — supabase/functions/blocks-telemetry/ingest.ts:40
browse/bin/caveman-browse.mjs:12 · mcp/bin/caveman-mcp.mjs:12 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — browse/bin/caveman-browse.mjs:12
installer/lib/portable-process.js:6 · src/mcp-servers/caveman-shrink/spawn-options.js:15 — the two spans are one implementation copied and then locally edited — 375 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — installer/lib/portable-process.js:6
REDACTED:14433 · REDACTED:15721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:14433
REDACTED:17014 · packages/cli/src/native-hook-fast.ts:228 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — REDACTED:17014
supabase/functions/blocks-telemetry/index.ts:19 · supabase/functions/cli-telemetry/index.ts:17 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — supabase/functions/blocks-telemetry/index.ts:19
REDACTED:17070 · packages/cli/src/native-hook-fast.ts:277 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:17070
agents/delegate/portable-process.mjs:74 · packages/cli/src/portable-command.ts:48 — the two spans are one implementation copied and then locally edited — 285 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — agents/delegate/portable-process.mjs:74
REDACTED:7249 · REDACTED:7296 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:7249
REDACTED:22419 · packages/shared/binary-installer/installer.mjs:38 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — REDACTED:22419
src/hooks/caveman-config.js:235 · src/hooks/caveman-config.js:355 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/hooks/caveman-config.js:235
REDACTED:16968 · packages/cli/src/native-hook-fast.ts:180 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:16968
REDACTED:17682 · REDACTED:17712 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:17682
REDACTED:6461 · REDACTED:17415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:6461
REDACTED:16921 · packages/cli/src/native-hook-fast.ts:159 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — REDACTED:16921
REDACTED:14034 · REDACTED:18374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:14034
agents/delegate/portable-process.mjs:15 · packages/cli/src/portable-command.ts:87 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — agents/delegate/portable-process.mjs:15
extension/src/caveman.js:303 · extension/store-assets/flame.js:11 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — extension/src/caveman.js:303
agents/compile.mjs:201 · integrations/compile.mjs:61 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — agents/compile.mjs:201
installer/lib/settings.js:275 · installer/lib/settings.js:383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — installer/lib/settings.js:275
REDACTED:10818 · REDACTED:10842 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — REDACTED:10818
REDACTED:3443 · REDACTED:3462 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:3443
src/hooks/caveman-activate.js:76 · src/hooks/caveman-config.js:41 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/hooks/caveman-activate.js:76
REDACTED:17112 · packages/cli/src/native-hook-fast.ts:314 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — REDACTED:17112
agents/compile.mjs:538 · integrations/compile.mjs:133 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — agents/compile.mjs:538
REDACTED:3031 · packages/shared/binary-installer/installer.mjs:103 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — REDACTED:3031
packages/subagent-tax/lib/analyze.mjs:25 · packages/subagent-tax/lib/analyze.mjs:51 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — packages/subagent-tax/lib/analyze.mjs:25
REDACTED:17781 · REDACTED:18469 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:17781
packages/sdk/typescript/src/index.ts:1882 · packages/sdk/typescript/src/index.ts:1894 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/sdk/typescript/src/index.ts:1882
src/hooks/caveman-activate.js:34 · src/hooks/caveman-mode-tracker.js:17 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — src/hooks/caveman-activate.js:34
REDACTED:17000 · packages/cli/src/native-hook-fast.ts:215 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:17000
REDACTED:17151 · packages/cli/src/native-hook-fast.ts:339 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:17151
REDACTED:20179 · REDACTED:20196 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:20179
REDACTED:2745 · shrink/bin/caveman-shrink.mjs:12 — the two spans are one implementation copied and then locally edited — 53 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:2745
src/plugins/opencode/plugin.js:62 · src/plugins/opencode/plugin.js:120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/plugins/opencode/plugin.js:62
REDACTED:1928 · REDACTED:2539 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1928
REDACTED:8485 · REDACTED:8538 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:8485
REDACTED:10774 · REDACTED:10813 · REDACTED:10837 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — REDACTED:10774
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
packages/cli/scripts/gen-modules-index.mjs:14 reaches into another package with a relative path (../../../scripts/build-release-binaries.mjs) — import the package by name instead. — packages/cli/scripts/gen-modules-index.mjs:14
packages/middleware/typescript/tests/recovery-errors.test.mjs:147 reaches past another workspace package's public entry into its internals with a relative path (../dist/common.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — packages/middleware/typescript/tests/recovery-errors.test.mjs:147
packages/pi-extension/src/index.ts:1 reaches into another package with a relative path (../../cli/src/provider-routing.ts) — import the package by name instead. — packages/pi-extension/src/index.ts:1
packages/pi-extension/src/portable-command.ts:18 reaches into another package with a relative path (../../cli/src/portable-command.ts) — import the package by name instead. — packages/pi-extension/src/portable-command.ts:18
packages/pi-extension/src/protocol.ts:1 reaches into another package with a relative path (../../cli/src/provider-routing.ts) — import the package by name instead. — packages/pi-extension/src/protocol.ts:1
packages/pi-extension/src/provider.ts:7 reaches into another package with a relative path (../../cli/src/provider-routing.ts) — import the package by name instead. — packages/pi-extension/src/provider.ts:7
packages/shared/contracts/scripts/validate-continuous-improvement.mjs:4 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/shared/contracts/scripts/validate-continuous-improvement.mjs:4
packages/shared/contracts/scripts/validate-schemas.mjs:4 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/shared/contracts/scripts/validate-schemas.mjs:4
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
spawnWrapped has cyclomatic complexity 167 and cognitive complexity 199; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:6591
uninstall has cyclomatic complexity 160 and cognitive complexity 325; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2145
restoreNativeOperation has cyclomatic complexity 118 and cognitive complexity 200; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:10758
nativeHook has cyclomatic complexity 99 and cognitive complexity 94; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:17364
nativeIntegrationStatus has cyclomatic complexity 88 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:11303
onboard has cyclomatic complexity 82 and cognitive complexity 140; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/modules/onboard.ts:123
checkPlan has cyclomatic complexity 74 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/sdk/typescript/src/middleware/validate.ts:86
validateReceiptContent has cyclomatic complexity 73 and cognitive complexity 79; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:21140
compatForRoutedModel has cyclomatic complexity 73 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/pi-extension/src/provider-compat.ts:49
qwenRouteOverride has cyclomatic complexity 66 and cognitive complexity 103; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:15406
status has cyclomatic complexity 64 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:20832
validate has cyclomatic complexity 60 and cognitive complexity 76; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — agents/compile.mjs:289
main has cyclomatic complexity 60 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/native-hook-fast.ts:434
readOwnedMcpPendingJournalAt has cyclomatic complexity 54 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:15832
apply has cyclomatic complexity 53 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/pi-extension/src/provider.ts:64
(anonymous) has cyclomatic complexity 53 and cognitive complexity 65; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:11310
nativeDoctor has cyclomatic complexity 52 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:11556
buildWrapEnv has cyclomatic complexity 51 and cognitive complexity 70; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:12251
project has cyclomatic complexity 51 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/middleware/typescript/src/ai-sdk.ts:137
login has cyclomatic complexity 51 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:12570
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files5.5 / 10Adequate✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
REDACTED has 2656 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
packages/sdk/typescript/src/index.ts has 2306 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/sdk/typescript/src/index.ts:1
packages/cli/src/modules/onboard.ts has 815 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/modules/onboard.ts:1
src/hooks/caveman-config.js has 813 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/hooks/caveman-config.js:1
packages/sdk/typescript/src/middleware/runtime.ts has 654 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/sdk/typescript/src/middleware/runtime.ts:1
packages/cli/src/agent-mcp.ts has 651 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/agent-mcp.ts:1
packages/cli/src/modules/apply.ts has 642 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/modules/apply.ts:1
src/hooks/caveman-stats.js has 609 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/hooks/caveman-stats.js:1
agents/compile.mjs has 588 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — agents/compile.mjs:1
src/hooks/caveman-activate.js has 576 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/hooks/caveman-activate.js:1
REDACTED has 478 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
packages/cli/src/native-hook-fast.ts has 471 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/native-hook-fast.ts:1
packages/shared/contracts/conformance/run.mjs has 467 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/shared/contracts/conformance/run.mjs:1
src/hooks/caveman-mode-tracker.js has 424 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/hooks/caveman-mode-tracker.js:1
installer/lib/settings.js has 410 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — installer/lib/settings.js:1
packages/subagent-tax/run.mjs has 401 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/subagent-tax/run.mjs:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage7.7 / 10Strong✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
packages/middleware/typescript/tests/required.mjs:4 imports './', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/middleware/typescript/tests/required.mjs:4
packages/middleware/typescript/tests/versions.test.mjs:162 imports '../src/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/middleware/typescript/tests/versions.test.mjs:162
packages/pi-extension/tests/provider.runtime.mjs:9 imports './core/provider-attribution.js', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — packages/pi-extension/tests/provider.runtime.mjs:9
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×32) — scripts/probe-native-codex-recovery.mjs:1, packages/shared/contracts/conformance/run.mjs:1, packages/cli/src/native-hook-fast.ts:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
What to do
Bump outdated dependencies to current versions to limit upgrade debt.
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each REDACTED script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: REDACTED scanned for test/lint/typecheck script wiring. Deterministic presence check.
This repository declares test tooling, and the ✓ above records that declaration — but packages/middleware/typescript/tests/required.mjs and 2 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to. — packages/middleware/typescript/tests/required.mjs:4
Do you agree with this assessment?
R7 · Dead Code9.4 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
18 file(s) (~3617 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: packages/pi-extension/tests/portable-command.runtime.mjs imports '../dist/portable-command.mjs', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here. — packages/pi-extension
1 file(s) (~44 LoC) were excluded from dead-code analysis — declare main/module/exports or a conventional entry (src/index.*, an index.html script) so reachability can see this package. — skills/caveman-explore
2 file(s) (~55 LoC) were excluded from dead-code analysis — declare main/module/exports or a conventional entry (src/index.*, an index.html script) so reachability can see this package. — skills/caveman-learn
Unreachable from the 235 application, 60 tooling and 287 test entry point(s) detected in this repo. Gate removals on `pnpm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (235 application, 60 tooling, 287 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×4) — packages/cli/src/native-hook-fast.ts, packages/shared/contracts/scripts/validate-continuous-improvement.mjs, skills/compile.mjs, …
no import path from any entry point (235 application, 60 tooling, 287 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (skills/compile.mjs) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — skills/verbs-gate.mjs
Nothing imports this binding — it is safe to review for removal. — packages/shared/binary-installer/installer.mjs:175
This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×6) — agents/compile.mjs:278, REDACTED:13650, REDACTED:17786, …
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Imported but not declared in any reachable REDACTED — installs work only by hoisting accident. (×2) — tests/middleware-e2e/drive-ts.mjs:22, browse/scripts/playwright-aria-baseline.mjs:4
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document2.7 / 10Weak✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`deepMerge` is exported and takes `overlay: unknown` from its caller, and it calls itself at line 7358 (`deepMerge`) with a piece of `overlay` (and at line 7362) — and nowhere in `deepMerge` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `deepMerge` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — REDACTED:7358
`replace_path` is public and takes `value: Any` from its caller, and it calls itself at line 223 (`replace_path`) with a piece of `value` — and nowhere in `replace_path` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `replace_path` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/middleware/python/caveman_middleware/_native.py:223
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether functions that make a cancellable request accept or pass on a context.Context or an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 38/58 functions that make a cancellable request (fetch, axios, ky, ofetch; net/http, net.Dial) accept a context.Context or an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` (Go: `ctx context.Context`) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`syncPendingLocalScan` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/cli/dist/index.js:13179, REDACTED:13107
`syncLocalSavings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/cli/dist/index.js:13281, REDACTED:13214
`syncLocalPracticeFindings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/cli/dist/index.js:13453, REDACTED:13384
`auditImport` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/cli/dist/index.js:21077, REDACTED:20986
`auditEvalImport` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/cli/dist/index.js:21102, REDACTED:21010
`get` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/cli/dist/index.js:21869, REDACTED:21731
`post` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. (×2) — packages/cli/dist/index.js:21884, REDACTED:21747
`latestRelease` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/middleware/typescript/scripts/check-latest-in-range.mjs:44
`call` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/shared/contracts/conformance/run.mjs:106
`warmCall` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — proxy/internal/cloudlink/warm.go:136
`ask` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — proxy/internal/cloudlink/link.go:1111
`call` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — proxy/internal/cloudlink/events.go:279
`fetchClaudeUsageJSON` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — proxy/internal/store/usage_import.go:124
What to do
Thread a context.Context or an AbortSignal through functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×7) — agents/delegate/portable-process.mjs:128, agents/delegate/caveman-delegate-mcp.mjs:34, agents/delegate/caveman-delegate-mcp.mjs:58, …
`catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — agents/delegate/caveman-delegate-mcp.mjs:47, agents/delegate/caveman-delegate-mcp.mjs:166
`if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×18) — browse/cmd/caveman-browse/main.go:282, browse/cmd/caveman-browse/main.go:292, engine/retrieve_query.go:232, …
`if err := json.NewDecoder(io.LimitReader(resp.Body, 64<<10)).Decode(&version); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — browse/cmd/caveman-browse/main.go:302
`if err := json.Unmarshal(raw, &model); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/cmd/caveman-engine/main.go:613
`if err := dec.Decode(&v); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/compressors/toon_encode.go:401
`if err := json.Unmarshal([]byte(s), &out); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/compressors/toon_decode.go:289
`if err := writer.WriteAll(shaped); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/compressors/tabular.go:193
`if err := writer.Error(); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/compressors/tabular.go:197
`if err := (&printer.Config{Mode: printer.TabIndent, Tabwidth: 8}).Fprint(&buf, fset, file); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/compressors/code_nocgo.go:62
`if err := png.Encode(&buf, downscale(img, nw, nh)); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/image/image.go:178
`if err := json.Unmarshal(encoded, &value); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/pixel/transform_gemini.go:292
`if recover() != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — engine/pixel/transform_gemini.go:1132, engine/pixel/transform_anthropic.go:1292
`if err := json.Unmarshal(raw, &cc); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/pixel/transform_anthropic.go:1428
`if err := json.Unmarshal([]byte(raw), &obj); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — engine/pixel/gpt_profiles.go:115
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `REDACTED` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
~9.7 `!` null assertions per 1k TypeScript source lines — 355 assertion(s) across the 36776 source line(s) of the 62 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: REDACTED (192), packages/sdk/typescript/src/index.ts (52), packages/cli/src/modules/onboard.ts (28). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 10 of 55 WCAG 2.2 Level A/AA success criteria (18%; ≈20% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 45 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 14 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
Not included — 33 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — compose up failed (exit 15 — the compose project is invalid) — error while interpolating services.caveman-proxy.environment.CAVEMAN_AUTH_TOKEN: required variable CAVEMAN_AUTH_TOKEN is missing a value: required - put it in deploy/.env, generate with "openssl rand -hex 32"; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D11 Test Reliability — Test reliability not included
D16 Bus Factor — single-maintainer repository — bus factor is not applicable
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Aggregate roots were found in only one source directory (proxy), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — none of 2 ADRs are conformance-checkable — unverifiable.
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.go), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — 4 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
DM1 Domain Modelling — applicable but not scored (2 signals for this style, 2 needed — the count is met but a required primary signal is absent): 5 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 52 value object(s)
ED1 Event-Driven — not scored — this repository shows only 1 of the 3 signals this lens looks for (10 event-sourced shape(s) (event folds / event-recording aggregates))
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows only 1 of the 3 signals this lens looks for (10 Go aggregate(s) recording domain events (own events-slice append / raise-record))
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P9 Domain vs controller coverage — coverage data present for 526 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
AC3 · Page structure· Document without a <title> · ×3
Document without a <title> extension/store-assets/compare.html:2— A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
Document without a <title> extension/store-assets/listing.html:2— A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
Document without a <title> extension/store-assets/promo.html:2— A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
<html> without a lang extension/scripts/firefox-e2e.mjs:147— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
AC3 · Page structure· <iframe> without a title · ×1
<iframe> without a title extension/store-assets/listing.html:72— An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label.
Unlisted import 'ai' tests/middleware-e2e/drive-ts.mjs:22— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Unlisted import '@playwright/test' browse/scripts/playwright-aria-baseline.mjs:4— Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
Hotspot: REDACTED REDACTED:6591— REDACTED changed 251 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 167 in index.spawnWrapped at line 6591. 198 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:107— REDACTED changed 72 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 267 in Server.proxy at line 107. 54 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:2145— REDACTED changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 171 in install.uninstall at line 2145. 38 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/gateway/route.go proxy/internal/gateway/route.go:781— proxy/internal/gateway/route.go changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in Server.applyEffort at line 781. 21 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/gateway/route.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/cloudlink/link.go proxy/internal/cloudlink/link.go:1111— proxy/internal/cloudlink/link.go changed 43 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in Link.ask at line 1111. 33 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/cloudlink/link.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/gateway/chatgpt.go proxy/internal/gateway/chatgpt.go:54— proxy/internal/gateway/chatgpt.go changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in Server.chatgpt at line 54. 19 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/gateway/chatgpt.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: packages/cli/src/modules/onboard.ts packages/cli/src/modules/onboard.ts:123— packages/cli/src/modules/onboard.ts changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in onboard.onboard at line 123. 18 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/src/modules/onboard.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/cmd/caveman-proxy/main.go proxy/cmd/caveman-proxy/main.go:201— proxy/cmd/caveman-proxy/main.go changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in main.runServe at line 201. 22 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/cmd/caveman-proxy/main.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: packages/cli/src/modules/apply.ts packages/cli/src/modules/apply.ts:363— packages/cli/src/modules/apply.ts changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in apply.planModules at line 363. 26 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/src/modules/apply.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/hooks/caveman-activate.js src/hooks/caveman-activate.js:392— src/hooks/caveman-activate.js changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in caveman-activate.run at line 392. 16 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- src/hooks/caveman-activate.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/hooks/caveman-mode-tracker.js src/hooks/caveman-mode-tracker.js:142— src/hooks/caveman-mode-tracker.js changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in caveman-mode-tracker.handle at line 142. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- src/hooks/caveman-mode-tracker.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: skills/caveman-compress/scripts/compress.py skills/caveman-compress/scripts/compress.py:932— skills/caveman-compress/scripts/compress.py changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in compress._compress_file_locked at line 932. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- skills/caveman-compress/scripts/compress.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/translate/translate.go proxy/internal/translate/translate.go:558— proxy/internal/translate/translate.go changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in Reply.relay at line 558. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/translate/translate.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/store/store.go proxy/internal/store/store.go:493— proxy/internal/store/store.go changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in store.sanitizeRequestRecord at line 493. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/store/store.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/nativeruntime/runtime.go proxy/internal/nativeruntime/runtime.go:301— proxy/internal/nativeruntime/runtime.go changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in Runtime.respond at line 301. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/nativeruntime/runtime.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: agents/compile.mjs agents/compile.mjs:289— agents/compile.mjs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in compile.validate at line 289. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- agents/compile.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: packages/cli/src/native-hook-fast.ts packages/cli/src/native-hook-fast.ts:434— packages/cli/src/native-hook-fast.ts changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in native-hook-fast.main at line 434. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/src/native-hook-fast.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/gateway/route_pool.go proxy/internal/gateway/route_pool.go:77— proxy/internal/gateway/route_pool.go changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in Server.serveTarget at line 77. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/gateway/route_pool.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/standalone/standalone.go proxy/internal/standalone/standalone.go:145— proxy/internal/standalone/standalone.go changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in Creds.Resolve at line 145. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/standalone/standalone.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/store/learn.go proxy/internal/store/learn.go:171— proxy/internal/store/learn.go changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in Store.buildLearnPlan at line 171. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/store/learn.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: packages/sdk/python/caveman_cloud/middleware/runtime.py packages/sdk/python/caveman_cloud/middleware/runtime.py:435— packages/sdk/python/caveman_cloud/middleware/runtime.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in MiddlewareRuntime.optimize at line 435. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/sdk/python/caveman_cloud/middleware/runtime.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/gateway/chatgpt_auto.go proxy/internal/gateway/chatgpt_auto.go:164— proxy/internal/gateway/chatgpt_auto.go changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in Server.chatGPTAuto at line 164. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/gateway/chatgpt_auto.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/providers/adapter.go proxy/providers/adapter.go:986— proxy/providers/adapter.go changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in providers.parseUsageBytes at line 986. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/providers/adapter.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: proxy/internal/translate/responses_stream.go proxy/internal/translate/responses_stream.go:657— proxy/internal/translate/responses_stream.go changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in translate.streamChatToResponses at line 657. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/translate/responses_stream.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: packages/pi-extension/src/provider.ts packages/pi-extension/src/provider.ts:64— packages/pi-extension/src/provider.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in ProviderRouter.apply at line 64. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/pi-extension/src/provider.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/native-enable.runtime.mjs packages/cli/tests/native-enable.runtime.mjs:1086— packages/cli/tests/native-enable.runtime.mjs changed 75 times in last 90 days and 61 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is (anonymous) at line 1086), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(opencode): read where a provider sends requests, not just the journal”; “fix(claude): do not refuse an explicitly written-out api.anthropic.com”; “fix(claude): refuse to take over a third-party ANTHROPIC_BASE_URL”; “fix(cli): codex trust reads a ] in CODEX_HOME and a hook turned off in /hooks”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/native-enable.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/onboard-setup.runtime.mjs packages/cli/tests/onboard-setup.runtime.mjs:267— packages/cli/tests/onboard-setup.runtime.mjs changed 22 times in last 90 days and 20 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is (anonymous) at line 267), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): a port is ours only when its listener vouches for the run state”; “fix(cli): an agent left on its own endpoint is said once and never offered”; “fix(cli): report Codex hooks untrusted, and say once how to trust them”; “fix(cli): a runtime still starting or slow to answer is not foreign”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/onboard-setup.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/onboard-interactive.runtime.mjs packages/cli/tests/onboard-interactive.runtime.mjs:196— packages/cli/tests/onboard-interactive.runtime.mjs changed 21 times in last 90 days and 15 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is (anonymous) at line 196), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): name the undo for Auto keys setup stores”; “fix(setup): never suggest caveman claude when no agent is set up”; “fix(cli): review fixes for the npx handoff, the first screen and the shims”; “fix(cli): respect explicit choices and clear stale Auto choices”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/onboard-interactive.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/qwen-wrap.runtime.mjs packages/cli/tests/qwen-wrap.runtime.mjs:34— packages/cli/tests/qwen-wrap.runtime.mjs changed 20 times in last 90 days and 14 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is withEnv at line 34), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(test): move the qwen version literals with the 0.24.4 pin”; “fix(cli): fail closed on unverifiable proxy owners, strip attributed routes on direct launch”; “fix(cli): name per-session recovery and lock Qwen/Kilo control surfaces”; “fix(cli): guard Qwen route overrides”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/qwen-wrap.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/windows-platform.runtime.mjs packages/cli/tests/windows-platform.runtime.mjs:137— packages/cli/tests/windows-platform.runtime.mjs changed 14 times in last 90 days and 14 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is (anonymous) at line 137), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(shrink-hook): emit a rewrite the host's own shell can parse”; “fix(windows): the home allowlist accepts Caveman's own multi-part temps and lock graves”; “fix(windows): a home is Caveman's only with its own files, and says why not”; “fix(windows): rewrite only a home caveman owns, and only when anyone else may read it”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/windows-platform.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/modules-apply.runtime.mjs packages/cli/tests/modules-apply.runtime.mjs:489— packages/cli/tests/modules-apply.runtime.mjs changed 17 times in last 90 days and 13 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is (anonymous) at line 489), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): check cloud.json before unwiring, and name only modules that were on”; “fix(cli): an agent left on its own endpoint is said once and never offered”; “fix(cli): keep agent-wired modules on while an agent stays wired”; “fix(cli): never re-point an agent that uses its own endpoint”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/modules-apply.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/modules-status.runtime.mjs packages/cli/tests/modules-status.runtime.mjs:182— packages/cli/tests/modules-status.runtime.mjs changed 12 times in last 90 days and 12 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is (anonymous) at line 182), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): status and doctor poll a foreign port once per command”; “fix(cli): Windows stop drops the run state of a runtime it ended the hard way”; “fix(cli): a port is ours only when its listener vouches for the run state”; “fix(cli): status and doctor say when wired agents' runtime is not running”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/modules-status.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/kilo-wrap.runtime.mjs packages/cli/tests/kilo-wrap.runtime.mjs:47— packages/cli/tests/kilo-wrap.runtime.mjs changed 14 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is withEnv at line 47), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): wait for a freshly started proxy's run state before judging its owner”; “fix(cli): name per-session recovery and lock Qwen/Kilo control surfaces”; “fix(cli): guard Kilo managed routing”; “fix(cli): parse Kilo boolean arity”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/kilo-wrap.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/pi-extension/tests/integration.runtime.mjs packages/pi-extension/tests/integration.runtime.mjs:28— packages/pi-extension/tests/integration.runtime.mjs changed 13 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is (anonymous) at line 28), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(pi): follow cloud.json localPort to the moved local runtime”; “fix(pi): shrink tool output only when the session can call caveman_retrieve”; “fix(cli): the prompt hook and pi follow the explicit gateway choice too”; “fix(proxy,pi): read the CLI config from $CAVEMAN_HOME/cloud.json first”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/pi-extension/tests/integration.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/login.runtime.mjs packages/cli/tests/login.runtime.mjs:38— packages/cli/tests/login.runtime.mjs changed 13 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is (anonymous) at line 38), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): login and logout drop the old account's refresh outcome, so status stops saying refresh offline”; “fix(cli): routing disclosure names agent headers, OpenCode ids and the previous request's age”; “fix(cli): routing copy says it picks the model and effort and sends request facts”; “fix(cli): setup says what routing sends, before and after it turns on”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/login.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/wrap.runtime.mjs packages/cli/tests/wrap.runtime.mjs:290— packages/cli/tests/wrap.runtime.mjs changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is runWithProxyCapture at line 290), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): one own-endpoint check per agent for enable, wrap and doctor”; “fix(wrap): count the bare remote-control word only as the first argument”; “fix(wrap): detect Remote Control by its flag, not only the legacy subcommand”; “fix(release): verified releases, fail-closed installs, honest docs”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/wrap.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/routing.runtime.mjs packages/cli/tests/routing.runtime.mjs:10— packages/cli/tests/routing.runtime.mjs changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is (anonymous) at line 10), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): status stops saying routing skips subscription turns”; “fix(cli): routing disclosure names agent headers, OpenCode ids and the previous request's age”; “fix(cli): routing copy says it picks the model and effort and sends request facts”; “fix(cli): setup says what routing sends, before and after it turns on”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/routing.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/portable-command.runtime.mjs packages/cli/tests/portable-command.runtime.mjs:321— packages/cli/tests/portable-command.runtime.mjs changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is (anonymous) at line 321), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(hosts): launch an npm cmd shim that forwards to a native .exe”; “fix(cli): hooks, MCP servers and plugins name the node that outlives an upgrade”; “fix(cli): write node and npx's script into MCP configs on Windows”; “fix(delegate): launch every Windows shim the CLI can, and test parity”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/portable-command.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/learn-autopilot.runtime.mjs packages/cli/tests/learn-autopilot.runtime.mjs:393— packages/cli/tests/learn-autopilot.runtime.mjs changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is (anonymous) at line 393), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(learn): say 'per message on average' for recurring pasted blocks in nudge”; “fix(learn): plain words in terminal, TUI, trends and nudge output”; “fix(learn): make nudge claims token-owned and write in-flight first”; “fix(learn): gate autopilot on proxy learn capabilities”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/learn-autopilot.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/modules-index.runtime.mjs packages/cli/tests/modules-index.runtime.mjs:296— packages/cli/tests/modules-index.runtime.mjs changed 9 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is (anonymous) at line 296), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): onboarding shows the install's warnings as steps, not under its progress line”; “fix(cli): an empty install lock no longer holds launches for ten minutes”; “fix(cli): one runtime install at a time; restart only an idle runtime”; “fix(cli): keep the runtime restart quiet under onboarding's progress line”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/modules-index.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/src/modules/cloud.ts packages/cli/src/modules/cloud.ts:89— packages/cli/src/modules/cloud.ts changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is cloud.decisionsNote at line 89), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): routing disclosure names agent headers, OpenCode ids and the previous request's age”; “fix(cli): routing copy says it picks the model and effort and sends request facts”; “fix(cli): setup says what routing sends, before and after it turns on”; “fix(cli): `caveman on routing` says what routing sends when already signed in”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/src/modules/cloud.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/agent-shortcut.runtime.mjs packages/cli/tests/agent-shortcut.runtime.mjs:335— packages/cli/tests/agent-shortcut.runtime.mjs changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is (anonymous) at line 335), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): one own-endpoint check per agent for enable, wrap and doctor”; “fix(cli): close the gaps around an agent's own endpoint”; “fix(cli): respect explicit choices and clear stale Auto choices”; “fix(cli): the agent door wires nothing nobody agreed to”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/agent-shortcut.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: tests/test_mcp_shrink.js tests/test_mcp_shrink.js:353— tests/test_mcp_shrink.js changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is (anonymous) at line 353), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: resolve CodeQL alerts across engine, proxy and JS”; “fix(shrink): stop a NUL byte in a description forging a protected-segment sentinel”; “fix(shrink): keep "sure" inside the make/be/not collocations”; “fix(shrink): finish the shutdown sequence when the upstream ignores stdin EOF”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- tests/test_mcp_shrink.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/pi-extension/src/recovery.ts packages/pi-extension/src/recovery.ts:101— packages/pi-extension/src/recovery.ts changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is RecoveryClient.verify at line 101), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(pi): keep the thinking level when routing, accept promptless turns; 0.3.1”; “fix(hosts): hide the console window every host child opens on Windows”; “fix(pi): verify recovery before publishing elisions”; “fix(pi-extension): keep a broken hook candidate or a dead pipe from taking the host down”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/pi-extension/src/recovery.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: proxy/internal/store/source_claude.go proxy/internal/store/source_claude.go:45— proxy/internal/store/source_claude.go changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is claudeSessionSource.scanSession at line 45), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: resolve CodeQL alerts across engine, proxy and JS”; “fix(learn): attribute gateway-routed Claude Code turns to their vendor”; “fix(learn): count decoded tool_use blocks, not raw-line name substrings”; “fix(learn): recognize the Agent spawn tool at every site, not just the counter”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/store/source_claude.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: proxy/internal/gateway/route_cache.go proxy/internal/gateway/route_cache.go:326— proxy/internal/gateway/route_cache.go changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is releaseOnRead.Read at line 326), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): the OpenRouter provider pin is marshalled as one object”; “fix(proxy): record mode gets none of the cache mechanics; a refused key latches”; “fix(proxy): record mode and routing-off traffic are never keyed”; “fix(proxy): second review of the cache mechanics”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/internal/gateway/route_cache.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: engine/ccr/sqlite_file_security_linux.go engine/ccr/sqlite_file_security_linux.go:43— engine/ccr/sqlite_file_security_linux.go changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is ccr.chmodSQLiteFile at line 43), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ccr): detect Android by filesystem marker, not only ANDROID_ROOT”; “fix(ccr): gate fchmodat2 on Android so Termux can open the store”; “fix(ccr): detect Android from the system image, not only ANDROID_ROOT”; “fix(ccr): gate fchmodat2 on Android”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- engine/ccr/sqlite_file_security_linux.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/cli/tests/hooks.runtime.mjs packages/cli/tests/hooks.runtime.mjs:1474— packages/cli/tests/hooks.runtime.mjs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is (anonymous) at line 1474), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(hosts): hide the console window every host child opens on Windows”; “fix(cli): stop the shrink hook granting permission and dropping tool input”; “fix(codex): stop claiming a command rewrite Codex no longer gets”; “fix(codex): stop rewriting shell commands for Codex, breaks saved approval rules”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/cli/tests/hooks.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: proxy/providers/openaicompat/openaicompat.go proxy/providers/openaicompat/openaicompat.go:258— proxy/providers/openaicompat/openaicompat.go changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is namedAdapter.SanitizeAndMapHeaders at line 258), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(proxy): forward read-only GET /v1/models instead of 404ing it”; “fix(proxy): route a dialect mount's zone grammar through the one path rule”; “fix(proxy): compat-mount wire dialect for usage accounting and compression zones”; “fix(providers): strip hop-by-hop headers before adding this hop's credentials”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- proxy/providers/openaicompat/openaicompat.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: packages/pi-extension/tests/protocol.runtime.mjs packages/pi-extension/tests/protocol.runtime.mjs:28— packages/pi-extension/tests/protocol.runtime.mjs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is (anonymous) at line 28), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(pi): gate provider routing on the live listener, not a run-state file alone”; “fix(pi): per-model originals and compat-mount routing for custom providers”; “fix(pi): route only default provider endpoints (#972)”; “fix(pi): route opencode-go through compat mount”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 10:01:52 +02:00' --until='2026-10-24 10:01:52 +02:00' --full-history --no-merges -- packages/pi-extension/tests/protocol.runtime.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:121— `mkdtempSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:122— `mkdirSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:129— `spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:131— `cpSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:135— `readFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:137— `writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:139— `readFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:143— `writeFileSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:250— `spawnSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking extension/scripts/firefox-e2e.mjs:255— `rmSync` in `main` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:474— `readFileSync` in `callback to providersAdd` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:2594— `mkdirSync` in `skills` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:2595— `writeFileSync` in `skills` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:3235— `mkdirSync` in `setupInstallLocked` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:3238— `readdirSync` in `setupInstallLocked` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:3240— `unlinkSync` in `setupInstallLocked` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:3920— `unlinkSync` in `anonymous function` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:3930— `unlinkSync` in `anonymous function` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:6380— `spawnSync` in `agentShortcut` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:6406— `existsSync` in `agentShortcut` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:13149— `mkdirSync` in `syncPendingLocalScan` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:13150— `writeFileSync` in `syncPendingLocalScan` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:13217— `statSync` in `syncLocalSavings` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:13388— `readFileSync` in `syncLocalPracticeFindings` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking REDACTED:16558— `readFileSync` in `shrink` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Swallowed exception (caught, then discarded) agents/delegate/caveman-delegate-mcp.mjs:47— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) agents/delegate/caveman-delegate-mcp.mjs:166— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) browse/cmd/caveman-browse/main.go:282— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) browse/cmd/caveman-browse/main.go:292— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) browse/cmd/caveman-browse/main.go:302— `if err := json.NewDecoder(io.LimitReader(resp.Body, 64<<10)).Decode(&version); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/retrieve_query.go:232— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/detect.go:272— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/cmd/caveman-engine/main.go:613— `if err := json.Unmarshal(raw, &model); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/toon_encode.go:365— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/toon_encode.go:401— `if err := dec.Decode(&v); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/toon_decode.go:164— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/toon_decode.go:204— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/toon_decode.go:289— `if err := json.Unmarshal([]byte(s), &out); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/toolschema.go:102— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/tabular.go:193— `if err := writer.WriteAll(shaped); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/tabular.go:197— `if err := writer.Error(); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/json.go:101— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/invariants.go:836— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/html.go:48— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/config.go:179— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/code_nocgo.go:62— `if err := (&printer.Config{Mode: printer.TabIndent, Tabwidth: 8}).Fprint(&buf, fset, file); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/code_listing.go:102— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/compressors/axtree.go:597— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/image/image.go:170— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) engine/image/image.go:178— `if err := png.Encode(&buf, downscale(img, nw, nh)); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
+ 8 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×32
No test reaches this file scripts/probe-native-codex-recovery.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file packages/shared/contracts/conformance/run.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file packages/cli/src/native-hook-fast.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file src/plugins/opencode/plugin.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file packages/shared/contracts/scripts/validate-continuous-improvement.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file agents/drift-report.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file integrations/compile.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file agents/delegate/caveman-delegate-mcp.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file agents/probe-installed.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file engine/pixel/internal/atlasgen/gen-golden-anthropic.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file extension/scripts/build-extension-zip.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file engine/pixel/internal/atlasgen/gen-golden-openai.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file engine/pixel/internal/atlasgen/gen-golden.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file src/plugins/opencode/server.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file scripts/test-windows-compat.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file supabase/functions/blocks-telemetry/index.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file supabase/functions/cli-telemetry/index.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file packages/middleware/typescript/scripts/check-latest-in-range.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file extension/store-assets/flame.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file agents/version.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file packages/cli/scripts/compile-registries.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file extension/scripts/render-store-assets.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file packages/sdk/typescript/scripts/cjs-types.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file packages/cli/scripts/bundle-delegate.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
FileTooLong: REDACTED REDACTED— FileTooLong — 15410 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 14910 over it, 30.82× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1779 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1279 over it, 3.56× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: caveman_cloud/core.py packages/sdk/python/caveman_cloud/core.py— FileTooLong — 1702 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1202 over it, 3.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED packages/sdk/typescript/src/index.ts— FileTooLong — 1481 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 981 over it, 2.96× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1434 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: Server (10 blocks, 39-2290). The bar is 500 significant lines; this is 934 over it, 2.87× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: providers/adapter.go proxy/providers/adapter.go— FileTooLong — 1069 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 569 over it, 2.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: nativeruntime/runtime.go proxy/internal/nativeruntime/runtime.go— FileTooLong — 967 significant lines (blank, comment-only and punctuation-only lines excluded), about 71% of them inside a single declaration: Runtime (24 blocks, 102-1406). The bar is 500 significant lines; this is 467 over it, 1.93× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: cloudlink/link.go proxy/internal/cloudlink/link.go— FileTooLong — 958 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 458 over it, 1.92× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: gateway/route.go proxy/internal/gateway/route.go— FileTooLong — 923 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 423 over it, 1.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: store/learn.go proxy/internal/store/learn.go— FileTooLong — 905 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 405 over it, 1.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: caveman-proxy/main.go proxy/cmd/caveman-proxy/main.go— FileTooLong — 898 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 398 over it, 1.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: middleware/runtime.py packages/sdk/python/caveman_cloud/middleware/runtime.py— FileTooLong — 735 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 235 over it, 1.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: translate/translate.go proxy/internal/translate/translate.go— FileTooLong — 716 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 216 over it, 1.43× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: caveman_middleware/llama_index.py packages/middleware/python/caveman_middleware/llama_index.py— FileTooLong — 709 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 209 over it, 1.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: scripts/compress.py plugins/caveman/skills/caveman-compress/scripts/compress.py— FileTooLong — 692 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 192 over it, 1.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: scripts/compress.py skills/caveman-compress/scripts/compress.py— FileTooLong — 692 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 192 over it, 1.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: modules/onboard.ts packages/cli/src/modules/onboard.ts— FileTooLong — 611 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 111 over it, 1.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: translate/messages_in.go proxy/internal/translate/messages_in.go— FileTooLong — 585 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 85 over it, 1.17× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 549 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 49 over it, 1.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: translate/responses_stream.go proxy/internal/translate/responses_stream.go— FileTooLong — 548 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 48 over it, 1.10× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: repointel/index.go proxy/internal/repointel/index.go— FileTooLong — 543 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 43 over it, 1.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: gateway/chatgpt.go proxy/internal/gateway/chatgpt.go— FileTooLong — 535 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 35 over it, 1.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: store/trial_store.go proxy/internal/store/trial_store.go— FileTooLong — 527 significant lines (blank, comment-only and punctuation-only lines excluded), about 74% of them inside a single declaration: Store (17 blocks, 43-719). The bar is 500 significant lines; this is 27 over it, 1.05× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 521 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 21 over it, 1.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: caveman-engine/main.go engine/cmd/caveman-engine/main.go— FileTooLong — 518 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 18 over it, 1.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
Duplicated block (7 lines × 2) proxy/internal/gateway/retrieve_tool.go:953— proxy/internal/gateway/retrieve_tool.go:953-959 | proxy/internal/gateway/retrieve_tool.go:1007-1013 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:953` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `proxy/internal/gateway/retrieve_tool.go:960` calls `parseRetrieveCall` and `proxy/internal/gateway/retrieve_tool.go:1014` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) proxy/internal/translate/chat_in.go:143— proxy/internal/translate/chat_in.go:143-149 | proxy/internal/translate/chat_in.go:350-356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/chat_in.go:143` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) proxy/internal/translate/chat_in.go:267— proxy/internal/translate/chat_in.go:267-273 | proxy/internal/translate/chat_in.go:518-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) engine/cmd/caveman-engine/main.go:631— engine/cmd/caveman-engine/main.go:631-637 | engine/toon.go:12-18 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) engine/compressors/toolschema.go:179— engine/compressors/toolschema.go:179-185 | engine/pixel/transform_anthropic.go:1452-1458 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) proxy/providers/adapter.go:1707— proxy/providers/adapter.go:1707-1713 | proxy/providers/bedrock/signing.go:240-246 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) proxy/providers/anthropic/content_compress.go:259— proxy/providers/anthropic/content_compress.go:259-265 | proxy/providers/openai/content_compress.go:456-462 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) proxy/providers/anthropic/content_compress.go:380— proxy/providers/anthropic/content_compress.go:380-386 | proxy/providers/openai/content_compress.go:440-446 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) proxy/internal/store/learn_attribution.go:331— proxy/internal/store/learn_attribution.go:331-337 | proxy/internal/store/learn_digest.go:107-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `s *Store) BuildLearnSavings(cwd` in one and `s *Store) BuildLearnDigest(cwd` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 2) proxy/internal/gateway/retrieve_tool.go:441— proxy/internal/gateway/retrieve_tool.go:441-447 | proxy/internal/gateway/retrieve_tool.go:462-469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:441` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) proxy/internal/gateway/retrieve_tool.go:412— proxy/internal/gateway/retrieve_tool.go:412-418 | proxy/internal/gateway/retrieve_tool.go:437-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:412` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) proxy/internal/gateway/retrieve_tool.go:736— proxy/internal/gateway/retrieve_tool.go:736-742 | proxy/internal/gateway/retrieve_tool.go:781-787 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:736` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) proxy/internal/translate/messages_in.go:526— proxy/internal/translate/messages_in.go:526-532 | proxy/internal/translate/messages_in.go:810-816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/messages_in.go:526` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) proxy/internal/translate/messages_in.go:355— proxy/internal/translate/messages_in.go:355-361 | proxy/internal/translate/messages_in.go:700-706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/messages_in.go:355` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) proxy/internal/store/source_gemini.go:22— proxy/internal/store/source_gemini.go:22-28 | proxy/internal/store/source_opencode.go:23-29 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_gemini.go:22` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) engine/compressors/toon_encode.go:153— engine/compressors/toon_encode.go:153-159 | engine/compressors/toon_encode.go:170-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) plugins/caveman/skills/caveman-compress/scripts/detect.py:124— plugins/caveman/skills/caveman-compress/scripts/detect.py:124-130 | skills/caveman-compress/scripts/detect.py:124-130 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/detect.py` and `skills/caveman-compress/scripts/detect.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
FunctionTooLong: install.uninstall REDACTED:2145— FunctionTooLong — uninstall runs 318 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 218 over it, 3.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: install.installOpencode REDACTED:1505— FunctionTooLong — installOpencode runs 155 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 55 over it, 1.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: main.runServe proxy/cmd/caveman-proxy/main.go:201— FunctionTooLong — runServe runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: index.default packages/pi-extension/src/index.ts:112— FunctionTooLong — default runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: compressors.summarizeElided engine/compressors/invariants.go:207— FunctionTooLong — summarizeElided runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: onboard.onboard packages/cli/src/modules/onboard.ts:123— FunctionTooLong — onboard runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mastra.createProcessor packages/middleware/typescript/src/mastra.ts:141— FunctionTooLong — createProcessor runs 127 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: probe-native-codex-recovery.upstream scripts/probe-native-codex-recovery.mjs:198— FunctionTooLong — upstream runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: run.measureHarness packages/subagent-tax/run.mjs:154— FunctionTooLong — measureHarness runs 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: caveman-activate.run src/hooks/caveman-activate.js:392— FunctionTooLong — run runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: install.installHooks REDACTED:1775— FunctionTooLong — installHooks runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: translate.chatResponsesBody proxy/internal/translate/chat_in.go:317— FunctionTooLong — chatResponsesBody runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: index.assemble packages/sdk/typescript/src/index.ts:1818— FunctionTooLong — assemble runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: caveman-mode-tracker.handle src/hooks/caveman-mode-tracker.js:142— FunctionTooLong — handle runs 106 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 6 over it, 1.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: main.runLearn proxy/cmd/caveman-proxy/main.go:823— FunctionTooLong — runLearn runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: translate.streamChatToResponses proxy/internal/translate/responses_stream.go:657— FunctionTooLong — streamChatToResponses runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
X2 · Cancellation propagation· Async function without AbortSignal · ×16
Async function without AbortSignal: syncPendingLocalScan packages/cli/dist/index.js:13179— `syncPendingLocalScan` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: syncLocalSavings packages/cli/dist/index.js:13281— `syncLocalSavings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: syncLocalPracticeFindings packages/cli/dist/index.js:13453— `syncLocalPracticeFindings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: auditImport packages/cli/dist/index.js:21077— `auditImport` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: auditEvalImport packages/cli/dist/index.js:21102— `auditEvalImport` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: get packages/cli/dist/index.js:21869— `get` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: post packages/cli/dist/index.js:21884— `post` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: syncPendingLocalScan REDACTED:13107— `syncPendingLocalScan` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: syncLocalSavings REDACTED:13214— `syncLocalSavings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: syncLocalPracticeFindings REDACTED:13384— `syncLocalPracticeFindings` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: auditImport REDACTED:20986— `auditImport` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: auditEvalImport REDACTED:21010— `auditEvalImport` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: get REDACTED:21731— `get` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: post REDACTED:21747— `post` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: latestRelease packages/middleware/typescript/scripts/check-latest-in-range.mjs:44— `latestRelease` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: call packages/shared/contracts/conformance/run.mjs:106— `call` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Duplicated block (10 lines × 2) browse/cdp.go:165— browse/cdp.go:165-174 | browse/cdp.go:177-186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) REDACTED:290— REDACTED:290-299 | REDACTED:308-317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:290` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) REDACTED:605— REDACTED:605-614 | REDACTED:773-782 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) proxy/internal/store/detect_reread.go:150— proxy/internal/store/detect_reread.go:150-159 | proxy/internal/store/detect_subagent_spend.go:157-166 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) proxy/internal/store/usage_import.go:238— proxy/internal/store/usage_import.go:238-247 | proxy/internal/store/usage_import.go:326-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/usage_import.go:238` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) proxy/internal/translate/messages_in.go:313— proxy/internal/translate/messages_in.go:313-322 | proxy/internal/translate/messages_in.go:657-666 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/messages_in.go:313` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) proxy/providers/bedrock/cache_points.go:216— proxy/providers/bedrock/cache_points.go:216-225 | proxy/providers/bedrock/cache_points.go:249-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/bedrock/cache_points.go:216` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `proxy/providers/bedrock/cache_points.go:228` calls `Field` and `proxy/providers/bedrock/cache_points.go:259` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) REDACTED:80— REDACTED:80-89 | proxy/internal/store/store.go:360-369 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Check import visibility before settling on that home: `proxy/internal/store/store.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (10 lines × 2) engine/cmd/caveman-engine/main.go:254— engine/cmd/caveman-engine/main.go:254-263 | shrink/cmd/caveman-shrink/main.go:86-95 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `shrink/cmd/caveman-shrink/main.go:82` calls `Marshal`, `Fprintln` and `engine/cmd/caveman-engine/main.go:251` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) proxy/providers/adapter.go:1171— proxy/providers/adapter.go:1171-1180 | shared/platform/catalog/catalog.go:345-354 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) proxy/internal/store/store.go:1104— proxy/internal/store/store.go:1104-1113 | proxy/providers/azureopenai/azure_routing.go:88-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/store.go:1104` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Check import visibility before settling on that home: `proxy/internal/store/store.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (10 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:129— plugins/caveman/skills/caveman-compress/scripts/compress.py:129-138 | skills/caveman-compress/scripts/compress.py:129-138 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:488— plugins/caveman/skills/caveman-compress/scripts/compress.py:488-497 | skills/caveman-compress/scripts/compress.py:488-497 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:347— plugins/caveman/skills/caveman-compress/scripts/validate.py:347-356 | skills/caveman-compress/scripts/validate.py:347-356 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) proxy/internal/gateway/metadata_route.go:57— proxy/internal/gateway/metadata_route.go:57-64 | REDACTED:593-600 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) proxy/internal/store/source_codex.go:140— proxy/internal/store/source_codex.go:140-147 | proxy/internal/store/source_gemini.go:123-130 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_codex.go:140` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) proxy/internal/store/source_opencode.go:172— proxy/internal/store/source_opencode.go:172-179 | proxy/internal/store/source_opencode.go:214-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_opencode.go:172` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) proxy/internal/translate/chat_in.go:255— proxy/internal/translate/chat_in.go:255-262 | proxy/internal/translate/chat_in.go:506-513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/chat_in.go:255` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) proxy/providers/anthropic/content_compress.go:369— proxy/providers/anthropic/content_compress.go:369-376 | proxy/providers/openai/content_compress.go:429-436 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) proxy/providers/jsonsplice/jsonsplice.go:302— proxy/providers/jsonsplice/jsonsplice.go:302-309 | proxy/providers/openai/content_compress.go:633-640 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 2) proxy/providers/bedrock/routing.go:526— proxy/providers/bedrock/routing.go:526-533 | proxy/providers/vertex/routing.go:182-189 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) proxy/internal/gateway/retrieve_tool.go:431— proxy/internal/gateway/retrieve_tool.go:431-438 | proxy/internal/gateway/retrieve_tool.go:473-480 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:431` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) packages/middleware/python/caveman_middleware/_native.py:332— packages/middleware/python/caveman_middleware/_native.py:332-339 | packages/middleware/python/caveman_middleware/strands.py:115-122 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `packages/middleware/python/caveman_middleware/_native.py:331` calls `enumerate` and `packages/middleware/python/caveman_middleware/strands.py:114` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) packages/middleware/python/caveman_middleware/agno.py:86— packages/middleware/python/caveman_middleware/agno.py:86-93 | packages/middleware/python/caveman_middleware/langchain.py:83-90 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) packages/sdk/python/caveman_cloud/core.py:514— packages/sdk/python/caveman_cloud/core.py:514-521 | packages/sdk/python/caveman_cloud/core.py:523-530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:97— plugins/caveman/skills/caveman-compress/scripts/compress.py:97-104 | skills/caveman-compress/scripts/compress.py:97-104 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:142— plugins/caveman/skills/caveman-compress/scripts/compress.py:142-149 | skills/caveman-compress/scripts/compress.py:142-149 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:501— plugins/caveman/skills/caveman-compress/scripts/compress.py:501-508 | skills/caveman-compress/scripts/compress.py:501-508 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) engine/compressors/diff.go:30— engine/compressors/diff.go:30-40 | engine/compressors/searchresult.go:45-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `engine/compressors/diff.go:30` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) engine/compressors/toon_decode.go:101— engine/compressors/toon_decode.go:101-111 | engine/compressors/toon_decode.go:113-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/compressors/toon_decode.go:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) REDACTED:81— REDACTED:81-91 | REDACTED:99-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (11 lines × 2) proxy/internal/store/source_gemini.go:36— proxy/internal/store/source_gemini.go:36-46 | proxy/internal/store/source_opencode.go:37-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_gemini.go:36` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) proxy/internal/translate/messages_in.go:341— proxy/internal/translate/messages_in.go:341-351 | proxy/internal/translate/messages_in.go:687-697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/messages_in.go:341` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) proxy/providers/anthropic/cache_breakpoints.go:119— proxy/providers/anthropic/cache_breakpoints.go:119-129 | proxy/providers/bedrock/cache_points.go:240-250 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/cache_breakpoints.go:119` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) proxy/providers/anthropic/content_compress.go:278— proxy/providers/anthropic/content_compress.go:278-288 | proxy/providers/openai/content_compress.go:282-292 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/content_compress.go:278` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) engine/cmd/caveman-engine/main.go:641— engine/cmd/caveman-engine/main.go:641-651 | engine/toon.go:21-31 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) REDACTED:1296— REDACTED:1296-1306 | proxy/internal/store/store.go:1077-1087 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) engine/evals/quality.go:151— engine/evals/quality.go:151-161 | engine/evals/quality.go:165-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/evals/quality.go:151` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) packages/middleware/python/caveman_middleware/llama_index.py:597— packages/middleware/python/caveman_middleware/llama_index.py:597-607 | packages/middleware/python/caveman_middleware/llama_index.py:631-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:596— plugins/caveman/skills/caveman-compress/scripts/compress.py:596-606 | skills/caveman-compress/scripts/compress.py:596-606 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) browse/cdp.go:195— browse/cdp.go:195-199 | browse/cdp.go:213-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `browse/cdp.go:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) engine/compressors/relevance.go:36— engine/compressors/relevance.go:36-40 | engine/contextwindow/contextwindow.go:123-127 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `engine/compressors/relevance.go:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) proxy/internal/gateway/compression_query.go:52— proxy/internal/gateway/compression_query.go:52-56 | proxy/internal/gateway/compression_query.go:85-89 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/compression_query.go:52` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) proxy/internal/store/learn_experiment.go:132— proxy/internal/store/learn_experiment.go:132-136 | proxy/internal/store/learn_experiment.go:149-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) proxy/providers/anthropic/cache_breakpoints.go:27— proxy/providers/anthropic/cache_breakpoints.go:27-31 | proxy/providers/openai/cache_key.go:43-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) proxy/providers/anthropic/splice.go:217— proxy/providers/anthropic/splice.go:217-221 | proxy/providers/openai/content_compress.go:646-650 — before extracting anything, compare `proxy/providers/anthropic/splice.go` and `proxy/providers/openai/content_compress.go` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/splice.go:217` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) REDACTED:170— REDACTED:170-174 | REDACTED:225-229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) packages/middleware/python/caveman_middleware/agno.py:145— packages/middleware/python/caveman_middleware/agno.py:145-149 | packages/middleware/python/caveman_middleware/agno.py:157-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) packages/middleware/python/caveman_middleware/google.py:507— packages/middleware/python/caveman_middleware/google.py:507-511 | packages/middleware/python/caveman_middleware/google.py:546-550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:121— plugins/caveman/skills/caveman-compress/scripts/compress.py:121-125 | skills/caveman-compress/scripts/compress.py:121-125 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:319— plugins/caveman/skills/caveman-compress/scripts/validate.py:319-323 | skills/caveman-compress/scripts/validate.py:319-323 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
MethodTooLong: Server.proxy REDACTED:107— MethodTooLong — proxy runs 582 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 482 over it, 5.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Server.chatgpt proxy/internal/gateway/chatgpt.go:54— MethodTooLong — chatgpt runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Store.BuildStatsReport proxy/internal/store/stats.go:198— MethodTooLong — BuildStatsReport runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Server.chatGPTAuto proxy/internal/gateway/chatgpt_auto.go:164— MethodTooLong — chatGPTAuto runs 161 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Server.rewriteRequest REDACTED:1523— MethodTooLong — rewriteRequest runs 152 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Runtime.writeReceipt proxy/internal/nativeruntime/receipt.go:38— MethodTooLong — writeReceipt runs 148 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 48 over it, 1.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Server.record REDACTED:1865— MethodTooLong — record runs 127 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Runtime.ServeHTTP proxy/internal/middleware/http.go:48— MethodTooLong — ServeHTTP runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Store.buildLearnPlan proxy/internal/store/learn.go:171— MethodTooLong — buildLearnPlan runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Runtime.respond proxy/internal/nativeruntime/runtime.go:301— MethodTooLong — respond runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (6 lines × 2) proxy/internal/gateway/chatgpt.go:655— proxy/internal/gateway/chatgpt.go:655-660 | proxy/internal/gateway/chatgpt.go:673-678 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/chatgpt.go:655` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `proxy/internal/gateway/chatgpt.go:679` calls `appendEvent` and `proxy/internal/gateway/chatgpt.go:661` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) proxy/internal/gateway/retrieve_tool.go:930— proxy/internal/gateway/retrieve_tool.go:930-935 | proxy/internal/gateway/retrieve_tool.go:948-953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:930` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) proxy/internal/translate/messages_in.go:467— proxy/internal/translate/messages_in.go:467-472 | proxy/internal/translate/messages_in.go:767-772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) proxy/internal/gateway/retrieve_tool.go:646— proxy/internal/gateway/retrieve_tool.go:646-651 | proxy/providers/adapter.go:1654-1659 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Check import visibility before settling on that home: `proxy/internal/gateway/retrieve_tool.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (6 lines × 2) proxy/providers/anthropic/content_compress.go:272— proxy/providers/anthropic/content_compress.go:272-277 | proxy/providers/openai/content_compress.go:276-281 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/content_compress.go:272` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) REDACTED:585— REDACTED:585-590 | REDACTED:605-610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:585` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) packages/middleware/python/caveman_middleware/_httpx2.py:109— packages/middleware/python/caveman_middleware/_httpx2.py:109-114 | packages/middleware/python/caveman_middleware/_httpx2.py:145-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:383— plugins/caveman/skills/caveman-compress/scripts/validate.py:383-388 | skills/caveman-compress/scripts/validate.py:383-388 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) packages/middleware/python/caveman_middleware/agno.py:540— packages/middleware/python/caveman_middleware/agno.py:540-545 | packages/middleware/python/caveman_middleware/agno.py:571-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) proxy/internal/store/source_claude.go:46— proxy/internal/store/source_claude.go:46-58 | proxy/internal/store/source_codex.go:38-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (13 lines × 2) proxy/providers/anthropic/cache_breakpoints.go:102— proxy/providers/anthropic/cache_breakpoints.go:102-114 | proxy/providers/bedrock/cache_points.go:219-231 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/cache_breakpoints.go:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) proxy/providers/anthropic/frozen.go:49— proxy/providers/anthropic/frozen.go:49-61 | proxy/providers/anthropic/frozen.go:85-97 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/frozen.go:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) proxy/providers/anthropic/splice.go:23— proxy/providers/anthropic/splice.go:23-35 | proxy/providers/openai/content_compress.go:465-477 — before extracting anything, compare `proxy/providers/anthropic/splice.go` and `proxy/providers/openai/content_compress.go` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) engine/cmd/caveman-engine/main.go:347— engine/cmd/caveman-engine/main.go:347-359 | engine/cmd/caveman-engine/main.go:531-543 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/cmd/caveman-engine/main.go:347` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) proxy/providers/anthropic/content_compress.go:290— proxy/providers/anthropic/content_compress.go:290-302 | proxy/providers/openai/content_compress.go:295-307 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/content_compress.go:290` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) plugins/caveman/skills/caveman-compress/scripts/detect.py:62— plugins/caveman/skills/caveman-compress/scripts/detect.py:62-74 | skills/caveman-compress/scripts/detect.py:62-74 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/detect.py` and `skills/caveman-compress/scripts/detect.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:395— plugins/caveman/skills/caveman-compress/scripts/validate.py:395-407 | skills/caveman-compress/scripts/validate.py:395-407 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) browse/cmd/caveman-browse/main.go:108— browse/cmd/caveman-browse/main.go:108-119 | mcp/cmd/caveman-mcp/main.go:73-84 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `browse/cmd/caveman-browse/main.go:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `mcp/cmd/caveman-mcp/main.go:85` calls `MkdirAll`, `Errorf` and `browse/cmd/caveman-browse/main.go:120` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) REDACTED:419— REDACTED:419-430 | REDACTED:444-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:419` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (12 lines × 2) engine/compressors/toolschema_annotations.go:147— engine/compressors/toolschema_annotations.go:147-158 | engine/compressors/toolschema_annotations.go:200-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/compressors/toolschema_annotations.go:147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) proxy/internal/gateway/retrieve_tool.go:708— proxy/internal/gateway/retrieve_tool.go:708-719 | proxy/providers/openai/cache_key.go:140-151 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Check import visibility before settling on that home: `proxy/internal/gateway/retrieve_tool.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (12 lines × 2) proxy/internal/store/trial_store.go:137— proxy/internal/store/trial_store.go:137-148 | proxy/internal/store/trial_store.go:179-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/trial_store.go:137` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) proxy/providers/anthropic/content_compress.go:145— proxy/providers/anthropic/content_compress.go:145-156 | proxy/providers/openai/content_compress.go:58-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/content_compress.go:145` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) evals/plot.py:90— evals/plot.py:90-101 | evals/plot.py:142-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `evals/plot.py:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:53— plugins/caveman/skills/caveman-compress/scripts/compress.py:53-64 | skills/caveman-compress/scripts/compress.py:53-64 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) engine/compressors/json.go:83— engine/compressors/json.go:83-91 | engine/compressors/toolschema.go:92-100 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) proxy/internal/store/source_opencode.go:155— proxy/internal/store/source_opencode.go:155-163 | proxy/internal/store/source_opencode.go:193-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_opencode.go:155` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) proxy/providers/jsonsplice/jsonsplice.go:193— proxy/providers/jsonsplice/jsonsplice.go:193-201 | proxy/providers/jsonsplice/jsonsplice.go:234-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/jsonsplice/jsonsplice.go:193` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `proxy/providers/jsonsplice/jsonsplice.go:189` calls `WriteByte`, `Write` and `proxy/providers/jsonsplice/jsonsplice.go:231` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) proxy/internal/cloudlink/link.go:1503— proxy/internal/cloudlink/link.go:1503-1511 | proxy/internal/gateway/route.go:527-535 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) proxy/internal/translate/chat_in.go:53— proxy/internal/translate/chat_in.go:53-61 | proxy/internal/translate/responses_in.go:89-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/chat_in.go:53` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) proxy/internal/gateway/retrieve_tool.go:755— proxy/internal/gateway/retrieve_tool.go:755-763 | proxy/internal/gateway/retrieve_tool.go:808-816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:755` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) packages/middleware/python/caveman_middleware/llama_index.py:496— packages/middleware/python/caveman_middleware/llama_index.py:496-504 | packages/middleware/python/caveman_middleware/llama_index.py:515-523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) plugins/caveman/skills/caveman-compress/scripts/benchmark.py:26— plugins/caveman/skills/caveman-compress/scripts/benchmark.py:26-34 | skills/caveman-compress/scripts/benchmark.py:26-34 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/benchmark.py` and `skills/caveman-compress/scripts/benchmark.py` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Boundary violation [package:relative-cross-package] packages/cli/scripts/gen-modules-index.mjs:14— packages/cli/scripts/gen-modules-index.mjs:14 reaches into another package with a relative path (../../../scripts/build-release-binaries.mjs) — import the package by name instead.
Boundary violation [package:test-cross-package-internals] packages/middleware/typescript/tests/recovery-errors.test.mjs:147— packages/middleware/typescript/tests/recovery-errors.test.mjs:147 reaches past another workspace package's public entry into its internals with a relative path (../dist/common.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
Boundary violation [package:relative-cross-package] packages/pi-extension/src/index.ts:1— packages/pi-extension/src/index.ts:1 reaches into another package with a relative path (../../cli/src/provider-routing.ts) — import the package by name instead.
Boundary violation [package:relative-cross-package] packages/pi-extension/src/portable-command.ts:18— packages/pi-extension/src/portable-command.ts:18 reaches into another package with a relative path (../../cli/src/portable-command.ts) — import the package by name instead.
Boundary violation [package:relative-cross-package] packages/pi-extension/src/protocol.ts:1— packages/pi-extension/src/protocol.ts:1 reaches into another package with a relative path (../../cli/src/provider-routing.ts) — import the package by name instead.
Boundary violation [package:relative-cross-package] packages/pi-extension/src/provider.ts:7— packages/pi-extension/src/provider.ts:7 reaches into another package with a relative path (../../cli/src/provider-routing.ts) — import the package by name instead.
Boundary violation [package:third-party-deep-import] packages/shared/contracts/scripts/validate-continuous-improvement.mjs:4— packages/shared/contracts/scripts/validate-continuous-improvement.mjs:4 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] packages/shared/contracts/scripts/validate-schemas.mjs:4— packages/shared/contracts/scripts/validate-schemas.mjs:4 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Swallowed exception (empty catch) agents/delegate/portable-process.mjs:128— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) agents/delegate/caveman-delegate-mcp.mjs:34— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) agents/delegate/caveman-delegate-mcp.mjs:58— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) agents/delegate/caveman-delegate-mcp.mjs:78— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) agents/delegate/caveman-delegate-mcp.mjs:93— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) agents/delegate/caveman-delegate-mcp.mjs:102— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) agents/delegate/caveman-delegate-mcp.mjs:167— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
TooManyMethods: Store proxy/internal/store/store.go:35— TooManyMethods — 85 methods, declared across 18 files: store/trial_store.go (17), store/learn.go (16), store/store.go (12), store/middleware.go (8), +14 more file(s). The bar is 30 methods; this is 55 over it, 2.83× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Server proxy/internal/gateway/server.go:349— TooManyMethods — 58 methods, declared across 16 files: REDACTED (10), gateway/server.go (10), gateway/raw_pin.go (7), gateway/breakpoint_plan.go (4), +12 more file(s). The bar is 30 methods; this is 28 over it, 1.93× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MiddlewareRuntime packages/sdk/python/caveman_cloud/middleware/runtime.py:196— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CavemanLiteLLM packages/middleware/python/caveman_middleware/litellm.py:59— TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: CavemanLLM packages/middleware/python/caveman_middleware/llama_index.py:367— TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Link proxy/internal/cloudlink/link.go:80— TooManyMethods — 32 methods, declared across 3 files: cloudlink/link.go (22), cloudlink/events.go (5), cloudlink/warm.go (5). The bar is 30 methods; this is 2 over it, 1.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (16 lines × 2) proxy/internal/store/learn_outcomes.go:309— proxy/internal/store/learn_outcomes.go:309-324 | proxy/internal/store/learn_portfolio.go:142-157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/learn_outcomes.go:309` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) proxy/internal/store/learn_retro.go:649— proxy/internal/store/learn_retro.go:649-664 | proxy/internal/store/learn_retro.go:735-750 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/learn_retro.go:649` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) REDACTED:187— REDACTED:187-202 | REDACTED:238-253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) proxy/internal/store/trial_store.go:96— proxy/internal/store/trial_store.go:96-112 | proxy/internal/store/trial_store.go:152-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/trial_store.go:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (16 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:201— plugins/caveman/skills/caveman-compress/scripts/compress.py:201-216 | skills/caveman-compress/scripts/compress.py:201-216 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:327— plugins/caveman/skills/caveman-compress/scripts/validate.py:327-342 | skills/caveman-compress/scripts/validate.py:327-342 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
AC3 · Page structure· Page without a main landmark · ×5
Page without a main landmark extension/popup.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark extension/scripts/firefox-e2e.mjs:147— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark extension/store-assets/compare.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark extension/store-assets/listing.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark extension/store-assets/promo.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Duplicated block (15 lines × 2) engine/compressors/searchresult.go:57— engine/compressors/searchresult.go:57-71 | engine/compressors/text.go:63-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `engine/compressors/searchresult.go:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) proxy/internal/store/middleware.go:546— proxy/internal/store/middleware.go:546-560 | proxy/internal/store/middleware_postgres.go:319-333 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/middleware.go:546` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (15 lines × 2) proxy/providers/bedrock/cache_points.go:175— proxy/providers/bedrock/cache_points.go:175-189 | proxy/providers/bedrock/cache_points.go:192-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/bedrock/cache_points.go:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) proxy/providers/jsonsplice/jsonsplice.go:163— proxy/providers/jsonsplice/jsonsplice.go:163-177 | proxy/providers/jsonsplice/jsonsplice.go:210-224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/jsonsplice/jsonsplice.go:163` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:346— plugins/caveman/skills/caveman-compress/scripts/compress.py:346-360 | skills/caveman-compress/scripts/compress.py:346-360 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/caveman/skills/caveman-compress/scripts/compress.py:346` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×4
Animation without a prefers-reduced-motion guard extension/popup.css:156— `.slider::before` moves (`transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard extension/popup.css:293— `.review` moves (`transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard extension/popup.css:318— `.review .review-arrow` moves (`transition: transform 0.15s ease, color 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard extension/src/indicator.css:30— `#caveman-indicator` moves (`transition: transform 0.16s ease, border-color 0.16s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
TooManyFields: RequestRecord proxy/internal/gateway/server.go:218— TooManyFields — 78 stored fields. The bar is 30 stored fields; this is 48 over it, 2.60× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Link proxy/internal/cloudlink/link.go:80— TooManyFields — 38 stored fields beside 32 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Server proxy/internal/gateway/server.go:349— TooManyFields — 35 stored fields beside 58 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: StatsMetrics proxy/internal/store/stats.go:34— TooManyFields — 32 stored fields beside 1 method. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
Duplicated block (22 lines × 2) proxy/providers/anthropic/splice.go:80— proxy/providers/anthropic/splice.go:80-101 | proxy/providers/openai/content_compress.go:522-543 — before extracting anything, compare `proxy/providers/anthropic/splice.go` and `proxy/providers/openai/content_compress.go` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (22 lines × 2) proxy/providers/anthropic/splice.go:224— proxy/providers/anthropic/splice.go:224-245 | proxy/providers/openai/content_compress.go:653-674 — before extracting anything, compare `proxy/providers/anthropic/splice.go` and `proxy/providers/openai/content_compress.go` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/splice.go:224` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:360— plugins/caveman/skills/caveman-compress/scripts/validate.py:360-381 | skills/caveman-compress/scripts/validate.py:360-381 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:450— plugins/caveman/skills/caveman-compress/scripts/compress.py:450-471 | skills/caveman-compress/scripts/compress.py:450-471 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2 locations) REDACTED:17000— REDACTED:17000 · packages/cli/src/native-hook-fast.ts:215 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) REDACTED:17151— REDACTED:17151 · packages/cli/src/native-hook-fast.ts:339 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) REDACTED:20179— REDACTED:20179 · REDACTED:20196 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) src/plugins/opencode/plugin.js:62— src/plugins/opencode/plugin.js:62 · src/plugins/opencode/plugin.js:120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X2 · Cancellation propagation· Function without context.Context · ×4
Function without context.Context: warmCall proxy/internal/cloudlink/warm.go:136— `warmCall` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: ask proxy/internal/cloudlink/link.go:1111— `ask` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: call proxy/internal/cloudlink/events.go:279— `call` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: fetchClaudeUsageJSON proxy/internal/store/usage_import.go:124— `fetchClaudeUsageJSON` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Duplicated block (28 lines × 2) engine/compressors/toolschema_annotations.go:323— engine/compressors/toolschema_annotations.go:323-350 | proxy/providers/jsonsplice/jsonsplice.go:246-273 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (28 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:517— plugins/caveman/skills/caveman-compress/scripts/compress.py:517-544 | skills/caveman-compress/scripts/compress.py:517-544 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:718— plugins/caveman/skills/caveman-compress/scripts/compress.py:718-745 | skills/caveman-compress/scripts/compress.py:718-745 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) proxy/internal/store/source_claude.go:25— proxy/internal/store/source_claude.go:25-38 | proxy/internal/store/source_pi.go:25-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_claude.go:25` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) proxy/internal/store/source_claude.go:56— proxy/internal/store/source_claude.go:56-69 | proxy/internal/store/source_pi.go:61-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_claude.go:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) proxy/providers/adapter.go:1185— proxy/providers/adapter.go:1185-1198 | proxy/providers/bedrock/usage.go:593-606 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Low cohesion: MiddlewareTx (LCOM4 5) proxy/internal/store/middleware.go:340— MiddlewareTx's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Config (LCOM4 4) proxy/internal/config/config.go:33— Config's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Base (LCOM4 4) proxy/providers/adapter.go:444— Base's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Duplicated block (13 lines × 2 locations) agents/compile.mjs:538— agents/compile.mjs:538 · integrations/compile.mjs:133 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (13 lines × 2 locations) REDACTED:3031— REDACTED:3031 · packages/shared/binary-installer/installer.mjs:103 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (13 lines × 2 locations) packages/subagent-tax/lib/analyze.mjs:25— packages/subagent-tax/lib/analyze.mjs:25 · packages/subagent-tax/lib/analyze.mjs:51 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2 locations) REDACTED:17781— REDACTED:17781 · REDACTED:18469 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) packages/sdk/typescript/src/index.ts:1882— packages/sdk/typescript/src/index.ts:1882 · packages/sdk/typescript/src/index.ts:1894 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) src/hooks/caveman-activate.js:34— src/hooks/caveman-activate.js:34 · src/hooks/caveman-mode-tracker.js:17 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R4 · Test Coverage· This test file cannot be loaded · ×3
This test file cannot be loaded packages/middleware/typescript/tests/required.mjs:4— packages/middleware/typescript/tests/required.mjs:4 imports './', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/middleware/typescript/tests/versions.test.mjs:162— packages/middleware/typescript/tests/versions.test.mjs:162 imports '../src/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
This test file cannot be loaded packages/pi-extension/tests/provider.runtime.mjs:9— packages/pi-extension/tests/provider.runtime.mjs:9 imports './core/provider-attribution.js', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
ingest.toRow (cyclomatic 42) supabase/functions/cli-telemetry/ingest.ts:89— ingest.toRow has cyclomatic complexity 42 (threshold 15). Of this number, 41 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ingest.toRow (cyclomatic 42) supabase/functions/blocks-telemetry/ingest.ts:124— ingest.toRow has cyclomatic complexity 42 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
compress._compress_file_locked (cyclomatic 24) plugins/caveman/skills/caveman-compress/scripts/compress.py:932— compress._compress_file_locked has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compress._compress_file_locked (cyclomatic 24) skills/caveman-compress/scripts/compress.py:932— compress._compress_file_locked has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compress.mask_code_blocks (cyclomatic 20) plugins/caveman/skills/caveman-compress/scripts/compress.py:807— compress.mask_code_blocks has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compress.mask_code_blocks (cyclomatic 20) skills/caveman-compress/scripts/compress.py:807— compress.mask_code_blocks has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validate.extract_indented_code_blocks (cyclomatic 18) plugins/caveman/skills/caveman-compress/scripts/validate.py:121— validate.extract_indented_code_blocks has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validate.extract_indented_code_blocks (cyclomatic 18) skills/caveman-compress/scripts/validate.py:121— validate.extract_indented_code_blocks has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TodoComment plugins/caveman/skills/caveman-compress/scripts/detect.py:95— # Extensionless files (like CLAUDE.md, TODO) — check content — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment skills/caveman-compress/scripts/detect.py:95— # Extensionless files (like CLAUDE.md, TODO) — check content — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
validate.extract_indented_code_blocks (cognitive 38) plugins/caveman/skills/caveman-compress/scripts/validate.py:121— validate.extract_indented_code_blocks has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validate.extract_indented_code_blocks (cognitive 38) skills/caveman-compress/scripts/validate.py:121— validate.extract_indented_code_blocks has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compress.mask_code_blocks (cognitive 37) plugins/caveman/skills/caveman-compress/scripts/compress.py:807— compress.mask_code_blocks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (10 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compress.mask_code_blocks (cognitive 37) skills/caveman-compress/scripts/compress.py:807— compress.mask_code_blocks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (10 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compress._compress_file_locked (cognitive 32) plugins/caveman/skills/caveman-compress/scripts/compress.py:932— compress._compress_file_locked has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compress._compress_file_locked (cognitive 32) skills/caveman-compress/scripts/compress.py:932— compress._compress_file_locked has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
detect.detect_file_type (cognitive 22) plugins/caveman/skills/caveman-compress/scripts/detect.py:77— detect.detect_file_type has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
detect.detect_file_type (cognitive 22) skills/caveman-compress/scripts/detect.py:77— detect.detect_file_type has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compress.file_lock (cognitive 18) plugins/caveman/skills/caveman-compress/scripts/compress.py:153— compress.file_lock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compress.file_lock (cognitive 18) skills/caveman-compress/scripts/compress.py:153— compress.file_lock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClassTooLong: Runtime proxy/internal/nativeruntime/runtime.go:102— ClassTooLong — 689 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods, 24 blocks, lines 102-1406. The bar is 400 significant lines; this is 289 over it, 1.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MiddlewareRuntime packages/sdk/typescript/src/middleware/runtime.ts:149— ClassTooLong — 404 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 4 over it, 1.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (13 lines × 3) engine/compressors/toolschema_annotations.go:358— engine/compressors/toolschema_annotations.go:358-370 | proxy/internal/gateway/retrieve_tool.go:276-288 | proxy/providers/openai/content_compress.go:594-606 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Check import visibility before settling on that home: `proxy/internal/gateway/retrieve_tool.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (13 lines × 3) proxy/providers/anthropic/frozen.go:172— proxy/providers/anthropic/frozen.go:172-184 | proxy/providers/anthropic/splice.go:49-61 | proxy/providers/openai/content_compress.go:491-503 — before extracting anything, compare `proxy/providers/anthropic/splice.go` and `proxy/providers/openai/content_compress.go` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `proxy/providers/anthropic/frozen.go:170` calls `skipJSONSpace` and `proxy/providers/anthropic/splice.go:48` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) proxy/internal/store/source_claude.go:59— proxy/internal/store/source_claude.go:59-70 | proxy/internal/store/source_codex.go:52-63 | proxy/internal/store/source_pi.go:64-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/source_claude.go:59` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 3) proxy/internal/gateway/retrieve_tool.go:653— proxy/internal/gateway/retrieve_tool.go:653-664 | proxy/providers/adapter.go:1690-1701 | proxy/providers/bedrock/usage.go:630-641 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Check import visibility before settling on that home: `proxy/internal/gateway/retrieve_tool.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (11 lines × 3) proxy/internal/translate/chat_stream.go:394— proxy/internal/translate/chat_stream.go:394-404 | proxy/internal/translate/messages_stream.go:480-490 | proxy/internal/translate/responses_stream.go:585-595 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/chat_stream.go:394` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) proxy/internal/gateway/retrieve_tool.go:290— proxy/internal/gateway/retrieve_tool.go:290-300 | proxy/providers/anthropic/splice.go:178-188 | proxy/providers/openai/content_compress.go:608-618 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Check import visibility before settling on that home: `proxy/internal/gateway/retrieve_tool.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (7 lines × 3) proxy/internal/gateway/pixel.go:539— proxy/internal/gateway/pixel.go:539-545 | proxy/internal/gateway/pixel.go:559-565 | proxy/internal/gateway/pixel.go:577-583 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/pixel.go:539` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) proxy/providers/anthropic/anthropic.go:17— proxy/providers/anthropic/anthropic.go:17-23 | proxy/providers/azureopenai/azureopenai.go:19-25 | proxy/providers/openai/openai.go:39-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (5 lines × 3) proxy/internal/store/learn_outcomes.go:320— proxy/internal/store/learn_outcomes.go:320-324 | proxy/internal/store/learn_portfolio.go:153-157 | proxy/internal/store/session_source.go:324-328 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/store/learn_outcomes.go:320` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) packages/middleware/python/caveman_middleware/autogen.py:238— packages/middleware/python/caveman_middleware/autogen.py:238-242 | packages/middleware/python/caveman_middleware/pydantic_ai.py:236-240 | packages/middleware/python/caveman_middleware/strands.py:69-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `packages/middleware/python/caveman_middleware/pydantic_ai.py:235` calls `_protocol` and `packages/middleware/python/caveman_middleware/autogen.py:236` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (45 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:548— plugins/caveman/skills/caveman-compress/scripts/compress.py:548-592 | skills/caveman-compress/scripts/compress.py:548-592 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (45 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:670— plugins/caveman/skills/caveman-compress/scripts/compress.py:670-714 | skills/caveman-compress/scripts/compress.py:670-714 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/caveman/skills/caveman-compress/scripts/compress.py:670` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (31 lines × 2) plugins/caveman/skills/caveman-compress/scripts/benchmark.py:46— plugins/caveman/skills/caveman-compress/scripts/benchmark.py:46-76 | skills/caveman-compress/scripts/benchmark.py:46-76 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/benchmark.py` and `skills/caveman-compress/scripts/benchmark.py` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (31 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:303— plugins/caveman/skills/caveman-compress/scripts/compress.py:303-333 | skills/caveman-compress/scripts/compress.py:303-333 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/caveman/skills/caveman-compress/scripts/compress.py:303` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:281— plugins/caveman/skills/caveman-compress/scripts/compress.py:281-299 | skills/caveman-compress/scripts/compress.py:281-299 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:865— plugins/caveman/skills/caveman-compress/scripts/compress.py:865-883 | skills/caveman-compress/scripts/compress.py:865-883 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Outbound HTTP without resilience shared/platform/ssrf/ssrf.go:528— `http.Client{` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience shared/platform/ssrf/ssrf.go:532— `http.Client{` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Duplicated block (23 lines × 2 locations) REDACTED:7249— REDACTED:7249 · REDACTED:7296 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (23 lines × 2 locations) REDACTED:22419— REDACTED:22419 · packages/shared/binary-installer/installer.mjs:38 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (21 lines × 2 locations) REDACTED:16968— REDACTED:16968 · packages/cli/src/native-hook-fast.ts:180 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (21 lines × 2 locations) REDACTED:17682— REDACTED:17682 · REDACTED:17712 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (20 lines × 2 locations) REDACTED:6461— REDACTED:6461 · REDACTED:17415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2 locations) REDACTED:16921— REDACTED:16921 · packages/cli/src/native-hook-fast.ts:159 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (18 lines × 2 locations) agents/delegate/portable-process.mjs:15— agents/delegate/portable-process.mjs:15 · packages/cli/src/portable-command.ts:87 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (18 lines × 2 locations) extension/src/caveman.js:303— extension/src/caveman.js:303 · extension/store-assets/flame.js:11 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (17 lines × 2 locations) agents/compile.mjs:201— agents/compile.mjs:201 · integrations/compile.mjs:61 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (17 lines × 2 locations) installer/lib/settings.js:275— installer/lib/settings.js:275 · installer/lib/settings.js:383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2 locations) REDACTED:3443— REDACTED:3443 · REDACTED:3462 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (15 lines × 2 locations) src/hooks/caveman-activate.js:76— src/hooks/caveman-activate.js:76 · src/hooks/caveman-config.js:41 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) REDACTED:1928— REDACTED:1928 · REDACTED:2539 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) REDACTED:8485— REDACTED:8485 · REDACTED:8538 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×2
Recursive walk over a caller-supplied document has no depth cap REDACTED:7358— `deepMerge` is exported and takes `overlay: unknown` from its caller, and it calls itself at line 7358 (`deepMerge`) with a piece of `overlay` (and at line 7362) — and nowhere in `deepMerge` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `deepMerge` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap packages/middleware/python/caveman_middleware/_native.py:223— `replace_path` is public and takes `value: Any` from its caller, and it calls itself at line 223 (`replace_path`) with a piece of `value` — and nowhere in `replace_path` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `replace_path` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (an accessibility check that can read your UI — no component framework was detected and your pages are rendered by server-side templates, which neither the JSX/Vue ESLint plugins nor the HTML-template linters can parse; run axe/pa11y over the rendered pages, or assert the accessibility invariants over that rendered HTML in the test suite you already have) and no axe/pa11y/Lighthouse in tests or CI. Start by running that check over your rendered pages in CI. What was searched, so you can tell an absence from a miss: the 5 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
Server.proxy (cyclomatic 267) REDACTED:107— Server.proxy has cyclomatic complexity 267 (threshold 15). Of this number, 265 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
install.uninstall (cyclomatic 171) REDACTED:2145— install.uninstall has cyclomatic complexity 171 (threshold 15). Of this number, 161 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.spawnWrapped (cyclomatic 167) REDACTED:6591— index.spawnWrapped has cyclomatic complexity 167 (threshold 15). Of this number, 162 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.restoreNativeOperation (cyclomatic 118) REDACTED:10758— index.restoreNativeOperation has cyclomatic complexity 118 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
provider-leaves.selectLeaves (cyclomatic 100) packages/middleware/typescript/src/provider-leaves.ts:7— provider-leaves.selectLeaves has cyclomatic complexity 100 (threshold 15). Most of this is not in the body itself: 12 of the 100 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 32, a function literal at line 54, a function literal at line 71, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.nativeHook (cyclomatic 95) REDACTED:17364— index.nativeHook has cyclomatic complexity 95 (threshold 15). Of this number, 93 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.nativeIntegrationStatus (cyclomatic 94) REDACTED:11303— index.nativeIntegrationStatus has cyclomatic complexity 94 (threshold 15). Of this number, 86 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
onboard.onboard (cyclomatic 80) packages/cli/src/modules/onboard.ts:123— onboard.onboard has cyclomatic complexity 80 (threshold 15). Of this number, 75 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.chatGPTAuto (cyclomatic 78) proxy/internal/gateway/chatgpt_auto.go:164— Server.chatGPTAuto has cyclomatic complexity 78 (threshold 15). Of this number, 77 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.BuildStatsReport (cyclomatic 76) proxy/internal/store/stats.go:198— Store.BuildStatsReport has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validate.checkPlan (cyclomatic 74) packages/sdk/typescript/src/middleware/validate.ts:86— validate.checkPlan has cyclomatic complexity 74 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.validateReceiptContent (cyclomatic 73) REDACTED:21140— index.validateReceiptContent has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.chatgpt (cyclomatic 67) proxy/internal/gateway/chatgpt.go:54— Server.chatgpt has cyclomatic complexity 67 (threshold 15). Of this number, 64 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.qwenRouteOverride (cyclomatic 66) REDACTED:15406— index.qwenRouteOverride has cyclomatic complexity 66 (threshold 15). Of this number, 65 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compile.validate (cyclomatic 64) agents/compile.mjs:289— compile.validate has cyclomatic complexity 64 (threshold 15). Of this number, 63 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MiddlewareRuntime.optimize (cyclomatic 63) packages/sdk/python/caveman_cloud/middleware/runtime.py:435— MiddlewareRuntime.optimize has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.status (cyclomatic 62) REDACTED:20832— index.status has cyclomatic complexity 62 (threshold 15). Of this number, 59 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Server.rewriteRequest (cyclomatic 61) REDACTED:1523— Server.rewriteRequest has cyclomatic complexity 61 (threshold 15). Of this number, 53 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
provider-compat.compatForRoutedModel (cyclomatic 61) packages/pi-extension/src/provider-compat.ts:49— provider-compat.compatForRoutedModel has cyclomatic complexity 61 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Server.applyEffort (cyclomatic 59) proxy/internal/gateway/route.go:781— Server.applyEffort has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.nativeIntegrationStatus.files (cyclomatic 59) REDACTED:11310— index.nativeIntegrationStatus.files has cyclomatic complexity 59 (threshold 15). Of this number, 55 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.sanitizeRequestRecord (cyclomatic 56) proxy/internal/store/store.go:493— store.sanitizeRequestRecord has cyclomatic complexity 56 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
_native.leaves (cyclomatic 56) packages/middleware/python/caveman_middleware/_native.py:107— _native.leaves has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Reply.relay (cyclomatic 55) proxy/internal/translate/translate.go:558— Reply.relay has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.readOwnedMcpPendingJournalAt (cyclomatic 54) REDACTED:15832— index.readOwnedMcpPendingJournalAt has cyclomatic complexity 54 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
native-hook-fast.main (cyclomatic 54) packages/cli/src/native-hook-fast.ts:434— native-hook-fast.main has cyclomatic complexity 54 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
compressors.summarizeElided (cyclomatic 53) engine/compressors/invariants.go:207— compressors.summarizeElided has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.login (cyclomatic 53) REDACTED:12570— index.login has cyclomatic complexity 53 (threshold 15). Of this number, 49 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ai-sdk.project (cyclomatic 52) packages/middleware/typescript/src/ai-sdk.ts:137— ai-sdk.project has cyclomatic complexity 52 (threshold 15). Of this number, 50 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.nativeDoctor (cyclomatic 51) REDACTED:11556— index.nativeDoctor has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.buildWrapEnv (cyclomatic 51) REDACTED:12251— index.buildWrapEnv has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.serveTarget (cyclomatic 50) proxy/internal/gateway/route_pool.go:77— Server.serveTarget has cyclomatic complexity 50 (threshold 15). Of this number, 48 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.respond (cyclomatic 50) proxy/internal/nativeruntime/runtime.go:301— Runtime.respond has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
responsesToMessages.consume (cyclomatic 50) proxy/internal/translate/messages_responses.go:84— responsesToMessages.consume has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.agentShortcut (cyclomatic 50) REDACTED:6363— index.agentShortcut has cyclomatic complexity 50 (threshold 15). Of this number, 45 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderRouter.apply (cyclomatic 50) packages/pi-extension/src/provider.ts:64— ProviderRouter.apply has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
install.installOpencode (cyclomatic 49) REDACTED:1505— install.installOpencode has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caveman-activate.run (cyclomatic 49) src/hooks/caveman-activate.js:392— caveman-activate.run has cyclomatic complexity 49 (threshold 15). Of this number, 31 points are the body's own statements and 18 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caveman-mode-tracker.handle (cyclomatic 49) src/hooks/caveman-mode-tracker.js:142— caveman-mode-tracker.handle has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.writeReceipt (cyclomatic 48) proxy/internal/nativeruntime/receipt.go:38— Runtime.writeReceipt has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.perMessage (cyclomatic 46) proxy/internal/gateway/route.go:973— gateway.perMessage has cyclomatic complexity 46 (threshold 15). Of this number, 41 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
install.installHooks (cyclomatic 46) REDACTED:1775— install.installHooks has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.setup (cyclomatic 46) REDACTED:3841— index.setup has cyclomatic complexity 46 (threshold 15). Of this number, 24 points are the body's own statements and 22 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.validate (cyclomatic 45) proxy/internal/middleware/validate.go:34— Runtime.validate has cyclomatic complexity 45 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
install.installClaude (cyclomatic 45) REDACTED:565— install.installClaude has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mastra.createProcessor.prepare (cyclomatic 45) packages/middleware/typescript/src/mastra.ts:180— mastra.createProcessor.prepare has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providers.requestPricingUnsupportedReason (cyclomatic 44) proxy/providers/adapter.go:1753— providers.requestPricingUnsupportedReason has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.learn (cyclomatic 44) REDACTED:19988— index.learn has cyclomatic complexity 44 (threshold 15). Of this number, 41 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caveman-parse.parseModeChange (cyclomatic 44) src/hooks/caveman-parse.js:209— caveman-parse.parseModeChange has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.chatResponsesBody (cyclomatic 43) proxy/internal/translate/chat_in.go:317— translate.chatResponsesBody has cyclomatic complexity 43 (threshold 15). Of this number, 26 points are the body's own statements and 17 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
apply.planModules (cyclomatic 43) packages/cli/src/modules/apply.ts:363— apply.planModules has cyclomatic complexity 43 (threshold 15). Of this number, 41 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
apply.applyModules (cyclomatic 43) packages/cli/src/modules/apply.ts:464— apply.applyModules has cyclomatic complexity 43 (threshold 15). Of this number, 39 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
evals.validateJSONSchema (cyclomatic 42) engine/evals/graders.go:256— evals.validateJSONSchema has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
install.main (cyclomatic 42) REDACTED:2729— install.main has cyclomatic complexity 42 (threshold 15). Of this number, 41 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.syncAutoEntries (cyclomatic 42) REDACTED:4347— index.syncAutoEntries has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 3 of the 42 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 4351, 4354). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
transport.createCavemanFetch::cavemanFetch (cyclomatic 42) packages/middleware/typescript/src/transport.ts:81— transport.createCavemanFetch::cavemanFetch has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.runServe (cyclomatic 41) proxy/cmd/caveman-proxy/main.go:201— main.runServe has cyclomatic complexity 41 (threshold 15). Of this number, 37 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Link.ask (cyclomatic 41) proxy/internal/cloudlink/link.go:1111— Link.ask has cyclomatic complexity 41 (threshold 15). Of this number, 35 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Cave.assemble (cyclomatic 41) packages/sdk/python/caveman_cloud/core.py:425— Cave.assemble has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.formatSessionSavings (cyclomatic 41) REDACTED:5730— index.formatSessionSavings has cyclomatic complexity 41 (threshold 15). Of this number, 39 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.assemble (cyclomatic 41) packages/sdk/typescript/src/index.ts:1818— index.assemble has cyclomatic complexity 41 (threshold 15). Of this number, 32 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.ServeHTTP (cyclomatic 40) proxy/internal/middleware/http.go:48— Runtime.ServeHTTP has cyclomatic complexity 40 (threshold 15). Of this number, 33 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providers.mergeSnakeUsage (cyclomatic 40) proxy/providers/adapter.go:1451— providers.mergeSnakeUsage has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mastra.createProcessor (cyclomatic 40) packages/middleware/typescript/src/mastra.ts:141— mastra.createProcessor has cyclomatic complexity 40 (threshold 15). Of this number, 27 points are the body's own statements and 13 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.streamChatToResponses (cyclomatic 39) proxy/internal/translate/responses_stream.go:657— translate.streamChatToResponses has cyclomatic complexity 39 (threshold 15). Of this number, 35 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CavemanASGIMiddleware.__call__ (cyclomatic 39) packages/middleware/python/caveman_middleware/asgi.py:79— CavemanASGIMiddleware.__call__ has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.claudeProfileMutations (cyclomatic 39) REDACTED:8802— index.claudeProfileMutations has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.kiloRouteOverride (cyclomatic 39) REDACTED:15179— index.kiloRouteOverride has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
measureHarness (cyclomatic 39) packages/subagent-tax/run.mjs:154— measureHarness has cyclomatic complexity 39 (threshold 15). Of this number, 30 points are the body's own statements and 9 belong to 12 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
evals.Grade (cyclomatic 38) engine/evals/graders.go:50— evals.Grade has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.record (cyclomatic 38) REDACTED:1865— Server.record has cyclomatic complexity 38 (threshold 15). Of this number, 36 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.retrieve (cyclomatic 38) proxy/internal/middleware/recovery.go:20— Runtime.retrieve has cyclomatic complexity 38 (threshold 15). Of this number, 31 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.streamResponsesToChat (cyclomatic 38) proxy/internal/translate/chat_stream.go:432— translate.streamResponsesToChat has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.streamAnthropicToResponses (cyclomatic 38) proxy/internal/translate/responses_stream.go:488— translate.streamAnthropicToResponses has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
install.parseArgs (cyclomatic 38) REDACTED:88— install.parseArgs has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.cleanClaudeProfile (cyclomatic 38) REDACTED:11095— index.cleanClaudeProfile has cyclomatic complexity 38 (threshold 15). Of this number, 31 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compressors.focusAXRecords (cyclomatic 37) engine/compressors/axtree.go:374— compressors.focusAXRecords has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.publish (cyclomatic 37) REDACTED:417— Runtime.publish has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.streamAnthropicToChat (cyclomatic 37) proxy/internal/translate/chat_stream.go:304— translate.streamAnthropicToChat has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Link.decide (cyclomatic 36) proxy/internal/cloudlink/link.go:559— Link.decide has cyclomatic complexity 36 (threshold 15). Of this number, 28 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.chatMessagesBody (cyclomatic 36) proxy/internal/translate/chat_in.go:85— translate.chatMessagesBody has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 12 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 95). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
translate.appendChatMessage (cyclomatic 36) proxy/internal/translate/messages_in.go:412— translate.appendChatMessage has cyclomatic complexity 36 (threshold 15). Of this number, 16 points are the body's own statements and 20 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.enableNative (cyclomatic 36) REDACTED:10601— index.enableNative has cyclomatic complexity 36 (threshold 15). Of this number, 20 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.newRouteRun (cyclomatic 35) proxy/internal/gateway/route.go:443— gateway.newRouteRun has cyclomatic complexity 35 (threshold 15). Of this number, 32 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
store.scanConfirmedFixMetrics (cyclomatic 35) proxy/internal/store/learn_outcomes.go:288— store.scanConfirmedFixMetrics has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 331, 320). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sessionEventConsumer.consume (cyclomatic 35) proxy/internal/store/session_source.go:118— sessionEventConsumer.consume has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
install.installGemini (cyclomatic 35) REDACTED:719— install.installGemini has cyclomatic complexity 35 (threshold 15). Of this number, 29 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
doctor.modulesDoctor (cyclomatic 35) packages/cli/src/modules/doctor.ts:9— doctor.modulesDoctor has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MiddlewareRuntime.#optimize (cyclomatic 35) packages/sdk/typescript/src/middleware/runtime.ts:374— MiddlewareRuntime.#optimize has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compressors.sniffLanguage (cyclomatic 34) engine/compressors/code_cgo.go:329— compressors.sniffLanguage has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
middleware.New (cyclomatic 34) REDACTED:122— middleware.New has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiddlewareRuntime.report (cyclomatic 34) packages/sdk/python/caveman_cloud/middleware/runtime.py:388— MiddlewareRuntime.report has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.buildOpenClawOverlay (cyclomatic 34) REDACTED:11800— index.buildOpenClawOverlay has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jsonCompressor.selectArray (cyclomatic 33) engine/compressors/json.go:142— jsonCompressor.selectArray has cyclomatic complexity 33 (threshold 15). Of this number, 23 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.runLearn (cyclomatic 33) proxy/cmd/caveman-proxy/main.go:823— main.runLearn has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.simulateLearnPlan (cyclomatic 33) proxy/internal/store/learn_simulate.go:46— store.simulateLearnPlan has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providers.parseUsageBytes (cyclomatic 33) proxy/providers/adapter.go:986— providers.parseUsageBytes has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
openai.responsesZones (cyclomatic 33) proxy/providers/openai/content_compress.go:184— openai.responsesZones has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.opencodeNativeMutations (cyclomatic 33) REDACTED:9535— index.opencodeNativeMutations has cyclomatic complexity 33 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.qwenControlSurfaceOverride (cyclomatic 33) REDACTED:15342— index.qwenControlSurfaceOverride has cyclomatic complexity 33 (threshold 15). Of this number, 30 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.runCavemanDeviceFlow (cyclomatic 33) packages/device-auth/src/index.ts:114— index.runCavemanDeviceFlow has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validate.validate (cyclomatic 33) REDACTED:31— validate.validate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
prefixMonitor.observe (cyclomatic 32) proxy/internal/gateway/prefix_monitor.go:134— prefixMonitor.observe has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
translate.responsesChatBody (cyclomatic 32) proxy/internal/translate/responses_in.go:384— translate.responsesChatBody has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
google._prepare (cyclomatic 32) packages/middleware/python/caveman_middleware/google.py:303— google._prepare has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.localScanUploadFromRetro (cyclomatic 32) REDACTED:12826— index.localScanUploadFromRetro has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
transport.acceptsRecovery (cyclomatic 32) packages/middleware/typescript/src/transport.ts:20— transport.acceptsRecovery has cyclomatic complexity 32 (threshold 15). Of this number, 26 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
google.project (cyclomatic 32) packages/middleware/typescript/src/google.ts:99— google.project has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MiddlewareRuntime.constructor (cyclomatic 32) packages/sdk/typescript/src/middleware/runtime.ts:187— MiddlewareRuntime.constructor has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
gateway.stripRetrieveCall (cyclomatic 31) proxy/internal/gateway/retrieve_tool.go:721— gateway.stripRetrieveCall has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Creds.Resolve (cyclomatic 31) proxy/internal/standalone/standalone.go:145— Creds.Resolve has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.sanitizeStatsMeasurement (cyclomatic 31) proxy/internal/store/stats.go:147— store.sanitizeStatsMeasurement has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CavemanModel._project (cyclomatic 31) packages/middleware/python/caveman_middleware/strands.py:65— CavemanModel._project has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent-mcp.validateTraceFilters (cyclomatic 31) packages/cli/src/agent-mcp.ts:445— agent-mcp.validateTraceFilters has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.mcpInstall (cyclomatic 31) REDACTED:16101— index.mcpInstall has cyclomatic complexity 31 (threshold 15). Of this number, 24 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.contextPack (cyclomatic 31) packages/sdk/typescript/src/index.ts:1722— index.contextPack has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Server.recordChatGPT (cyclomatic 30) proxy/internal/gateway/chatgpt.go:390— Server.recordChatGPT has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Store.buildLearnPlan (cyclomatic 30) proxy/internal/store/learn.go:171— Store.buildLearnPlan has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
settings.pruneOrphanedManagedHooks (cyclomatic 30) installer/lib/settings.js:345— settings.pruneOrphanedManagedHooks has cyclomatic complexity 30 (threshold 15). Of this number, 20 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
onboard.toggle (cyclomatic 30) packages/cli/src/modules/onboard.ts:683— onboard.toggle has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 8 function items inside it that branch (render, a function literal at line 725, a function literal at line 695, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
caveman-config.safeWriteFlag (cyclomatic 30) src/hooks/caveman-config.js:225— caveman-config.safeWriteFlag has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tabularCompressor.compress (cyclomatic 29) engine/compressors/tabular.go:86— tabularCompressor.compress has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.scanLearnSessionMetricsUntil (cyclomatic 29) proxy/internal/store/learn_portfolio.go:140— store.scanLearnSessionMetricsUntil has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 9 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 161, 153). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
validate_catalog.validate_row (cyclomatic 29) shared/provider-catalog/validate_catalog.py:116— validate_catalog.validate_row has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
owned-install.installOwned (cyclomatic 29) installer/lib/owned-install.js:234— owned-install.installOwned has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
learn-autopilot.runAutopilot (cyclomatic 29) packages/cli/src/learn-autopilot.ts:262— learn-autopilot.runAutopilot has cyclomatic complexity 29 (threshold 15). Of this number, 18 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
onboard.choose (cyclomatic 29) packages/cli/src/modules/onboard.ts:763— onboard.choose has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 7 function items inside it that branch (a function literal at line 803, render, gaveWay, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.managedHookIdentity (cyclomatic 29) REDACTED:7970— index.managedHookIdentity has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.hooksCmd (cyclomatic 29) REDACTED:18583— index.hooksCmd has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CavemanMCPHost.project (cyclomatic 29) packages/middleware/typescript/src/mcp.ts:80— CavemanMCPHost.project has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.default (cyclomatic 29) packages/pi-extension/src/index.ts:112— index.default has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 178, a function literal at line 234, a function literal at line 265, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
validate.parseCapabilities (cyclomatic 29) packages/sdk/typescript/src/middleware/validate.ts:49— validate.parseCapabilities has cyclomatic complexity 29 (threshold 15). Of this number, 21 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity· main (cyclomatic 29) · ×1
main (cyclomatic 29) packages/subagent-tax/run.mjs:340— main has cyclomatic complexity 29 (threshold 15). Of this number, 27 points are the body's own statements and 2 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oidcVerifier.verify (cyclomatic 28) REDACTED:220— oidcVerifier.verify has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
store.retroStreamCutTokens (cyclomatic 28) proxy/internal/store/learn_retro.go:338— store.retroStreamCutTokens has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.replayCompressionMove (cyclomatic 28) proxy/internal/store/trial_store.go:515— Store.replayCompressionMove has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RuntimePolicyClient._decide (cyclomatic 28) packages/sdk/python/caveman_cloud/core.py:2468— RuntimePolicyClient._decide has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
openclaw-provider-compat.preserveOpenClawProviderCompat (cyclomatic 28) packages/cli/src/openclaw-provider-compat.ts:50— openclaw-provider-compat.preserveOpenClawProviderCompat has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.withMcpConfigLock (cyclomatic 28) REDACTED:10274— index.withMcpConfigLock has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.syncLocalSavings (cyclomatic 28) REDACTED:13214— index.syncLocalSavings has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
main.runPixelRender (cyclomatic 27) engine/cmd/caveman-engine/main.go:312— main.runPixelRender has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.AttachLearnTrendHistory (cyclomatic 27) proxy/internal/store/learn_trends.go:376— store.AttachLearnTrendHistory has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MiddlewareRuntime.__init__ (cyclomatic 27) packages/sdk/python/caveman_cloud/middleware/runtime.py:206— MiddlewareRuntime.__init__ has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
release-smoke.main (cyclomatic 27) REDACTED:33— release-smoke.main has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.transactOwnedMcpConfig (cyclomatic 27) REDACTED:15982— index.transactOwnedMcpConfig has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.renderLearnPlan (cyclomatic 27) REDACTED:19390— index.renderLearnPlan has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
langchain-model.prepareLangChain (cyclomatic 27) packages/middleware/typescript/src/langchain-model.ts:59— langchain-model.prepareLangChain has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 5 of the 27 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 67, 72, 80, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
validate.validatePage (cyclomatic 27) packages/sdk/typescript/src/middleware/validate.ts:127— validate.validatePage has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Server.observeCachedPrefix (cyclomatic 26) proxy/internal/gateway/prefix_monitor.go:237— Server.observeCachedPrefix has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
store.retroSessionPathsUntil (cyclomatic 26) proxy/internal/store/learn_retro.go:561— store.retroSessionPathsUntil has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 571, 594, 564, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
requestScan.str (cyclomatic 26) proxy/providers/inspect.go:253— requestScan.str has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
CavemanLLM._options (cyclomatic 26) packages/middleware/python/caveman_middleware/crewai.py:204— CavemanLLM._options has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
owned-install.uninstallOwned (cyclomatic 26) installer/lib/owned-install.js:306— owned-install.uninstallOwned has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent-mcp.validateTraceSearch (cyclomatic 26) packages/cli/src/agent-mcp.ts:507— agent-mcp.validateTraceSearch has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
apply.inactiveReason (cyclomatic 26) packages/cli/src/modules/apply.ts:567— apply.inactiveReason has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.engineSessionTelemetryFields (cyclomatic 26) REDACTED:5556— index.engineSessionTelemetryFields has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
transport.project (cyclomatic 26) packages/middleware/typescript/src/transport.ts:136— transport.project has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
openai.wrapOpenAI (cyclomatic 26) packages/middleware/typescript/src/openai.ts:75— openai.wrapOpenAI has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 82, 109, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
verbs-gate.loadSurfaces (cyclomatic 26) skills/verbs-gate.mjs:42— verbs-gate.loadSurfaces has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
gateway.statsPricingOriginKnown (cyclomatic 25) proxy/internal/gateway/stats_accounting.go:229— gateway.statsPricingOriginKnown has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
store.mergeBehaviorScan (cyclomatic 25) proxy/internal/store/learn.go:1142— store.mergeBehaviorScan has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.messagesToResponses (cyclomatic 25) proxy/internal/translate/messages_in.go:714— translate.messagesToResponses has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 719). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
translate.Request (cyclomatic 25) proxy/internal/translate/translate.go:152— translate.Request has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
CavemanChatCompletionClient._project (cyclomatic 25) packages/middleware/python/caveman_middleware/autogen.py:234— CavemanChatCompletionClient._project has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
snapshot_contract.validate_snapshot (cyclomatic 25) evals/snapshot_contract.py:30— snapshot_contract.validate_snapshot has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compile.collectInjectionModelIds (cyclomatic 25) agents/compile.mjs:222— compile.collectInjectionModelIds has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
index.mem (cyclomatic 25) REDACTED:20147— index.mem has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.usage (cyclomatic 25) REDACTED:20248— index.usage has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
anthropic.wrapAnthropic (cyclomatic 25) packages/middleware/typescript/src/anthropic.ts:39— anthropic.wrapAnthropic has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 47, 53, 70, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
MiddlewareRuntime.#exchange (cyclomatic 25) packages/sdk/typescript/src/middleware/runtime.ts:633— MiddlewareRuntime.#exchange has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
verbs-gate.scanSkillBody (cyclomatic 25) skills/verbs-gate.mjs:164— verbs-gate.scanSkillBody has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caveman-stats.attributeByMode (cyclomatic 25) src/hooks/caveman-stats.js:289— caveman-stats.attributeByMode has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ccr.openWithBudgetHooks (cyclomatic 24) REDACTED:168— ccr.openWithBudgetHooks has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cloudlink.askTextFor (cyclomatic 24) proxy/internal/cloudlink/link.go:966— cloudlink.askTextFor has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.parseRetrieveCall (cyclomatic 24) proxy/internal/gateway/retrieve_tool.go:392— gateway.parseRetrieveCall has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Resolver.Identify (cyclomatic 24) REDACTED:204— Resolver.Identify has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
oidcVerifier.fetch (cyclomatic 24) REDACTED:140— oidcVerifier.fetch has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
nativepack.validate (cyclomatic 24) proxy/internal/nativepack/pack.go:91— nativepack.validate has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Runtime.ensureTaskContract (cyclomatic 24) proxy/internal/nativeruntime/runtime.go:978— Runtime.ensureTaskContract has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.outcomeSink (cyclomatic 24) proxy/internal/store/detect_outcomes.go:154— store.outcomeSink has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.buildLearnTrends (cyclomatic 24) proxy/internal/store/learn_trends.go:275— store.buildLearnTrends has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
opencodeSessionSource.scanSession (cyclomatic 24) proxy/internal/store/source_opencode.go:51— opencodeSessionSource.scanSession has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.BuildTrialPlan (cyclomatic 24) proxy/internal/store/trial_store.go:222— Store.BuildTrialPlan has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.valueEnd (cyclomatic 24) proxy/internal/translate/jsonfast.go:63— translate.valueEnd has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
translate.messagesChatBody (cyclomatic 24) proxy/internal/translate/messages_in.go:186— translate.messagesChatBody has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Reply.serve (cyclomatic 24) proxy/internal/translate/translate.go:485— Reply.serve has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
catalog.DecodeAndValidate (cyclomatic 24) shared/platform/catalog/catalog.go:341— catalog.DecodeAndValidate has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CavemanLLM._options (cyclomatic 24) packages/middleware/python/caveman_middleware/llama_index.py:431— CavemanLLM._options has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_ContextPacking.pack (cyclomatic 24) packages/sdk/python/caveman_cloud/core.py:970— _ContextPacking.pack has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RuntimePolicyClient._accept (cyclomatic 24) packages/sdk/python/caveman_cloud/core.py:2340— RuntimePolicyClient._accept has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
provider-routing.verifiedProviderRoute (cyclomatic 24) packages/cli/src/provider-routing.ts:73— provider-routing.verifiedProviderRoute has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.enableProfiles (cyclomatic 24) REDACTED:10583— index.enableProfiles has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 10590, 10591). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
compressors.parseConfig (cyclomatic 23) engine/compressors/config.go:127— compressors.parseConfig has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
compressors.parsePytestJSON (cyclomatic 23) engine/compressors/testreport.go:289— compressors.parsePytestJSON has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Config.withDefaults (cyclomatic 23) proxy/internal/config/config.go:377— Config.withDefaults has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
gateway.requestAccounting (cyclomatic 23) proxy/internal/gateway/stats_accounting.go:33— gateway.requestAccounting has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
middleware.previousPlan (cyclomatic 23) REDACTED:721— middleware.previousPlan has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
nativeruntime.classifyTool (cyclomatic 23) proxy/internal/nativeruntime/runtime.go:1408— nativeruntime.classifyTool has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Store.LoginChatGPT (cyclomatic 23) proxy/internal/pool/chatgpt.go:71— Store.LoginChatGPT has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Store.saveIf (cyclomatic 23) proxy/internal/pool/pool.go:237— Store.saveIf has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providers.mergeGeminiUsage (cyclomatic 23) proxy/providers/adapter.go:1404— providers.mergeGeminiUsage has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
_native.accepts_recovery (cyclomatic 23) packages/middleware/python/caveman_middleware/_native.py:227— _native.accepts_recovery has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CavemanModel._project (cyclomatic 23) packages/middleware/python/caveman_middleware/pydantic_ai.py:232— CavemanModel._project has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
protocol.resolve_proxy (cyclomatic 23) packages/sdk/python/caveman_cloud/middleware/protocol.py:315— protocol.resolve_proxy has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validate.plan (cyclomatic 23) packages/sdk/python/caveman_cloud/middleware/validate.py:52— validate.plan has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
stats-cli.parseStatsOptions (cyclomatic 23) packages/cli/src/stats-cli.ts:32— stats-cli.parseStatsOptions has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.hookCommandTokens (cyclomatic 23) REDACTED:7908— index.hookCommandTokens has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.nativeHooksDocument (cyclomatic 23) REDACTED:8016— index.nativeHooksDocument has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.emitShrunk (cyclomatic 23) REDACTED:16594— index.emitShrunk has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mastra.withCavemanMastra (cyclomatic 23) packages/middleware/typescript/src/mastra.ts:80— mastra.withCavemanMastra has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 118, protection, a function literal at line 108, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
CavemanStrandsModel.project (cyclomatic 23) packages/middleware/typescript/src/strands.ts:49— CavemanStrandsModel.project has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RuntimePolicyClient.evaluate (cyclomatic 23) packages/sdk/typescript/src/index.ts:1276— RuntimePolicyClient.evaluate has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
caveman-stats.formatStats (cyclomatic 23) src/hooks/caveman-stats.js:413— caveman-stats.formatStats has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.runPixelSimulate (cyclomatic 22) engine/cmd/caveman-engine/main.go:509— main.runPixelSimulate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compressors.curateAXTree (cyclomatic 22) engine/compressors/axtree.go:145— compressors.curateAXTree has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compressors.readJSONTOONValue (cyclomatic 22) engine/compressors/toon_encode.go:123— compressors.readJSONTOONValue has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.fallbackKey (cyclomatic 22) proxy/internal/gateway/auth_fallback.go:55— gateway.fallbackKey has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.compiledPlanRoutes (cyclomatic 22) REDACTED:1218— gateway.compiledPlanRoutes has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.stripToolSchema (cyclomatic 22) proxy/internal/gateway/toolschema_strip.go:97— Server.stripToolSchema has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.receipt (cyclomatic 22) proxy/internal/middleware/recovery.go:184— Runtime.receipt has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.collectInstructionFiles (cyclomatic 22) proxy/internal/store/detect_memory_health.go:189— store.collectInstructionFiles has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.comparableConfigTokens (cyclomatic 22) proxy/internal/store/learn_outcomes.go:538— store.comparableConfigTokens has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
postgresMiddlewareTx.ExpireBatch (cyclomatic 22) proxy/internal/store/middleware_postgres.go:542— postgresMiddlewareTx.ExpireBatch has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.buildLearnRetro (cyclomatic 22) proxy/internal/store/learn_retro.go:195— Store.buildLearnRetro has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.strictNode (cyclomatic 22) proxy/internal/translate/messages_in.go:257— translate.strictNode has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
translate.sseLines (cyclomatic 22) proxy/internal/translate/messages_stream.go:71— translate.sseLines has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 101, 78, 143). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Adapter.SanitizeAndMapHeaders (cyclomatic 22) proxy/providers/bedrock/signing.go:29— Adapter.SanitizeAndMapHeaders has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
version.cmpVersion (cyclomatic 22) agents/version.mjs:2— version.cmpVersion has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
openclaw.installOpenclaw (cyclomatic 22) REDACTED:353— openclaw.installOpenclaw has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
apply.moduleSwitchCommand (cyclomatic 22) packages/cli/src/modules/apply.ts:629— apply.moduleSwitchCommand has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.resolveInvocation (cyclomatic 22) REDACTED:748— index.resolveInvocation has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.yamlScopedBaseUrl (cyclomatic 22) REDACTED:4577— index.yamlScopedBaseUrl has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
google.delegatedClient (cyclomatic 22) packages/middleware/typescript/src/google.ts:154— google.delegatedClient has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 165, 175, 181, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.toolSearch (cyclomatic 22) packages/sdk/typescript/src/index.ts:1578— index.toolSearch has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
protocol.resolveProxy (cyclomatic 22) packages/sdk/typescript/src/middleware/protocol.ts:154— protocol.resolveProxy has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caveman-stats.parseSession (cyclomatic 22) src/hooks/caveman-stats.js:161— caveman-stats.parseSession has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CDPDriver.waitActionable (cyclomatic 21) browse/cdp.go:256— CDPDriver.waitActionable has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compressors.parseTOONObject (cyclomatic 21) engine/compressors/toon_decode.go:90— compressors.parseTOONObject has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
configCompressor.compress (cyclomatic 21) engine/compressors/config.go:60— configCompressor.compress has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
contextwindow.Pack (cyclomatic 21) engine/contextwindow/contextwindow.go:69— contextwindow.Pack has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.collectOpenAIChatPixelLiveZone (cyclomatic 21) proxy/internal/gateway/pixel.go:402— gateway.collectOpenAIChatPixelLiveZone has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.collectOpenAIResponsesPixelLiveZone (cyclomatic 21) proxy/internal/gateway/pixel.go:454— gateway.collectOpenAIResponsesPixelLiveZone has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.containsNonTextInput (cyclomatic 21) proxy/internal/gateway/stats_accounting.go:173— gateway.containsNonTextInput has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.runRetrieveLoop (cyclomatic 21) proxy/internal/gateway/retrieve_tool.go:924— Server.runRetrieveLoop has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
repointel.buildBundle (cyclomatic 21) proxy/internal/repointel/index.go:633— repointel.buildBundle has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
store.trendSparkSVG (cyclomatic 21) proxy/internal/store/learn_trends.go:518— store.trendSparkSVG has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.messagesFinish (cyclomatic 21) proxy/internal/translate/msgbuild.go:307— translate.messagesFinish has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Adapter.ResolveUpstreamURL (cyclomatic 21) proxy/providers/bedrock/routing.go:147— Adapter.ResolveUpstreamURL has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
requestScan.number (cyclomatic 21) proxy/providers/inspect.go:317— requestScan.number has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OTelExporter.record_span (cyclomatic 21) packages/sdk/python/caveman_cloud/core.py:1661— OTelExporter.record_span has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
owned-install.loadJournal (cyclomatic 21) installer/lib/owned-install.js:103— owned-install.loadJournal has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
openclaw.uninstallOpenclaw (cyclomatic 21) REDACTED:431— openclaw.uninstallOpenclaw has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
install.inspectOmpRegistration (cyclomatic 21) REDACTED:1344— install.inspectOmpRegistration has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
onboard.signInStep (cyclomatic 21) packages/cli/src/modules/onboard.ts:454— onboard.signInStep has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.stripJson5Comments (cyclomatic 21) REDACTED:7254— index.stripJson5Comments has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.codexHooksTrusted (cyclomatic 21) REDACTED:9844— index.codexHooksTrusted has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.recoverOwnedMcpTransaction (cyclomatic 21) REDACTED:15923— index.recoverOwnedMcpTransaction has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tool-output.shrinkToolResult (cyclomatic 21) packages/pi-extension/src/tool-output.ts:21— tool-output.shrinkToolResult has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RuntimePolicyClient.refresh (cyclomatic 21) packages/sdk/typescript/src/index.ts:1111— RuntimePolicyClient.refresh has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.guardPasses (cyclomatic 21) packages/sdk/typescript/src/index.ts:1432— index.guardPasses has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ccr.prepareObject (cyclomatic 20) engine/ccr/store.go:105— ccr.prepareObject has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
compressors.parseTOONArray (cyclomatic 20) engine/compressors/toon_decode.go:160— compressors.parseTOONArray has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
logCompressor.compress (cyclomatic 20) engine/compressors/log.go:89— logCompressor.compress has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Engine.Detect (cyclomatic 20) engine/detect.go:48— Engine.Detect has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
image.anthropicVersion (cyclomatic 20) engine/image/tokens.go:144— image.anthropicVersion has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.Recall (cyclomatic 20) REDACTED:411— Store.Recall has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
middleware.caseFolded (cyclomatic 20) proxy/internal/middleware/presence.go:88— middleware.caseFolded has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
nativeruntime.StripSessionMarkers (cyclomatic 20) proxy/internal/nativeruntime/marker.go:89— nativeruntime.StripSessionMarkers has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.measureAppliedFix (cyclomatic 20) proxy/internal/store/learn_outcomes.go:437— store.measureAppliedFix has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.buildLearnPortfolio (cyclomatic 20) proxy/internal/store/learn_portfolio.go:269— store.buildLearnPortfolio has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.treeAt (cyclomatic 20) proxy/internal/translate/jsonfast.go:592— translate.treeAt has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Base.SanitizeAndMapHeaders (cyclomatic 20) proxy/providers/adapter.go:556— Base.SanitizeAndMapHeaders has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
bedrock.matchesInboundSigningIdentity (cyclomatic 20) proxy/providers/bedrock/signing.go:138— bedrock.matchesInboundSigningIdentity has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Adapter.ApplyProviderNativeTransforms (cyclomatic 20) proxy/providers/openai/cache_key.go:42— Adapter.ApplyProviderNativeTransforms has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
openai.with_caveman_openai_tools (cyclomatic 20) packages/middleware/python/caveman_middleware/openai.py:76— openai.with_caveman_openai_tools has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
llm_run.main (cyclomatic 20) REDACTED:174— llm_run.main has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
verify-extension-stage.verifyExtensionRoot (cyclomatic 20) extension/scripts/verify-extension-stage.mjs:79— verify-extension-stage.verifyExtensionRoot has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
provider-routing.unforwardedProviderHeaders (cyclomatic 20) packages/cli/src/provider-routing.ts:127— provider-routing.unforwardedProviderHeaders has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.telemetryTokenDelta (cyclomatic 20) REDACTED:1514— index.telemetryTokenDelta has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.importSkill (cyclomatic 20) REDACTED:2335— index.importSkill has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.skills (cyclomatic 20) REDACTED:2561— index.skills has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.recoverPendingAgentNativeBundle (cyclomatic 20) REDACTED:3608— index.recoverPendingAgentNativeBundle has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.mcpUninstall (cyclomatic 20) REDACTED:14068— index.mcpUninstall has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.qwenWorkspaceTrusted (cyclomatic 20) REDACTED:14841— index.qwenWorkspaceTrusted has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.installSettingsHookGeneric (cyclomatic 20) REDACTED:17559— index.installSettingsHookGeneric has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.renderStatus (cyclomatic 20) REDACTED:20787— index.renderStatus has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.traceSearchBody (cyclomatic 20) REDACTED:21494— index.traceSearchBody has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
google.selected (cyclomatic 20) packages/middleware/typescript/src/google.ts:67— google.selected has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 73, 70). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.readRunState (cyclomatic 20) packages/pi-extension/src/index.ts:57— index.readRunState has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
run.parseArgs (cyclomatic 20) packages/subagent-tax/run.mjs:26— run.parseArgs has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
caveman-stats.findRecentSession (cyclomatic 20) src/hooks/caveman-stats.js:87— caveman-stats.findRecentSession has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
CDPDriver.Act (cyclomatic 19) browse/cdp.go:160— CDPDriver.Act has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compressors.droppableGeneric (cyclomatic 19) engine/compressors/axtree.go:254— compressors.droppableGeneric has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
compressors.splitLineNumberGutter (cyclomatic 19) engine/compressors/code_listing.go:89— compressors.splitLineNumberGutter has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
compressors.RestoreLineNumberedListing (cyclomatic 19) engine/compressors/code_listing.go:143— compressors.RestoreLineNumberedListing has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.parseStatsReportOptions (cyclomatic 19) proxy/cmd/caveman-proxy/stats.go:17— main.parseStatsReportOptions has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Link.poolAnswer (cyclomatic 19) proxy/internal/cloudlink/link.go:1334— Link.poolAnswer has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.standalonePriceForUsage (cyclomatic 19) REDACTED:2058— gateway.standalonePriceForUsage has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.appendRetrieveResult (cyclomatic 19) proxy/internal/gateway/retrieve_tool.go:514— gateway.appendRetrieveResult has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.UniqueRecentSession (cyclomatic 19) proxy/internal/nativeruntime/runtime.go:584— Runtime.UniqueRecentSession has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.crossProviderSinks (cyclomatic 19) proxy/internal/store/learn.go:769— store.crossProviderSinks has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
sessionEventConsumer.finish (cyclomatic 19) proxy/internal/store/session_source.go:233— sessionEventConsumer.finish has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Store.InitMiddleware (cyclomatic 19) proxy/internal/store/middleware.go:133— Store.InitMiddleware has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.stripForeignThinking (cyclomatic 19) proxy/internal/translate/messages.go:286— translate.stripForeignThinking has cyclomatic complexity 19 (threshold 15). Of this number, 10 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.responsesMessagesBody (cyclomatic 19) proxy/internal/translate/responses_in.go:166— translate.responsesMessagesBody has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
providers.ApplyResolvedPricingRoute (cyclomatic 19) proxy/providers/adapter.go:159— providers.ApplyResolvedPricingRoute has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
bedrock.validateBedrockRawTotal (cyclomatic 19) proxy/providers/bedrock/usage.go:407— bedrock.validateBedrockRawTotal has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CavemanMCPHost._project (cyclomatic 19) packages/middleware/python/caveman_middleware/mcp.py:105— CavemanMCPHost._project has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
settings.stripJsonComments (cyclomatic 19) installer/lib/settings.js:30— settings.stripJsonComments has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.addCommandHook (cyclomatic 19) installer/lib/settings.js:187— settings.addCommandHook has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
apply.moduleStates (cyclomatic 19) packages/cli/src/modules/apply.ts:599— apply.moduleStates has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 607, 615, 604). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.startOptions (cyclomatic 19) REDACTED:2645— index.startOptions has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.setupInstallLocked (cyclomatic 19) REDACTED:3231— index.setupInstallLocked has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.syncLocalPracticeFindings (cyclomatic 19) REDACTED:13384— index.syncLocalPracticeFindings has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.validNativeRuntimeResponse (cyclomatic 19) REDACTED:16857— index.validNativeRuntimeResponse has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
native-hook-fast.validResponse (cyclomatic 19) packages/cli/src/native-hook-fast.ts:358— native-hook-fast.validResponse has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
langchain.createCavemanLangChain (cyclomatic 19) packages/middleware/typescript/src/langchain.ts:21— langchain.createCavemanLangChain has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OTelExporter.recordSpan (cyclomatic 19) packages/sdk/typescript/src/index.ts:2225— OTelExporter.recordSpan has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.normalizeExperiment (cyclomatic 19) packages/sdk/typescript/src/index.ts:1479— index.normalizeExperiment has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caveman-stats.main (cyclomatic 19) src/hooks/caveman-stats.js:526— caveman-stats.main has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
main.runDirect (cyclomatic 18) browse/cmd/caveman-browse/main.go:135— main.runDirect has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
annotationStripper.walkObject (cyclomatic 18) engine/compressors/toolschema_annotations.go:237— annotationStripper.walkObject has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.memTools (cyclomatic 18) mem/cmd/cavemem/main.go:133— main.memTools has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 169, 196, 139, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
main.runTrial (cyclomatic 18) proxy/cmd/caveman-proxy/main.go:677— main.runTrial has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.runUsage (cyclomatic 18) proxy/cmd/caveman-proxy/main.go:753— main.runUsage has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.prefixModel (cyclomatic 18) proxy/internal/gateway/chatgpt_auto.go:412— gateway.prefixModel has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.armCacheWarm (cyclomatic 18) REDACTED:614— Server.armCacheWarm has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.pixelRequest (cyclomatic 18) proxy/internal/gateway/pixel.go:30— Server.pixelRequest has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
middleware.requestPresence (cyclomatic 18) proxy/internal/middleware/presence.go:29— middleware.requestPresence has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.prepareChoice (cyclomatic 18) proxy/internal/middleware/choices.go:50— Runtime.prepareChoice has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Runtime.optimize (cyclomatic 18) REDACTED:323— Runtime.optimize has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
nativehook.currentRepositoryState (cyclomatic 18) REDACTED:168— nativehook.currentRepositoryState has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
store.memoryOrphansSink (cyclomatic 18) proxy/internal/store/detect_memory_health.go:367— store.memoryOrphansSink has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.buildExperimentReport (cyclomatic 18) proxy/internal/store/learn_experiment.go:251— store.buildExperimentReport has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.namespaceEvent (cyclomatic 18) proxy/internal/translate/translate.go:1004— translate.namespaceEvent has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Adapter.ApplyProviderNativeTransforms (cyclomatic 18) proxy/providers/anthropic/cache_breakpoints.go:26— Adapter.ApplyProviderNativeTransforms has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
anthropic.objectMemberSpan (cyclomatic 18) proxy/providers/anthropic/frozen.go:165— anthropic.objectMemberSpan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
azureopenai.legacyChatCompletionsRoute (cyclomatic 18) proxy/providers/azureopenai/azure_routing.go:79— azureopenai.legacyChatCompletionsRoute has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
bedrock.parseBedrockText (cyclomatic 18) proxy/providers/bedrock/usage.go:152— bedrock.parseBedrockText has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
postgresconfig.ParsePoolConfig (cyclomatic 18) shared/platform/postgresconfig/postgresconfig.go:39— postgresconfig.ParsePoolConfig has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
learn-autopilot.claimLearnNudge (cyclomatic 18) packages/cli/src/learn-autopilot.ts:349— learn-autopilot.claimLearnNudge has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
onboard.routingStep (cyclomatic 18) packages/cli/src/modules/onboard.ts:312— onboard.routingStep has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
learn-trends.learnTrendTable (cyclomatic 18) packages/cli/src/learn-trends.ts:128— learn-trends.learnTrendTable has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.runExternalSkillAdd (cyclomatic 18) REDACTED:2500— index.runExternalSkillAdd has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.parseMcpServerMarkerBytes (cyclomatic 18) REDACTED:3494— index.parseMcpServerMarkerBytes has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.restoreNativeJournalFiles (cyclomatic 18) REDACTED:11157— index.restoreNativeJournalFiles has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.qwenArgsPermitRecovery (cyclomatic 18) REDACTED:15626— index.qwenArgsPermitRecovery has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.stats (cyclomatic 18) REDACTED:18708— index.stats has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.renderLearnSpendLines (cyclomatic 18) REDACTED:19353— index.renderLearnSpendLines has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.renderLearnSavings (cyclomatic 18) REDACTED:19705— index.renderLearnSavings has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.receiptsVerify (cyclomatic 18) REDACTED:21318— index.receiptsVerify has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.selectMenu (cyclomatic 18) REDACTED:22348— index.selectMenu has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 22387, 22358, 22361, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
native-hook-fast.localGatewayEndpoint (cyclomatic 18) packages/cli/src/native-hook-fast.ts:53— native-hook-fast.localGatewayEndpoint has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
mastra.remember (cyclomatic 18) packages/middleware/typescript/src/mastra.ts:42— mastra.remember has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RuntimePolicyClient.verifyBundle (cyclomatic 18) packages/sdk/typescript/src/index.ts:1240— RuntimePolicyClient.verifyBundle has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.compress (cyclomatic 18) packages/sdk/typescript/src/index.ts:1661— index.compress has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiddlewareRuntime.preflight (cyclomatic 18) packages/sdk/typescript/src/middleware/runtime.ts:244— MiddlewareRuntime.preflight has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
browse.validateSnapshotArgs (cyclomatic 17) browse/session.go:246— browse.validateSnapshotArgs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Session.actTool (cyclomatic 17) browse/session.go:305— Session.actTool has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ccr.secureSQLiteFile (cyclomatic 17) REDACTED:344— ccr.secureSQLiteFile has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Store.putObject (cyclomatic 17) REDACTED:622— Store.putObject has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
compressors.parseJUnitXML (cyclomatic 17) engine/compressors/testreport.go:164— compressors.parseJUnitXML has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
textCompressor.compress (cyclomatic 17) engine/compressors/text.go:47— textCompressor.compress has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
evals.valueMatchesAnyType (cyclomatic 17) engine/evals/graders.go:359— evals.valueMatchesAnyType has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
evals.summarizeQuality (cyclomatic 17) engine/evals/quality.go:254— evals.summarizeQuality has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
image.DecideWithDetail (cyclomatic 17) engine/image/image.go:97— image.DecideWithDetail has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
effortWire.markAt (cyclomatic 17) proxy/internal/gateway/route.go:1094— effortWire.markAt has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.routeHeal (cyclomatic 17) proxy/internal/gateway/route.go:1434— Server.routeHeal has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
repointel.gitTrackedFiles (cyclomatic 17) proxy/internal/repointel/index.go:291— repointel.gitTrackedFiles has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.bashReadPath (cyclomatic 17) proxy/internal/store/detect_reread.go:268— store.bashReadPath has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.retroScanClaudeFile (cyclomatic 17) proxy/internal/store/learn_retro.go:633— store.retroScanClaudeFile has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.learnTLDR (cyclomatic 17) REDACTED:612— store.learnTLDR has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
store.codexPathsUntil (cyclomatic 17) proxy/internal/store/usage_import.go:159— store.codexPathsUntil has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 179, 169, 162). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
sqliteMiddlewareTx.ExpireBatch (cyclomatic 17) proxy/internal/store/middleware.go:806— sqliteMiddlewareTx.ExpireBatch has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
geminiSessionSource.scanSession (cyclomatic 17) proxy/internal/store/source_gemini.go:48— geminiSessionSource.scanSession has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.appendResponsesToolOutput (cyclomatic 17) proxy/internal/translate/messages_in.go:828— translate.appendResponsesToolOutput has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 841). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
translate.bridgeTools (cyclomatic 17) proxy/internal/translate/responses.go:160— translate.bridgeTools has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 163). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
anthropic.injectBreakpointRaw (cyclomatic 17) proxy/providers/anthropic/cache_breakpoints.go:86— anthropic.injectBreakpointRaw has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
anthropic.collectAnthropicBlocks (cyclomatic 17) proxy/providers/anthropic/content_compress.go:319— anthropic.collectAnthropicBlocks has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Adapter.InspectRequest (cyclomatic 17) proxy/providers/bedrock/routing.go:273— Adapter.InspectRequest has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
bedrock.normalizeBedrockCacheDetails (cyclomatic 17) proxy/providers/bedrock/usage.go:334— bedrock.normalizeBedrockCacheDetails has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jsonsplice.AppendObjectFields (cyclomatic 17) proxy/providers/jsonsplice/jsonsplice.go:158— jsonsplice.AppendObjectFields has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Provider.Credentials (cyclomatic 17) shared/platform/awscreds/awscreds.go:172— Provider.Credentials has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ssrf.checkAddr (cyclomatic 17) shared/platform/ssrf/ssrf.go:309— ssrf.checkAddr has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agno._message_view (cyclomatic 17) packages/middleware/python/caveman_middleware/agno.py:53— agno._message_view has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CavemanLLM._stream (cyclomatic 17) packages/middleware/python/caveman_middleware/llama_index.py:579— CavemanLLM._stream has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (CavemanLLM._astream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CavemanLLM._astream (cyclomatic 17) packages/middleware/python/caveman_middleware/llama_index.py:614— CavemanLLM._astream has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (CavemanLLM._stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
llama_index._message_view (cyclomatic 17) packages/middleware/python/caveman_middleware/llama_index.py:242— llama_index._message_view has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Cave.compress (cyclomatic 17) packages/sdk/python/caveman_cloud/core.py:778— Cave.compress has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
core._policy_guard_passes (cyclomatic 17) packages/sdk/python/caveman_cloud/core.py:2049— core._policy_guard_passes has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MiddlewareRuntime._http (cyclomatic 17) packages/sdk/python/caveman_cloud/middleware/runtime.py:854— MiddlewareRuntime._http has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
portable-process.resolveWindowsNodeShim (cyclomatic 17) installer/lib/portable-process.js:78— portable-process.resolveWindowsNodeShim has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
command-args.parseCommandArgs (cyclomatic 17) installer/lib/command-args.js:6— command-args.parseCommandArgs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent-mcp.handleMessage (cyclomatic 17) packages/cli/src/agent-mcp.ts:616— agent-mcp.handleMessage has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
onboard.foundRows (cyclomatic 17) packages/cli/src/modules/onboard.ts:390— onboard.foundRows has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
stats-cli.renderStatsSummary (cyclomatic 17) packages/cli/src/stats-cli.ts:105— stats-cli.renderStatsSummary has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.start (cyclomatic 17) REDACTED:2677— index.start has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.preflightAgentNativeBundleComponents (cyclomatic 17) REDACTED:3728— index.preflightAgentNativeBundleComponents has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.capabilityInputValue (cyclomatic 17) REDACTED:4507— index.capabilityInputValue has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.resolveCapabilities (cyclomatic 17) REDACTED:4649— index.resolveCapabilities has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.aiderNativeConfig (cyclomatic 17) REDACTED:9635— index.aiderNativeConfig has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.installNativeVoiceSkills (cyclomatic 17) REDACTED:10546— index.installNativeVoiceSkills has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.removeNativeHookEntries (cyclomatic 17) REDACTED:10712— index.removeNativeHookEntries has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.disableNative (cyclomatic 17) REDACTED:11280— index.disableNative has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.validateLoginArgs (cyclomatic 17) REDACTED:12482— index.validateLoginArgs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.syncRequestSpan (cyclomatic 17) REDACTED:13164— index.syncRequestSpan has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.planRemoveMcpKiloJson (cyclomatic 17) REDACTED:14433— index.planRemoveMcpKiloJson has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (index.planRemoveMcpQwenJson) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.qwenMigratePolicySettings (cyclomatic 17) REDACTED:14653— index.qwenMigratePolicySettings has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.qwenSettingsPermitRecovery (cyclomatic 17) REDACTED:14897— index.qwenSettingsPermitRecovery has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.planRemoveMcpQwenJson (cyclomatic 17) REDACTED:15721— index.planRemoveMcpQwenJson has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (index.planRemoveMcpKiloJson) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.agentMcpRequest (cyclomatic 17) REDACTED:21779— index.agentMcpRequest has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
google.acceptsRecovery (cyclomatic 17) packages/middleware/typescript/src/google.ts:58— google.acceptsRecovery has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
google.invocation (cyclomatic 17) packages/middleware/typescript/src/google.ts:196— google.invocation has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MiddlewareRuntime.optimize (cyclomatic 17) packages/sdk/typescript/src/middleware/runtime.ts:332— MiddlewareRuntime.optimize has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
probe-native-codex-recovery.upstream (cyclomatic 17) scripts/probe-native-codex-recovery.mjs:198— probe-native-codex-recovery.upstream has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 201, 228, 245, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
resolveWindowsNodeShim (cyclomatic 17) agents/delegate/portable-process.mjs:74— resolveWindowsNodeShim has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
compressors.anomalyIndices (cyclomatic 16) engine/compressors/json.go:333— compressors.anomalyIndices has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.gatewayFindObjectField (cyclomatic 16) proxy/internal/gateway/retrieve_tool.go:161— gateway.gatewayFindObjectField has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gateway.pairPrefix (cyclomatic 16) proxy/internal/gateway/route.go:1637— gateway.pairPrefix has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
cacheWarmer.scheduleLocked (cyclomatic 16) REDACTED:317— cacheWarmer.scheduleLocked has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 330). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
identity.newOIDCVerifier (cyclomatic 16) REDACTED:75— identity.newOIDCVerifier has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
nativeruntime.validResponse (cyclomatic 16) proxy/internal/nativeruntime/server_common.go:38— nativeruntime.validResponse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
store.memoryHealthSinks (cyclomatic 16) proxy/internal/store/detect_memory_health.go:62— store.memoryHealthSinks has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.duplicateRulesSink (cyclomatic 16) proxy/internal/store/detect_memory_health.go:571— store.duplicateRulesSink has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.claudeMDSectionSink (cyclomatic 16) proxy/internal/store/detect_sections.go:56— store.claudeMDSectionSink has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.retroRepeatedStreamCandidates (cyclomatic 16) proxy/internal/store/learn_retro.go:456— store.retroRepeatedStreamCandidates has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.parseAiderHistory (cyclomatic 16) proxy/internal/store/source_aider.go:115— store.parseAiderHistory has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store.parseCodexFile (cyclomatic 16) proxy/internal/store/usage_import.go:226— store.parseCodexFile has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PostgresMiddleware.initMiddleware (cyclomatic 16) proxy/internal/store/middleware_postgres.go:223— PostgresMiddleware.initMiddleware has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.stripBlocks (cyclomatic 16) proxy/internal/translate/messages.go:347— translate.stripBlocks has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 350). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
translate.appendToolMessage (cyclomatic 16) proxy/internal/translate/messages_in.go:542— translate.appendToolMessage has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 550). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
translate.messagesResponsesBody (cyclomatic 16) proxy/internal/translate/messages_in.go:601— translate.messagesResponsesBody has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.estimateInputTokens (cyclomatic 16) proxy/internal/translate/messages_stream.go:499— translate.estimateInputTokens has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
translate.clampEffort (cyclomatic 16) proxy/internal/translate/responses.go:356— translate.clampEffort has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
anthropic.contentBlocksCarryBreakpoint (cyclomatic 16) proxy/providers/anthropic/breakpoint_plan.go:272— anthropic.contentBlocksCarryBreakpoint has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
anthropic.stripCacheControl (cyclomatic 16) proxy/providers/anthropic/frozen.go:112— anthropic.stripCacheControl has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
anthropic.findObjectField (cyclomatic 16) proxy/providers/anthropic/splice.go:37— anthropic.findObjectField has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jsonsplice.Field (cyclomatic 16) proxy/providers/jsonsplice/jsonsplice.go:35— jsonsplice.Field has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
openai.chatZones (cyclomatic 16) proxy/providers/openai/content_compress.go:146— openai.chatZones has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
openai.chatRecoveryCallIDs (cyclomatic 16) proxy/providers/openai/content_compress.go:275— openai.chatRecoveryCallIDs has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
openai.findObjectField (cyclomatic 16) proxy/providers/openai/content_compress.go:479— openai.findObjectField has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ssrf.dialContextWith (cyclomatic 16) shared/platform/ssrf/ssrf.go:446— ssrf.dialContextWith has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 447). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
langchain._message_view (cyclomatic 16) packages/middleware/python/caveman_middleware/langchain.py:55— langchain._message_view has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MiddlewareRuntime._capabilities (cyclomatic 16) packages/sdk/python/caveman_cloud/middleware/runtime.py:592— MiddlewareRuntime._capabilities has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
validate.page (cyclomatic 16) packages/sdk/python/caveman_cloud/middleware/validate.py:113— validate.page has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
check-profile-scope.checkProfileScope (cyclomatic 16) agents/check-profile-scope.mjs:44— check-profile-scope.checkProfileScope has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.validateHookFields (cyclomatic 16) installer/lib/settings.js:152— settings.validateHookFields has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
settings.rewriteLegacyManagedHookCommands (cyclomatic 16) installer/lib/settings.js:302— settings.rewriteLegacyManagedHookCommands has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
provider-skills.skillsRoot (cyclomatic 16) installer/lib/provider-skills.js:21— provider-skills.skillsRoot has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.hermesNativeConfig (cyclomatic 16) REDACTED:10132— index.hermesNativeConfig has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.withIntegrationLock (cyclomatic 16) REDACTED:10229— index.withIntegrationLock has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.nativeRoutePinnedFor (cyclomatic 16) REDACTED:10446— index.nativeRoutePinnedFor has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (routeIn). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.applyConfigFileInjection (cyclomatic 16) REDACTED:11941— index.applyConfigFileInjection has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.planMcpKiloJson (cyclomatic 16) REDACTED:14393— index.planMcpKiloJson has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.qwenEnvironmentFilePaths (cyclomatic 16) REDACTED:14960— index.qwenEnvironmentFilePaths has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.hooksDirectiveCmd (cyclomatic 16) REDACTED:18530— index.hooksDirectiveCmd has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.learnSummaryMoves (cyclomatic 16) REDACTED:19202— index.learnSummaryMoves has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.embeddedReceiptKeys (cyclomatic 16) REDACTED:21279— index.embeddedReceiptKeys has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
index.config (cyclomatic 16) REDACTED:21907— index.config has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: index.privateVerificationURL (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
wire.parseWire::walk (cyclomatic 16) packages/middleware/typescript/src/wire.ts:23— wire.parseWire::walk has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
protocol.sanitizeHookResponse (cyclomatic 16) packages/pi-extension/src/protocol.ts:48— protocol.sanitizeHookResponse has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.isValidPolicyDoc (cyclomatic 16) packages/sdk/typescript/src/index.ts:1407— index.isValidPolicyDoc has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
transport.createNodeTransport.boot (cyclomatic 16) REDACTED:33— transport.createNodeTransport.boot has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
caveman-config.appendFlag (cyclomatic 16) src/hooks/caveman-config.js:448— caveman-config.appendFlag has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.transformResponse (cyclomatic 16) src/mcp-servers/caveman-shrink/index.js:146— index.transformResponse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ingest.validEngineSession (cyclomatic 16) supabase/functions/cli-telemetry/ingest.ts:208— ingest.validEngineSession has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
collectUsage (cyclomatic 16) agents/delegate/caveman-delegate-mcp.mjs:38— collectUsage has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
analyzeCapture (cyclomatic 16) packages/subagent-tax/lib/analyze.mjs:84— analyzeCapture has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
No assertions: langchain-model loads and runs without langchain installed packages/middleware/typescript/tests/adapters.test.mjs:33— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D10 · Test Quality· Fixed-sleep synchronisation · ×1
Fixed-sleep synchronisation: Enter typed ahead before the first screen is shown never accepts the plan unseen packages/cli/tests/onboard-interactive.runtime.mjs:105— This test starts work it did not wait for (`run`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 50))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Server.proxy (cognitive 339) REDACTED:107— Server.proxy has cognitive complexity 339 (threshold 15). Drivers by points: if/else 136 (237 pts), boolean chains 86, match/switch 7 (15 pts), loops 1 (nesting depth added 109). Of this number, 337 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
uninstall (cognitive 334) REDACTED:2145— uninstall has cognitive complexity 334 (threshold 15). Drivers by points: if/else 102 (197 pts), error handling 19 (53 pts), boolean chains 43, ternaries 11 (33 pts), loops 5 (8 pts) (nesting depth added 154). Of this number, 325 points are the body's own statements and 9 belong to 7 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
index.restoreNativeOperation (cognitive 187) REDACTED:10758— index.restoreNativeOperation has cognitive complexity 187 (threshold 15). Drivers by points: if/else 62 (112 pts), ternaries 16 (36 pts), boolean chains 33, loops 3 (6 pts) (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.spawnWrapped (cognitive 162) REDACTED:6591— index.spawnWrapped has cognitive complexity 162 (threshold 15). Drivers by points: if/else 50 (77 pts), boolean chains 48, ternaries 23 (34 pts), loops 1 (2 pts), error handling 1 (nesting depth added 39). Of this number, 161 points are the body's own statements and 1 belongs to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
onboard.onboard (cognitive 145) packages/cli/src/modules/onboard.ts:123— onboard.onboard has cognitive complexity 145 (threshold 15). Drivers by points: if/else 38 (63 pts), ternaries 24 (62 pts), boolean chains 9, loops 5 (7 pts), error handling 2 (4 pts) (nesting depth added 67). Of this number, 141 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
compressors.summarizeElided (cognitive 142) engine/compressors/invariants.go:207— compressors.summarizeElided has cognitive complexity 142 (threshold 15). Drivers by points: if/else 33 (114 pts), loops 7 (11 pts), match/switch 3 (10 pts), boolean chains 7 (nesting depth added 92). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
index.syncAutoEntries (cognitive 112) REDACTED:4347— index.syncAutoEntries has cognitive complexity 112 (threshold 15). Drivers by points: if/else 22 (73 pts), loops 4 (12 pts), ternaries 3 (12 pts), boolean chains 10, error handling 2 (5 pts) (nesting depth added 71). Most of this is not in the body itself: 3 of the 112 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 4351, 4354). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
_native.leaves (cognitive 110) packages/middleware/python/caveman_middleware/_native.py:107— _native.leaves has cognitive complexity 110 (threshold 15). Drivers by points: if/else 19 (54 pts), loops 11 (27 pts), boolean chains 20, ternaries 2 (9 pts) (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.rewriteRequest (cognitive 107) REDACTED:1523— Server.rewriteRequest has cognitive complexity 107 (threshold 15). Drivers by points: if/else 43 (84 pts), loops 7 (12 pts), boolean chains 11 (nesting depth added 46). Of this number, 100 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.qwenRouteOverride (cognitive 103) REDACTED:15406— index.qwenRouteOverride has cognitive complexity 103 (threshold 15). Drivers by points: if/else 41 (76 pts), boolean chains 16, ternaries 2 (6 pts), loops 3 (5 pts) (nesting depth added 41). Of this number, 102 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeIntegrationStatus (cognitive 96) REDACTED:11303— index.nativeIntegrationStatus has cognitive complexity 96 (threshold 15). Drivers by points: ternaries 31 (64 pts), boolean chains 22, if/else 7 (9 pts), loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
provider-leaves.selectLeaves (cognitive 95) packages/middleware/typescript/src/provider-leaves.ts:7— provider-leaves.selectLeaves has cognitive complexity 95 (threshold 15). Drivers by points: if/else 29 (49 pts), boolean chains 32, ternaries 4 (9 pts), loops 2 (5 pts) (nesting depth added 28). Most of this is not in the body itself: 12 of the 95 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 32, a function literal at line 71, a function literal at line 54, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
Store.BuildStatsReport (cognitive 92) proxy/internal/store/stats.go:198— Store.BuildStatsReport has cognitive complexity 92 (threshold 15). Drivers by points: if/else 37 (71 pts), boolean chains 13, loops 5 (6 pts), match/switch 1 (2 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeHook (cognitive 91) REDACTED:17364— index.nativeHook has cognitive complexity 91 (threshold 15). Drivers by points: boolean chains 34, if/else 24 (28 pts), ternaries 14 (23 pts), error handling 4 (6 pts) (nesting depth added 15). Of this number, 88 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.enableNative (cognitive 87) REDACTED:10601— index.enableNative has cognitive complexity 87 (threshold 15). Drivers by points: if/else 19 (46 pts), ternaries 11 (33 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 51). Of this number, 44 points are the body's own statements and 43 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
installOpencode (cognitive 87) REDACTED:1505— installOpencode has cognitive complexity 87 (threshold 15). Drivers by points: if/else 26 (44 pts), ternaries 7 (21 pts), boolean chains 11, error handling 3 (8 pts), loops 3 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime.optimize (cognitive 85) packages/sdk/python/caveman_cloud/middleware/runtime.py:435— MiddlewareRuntime.optimize has cognitive complexity 85 (threshold 15). Drivers by points: ternaries 19 (34 pts), if/else 23 (30 pts), boolean chains 14, error handling 5, loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
evals.validateJSONSchema (cognitive 82) engine/evals/graders.go:256— evals.validateJSONSchema has cognitive complexity 82 (threshold 15). Drivers by points: if/else 23 (58 pts), loops 5 (14 pts), boolean chains 9, match/switch 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Cave.assemble (cognitive 82) packages/sdk/python/caveman_cloud/core.py:425— Cave.assemble has cognitive complexity 82 (threshold 15). Drivers by points: if/else 28 (61 pts), loops 3 (10 pts), boolean chains 7, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
translate.streamChatToResponses (cognitive 80) proxy/internal/translate/responses_stream.go:657— translate.streamChatToResponses has cognitive complexity 80 (threshold 15). Drivers by points: if/else 26 (66 pts), loops 4 (7 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 45). Of this number, 75 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validate (cognitive 80) agents/compile.mjs:289— validate has cognitive complexity 80 (threshold 15). Drivers by points: if/else 25 (41 pts), boolean chains 31, loops 5 (6 pts), ternaries 1 (2 pts) (nesting depth added 18). Of this number, 76 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.stripRetrieveCall (cognitive 79) proxy/internal/gateway/retrieve_tool.go:721— gateway.stripRetrieveCall has cognitive complexity 79 (threshold 15). Drivers by points: if/else 25 (64 pts), loops 6 (14 pts), boolean chains 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Reply.relay (cognitive 79) proxy/internal/translate/translate.go:558— Reply.relay has cognitive complexity 79 (threshold 15). Drivers by points: if/else 26 (57 pts), boolean chains 17, match/switch 2 (4 pts), loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.installClaude (cognitive 79) REDACTED:565— install.installClaude has cognitive complexity 79 (threshold 15). Drivers by points: if/else 27 (42 pts), ternaries 6 (18 pts), boolean chains 11, error handling 3 (8 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.chatgpt (cognitive 78) proxy/internal/gateway/chatgpt.go:54— Server.chatgpt has cognitive complexity 78 (threshold 15). Drivers by points: if/else 39 (61 pts), boolean chains 14, match/switch 1 (3 pts) (nesting depth added 24). Of this number, 72 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.chatGPTAuto (cognitive 78) proxy/internal/gateway/chatgpt_auto.go:164— Server.chatGPTAuto has cognitive complexity 78 (threshold 15). Drivers by points: if/else 33 (53 pts), boolean chains 21, match/switch 2 (3 pts), loops 1 (nesting depth added 21). Of this number, 77 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.validateReceiptContent (cognitive 78) REDACTED:21140— index.validateReceiptContent has cognitive complexity 78 (threshold 15). Drivers by points: if/else 37 (54 pts), boolean chains 23, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.streamResponsesToChat (cognitive 74) proxy/internal/translate/chat_stream.go:432— translate.streamResponsesToChat has cognitive complexity 74 (threshold 15). Drivers by points: if/else 20 (59 pts), loops 2 (6 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity· run (cognitive 74) · ×1
run (cognitive 74) src/hooks/caveman-activate.js:392— run has cognitive complexity 74 (threshold 15). Drivers by points: if/else 26 (40 pts), ternaries 8 (13 pts), boolean chains 10, error handling 5 (7 pts), loops 2 (4 pts) (nesting depth added 23). Of this number, 53 points are the body's own statements and 21 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providers.requestPricingUnsupportedReason (cognitive 73) proxy/providers/adapter.go:1753— providers.requestPricingUnsupportedReason has cognitive complexity 73 (threshold 15). Drivers by points: if/else 19 (45 pts), loops 6 (12 pts), boolean chains 11, match/switch 2 (5 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.scanConfirmedFixMetrics (cognitive 71) proxy/internal/store/learn_outcomes.go:288— store.scanConfirmedFixMetrics has cognitive complexity 71 (threshold 15). Drivers by points: if/else 16 (42 pts), loops 10 (21 pts), boolean chains 8 (nesting depth added 37). Of this number, 24 points are the body's own statements and 47 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responsesToMessages.consume (cognitive 71) proxy/internal/translate/messages_responses.go:84— responsesToMessages.consume has cognitive complexity 71 (threshold 15). Drivers by points: if/else 21 (51 pts), boolean chains 10, match/switch 3 (7 pts), loops 1 (3 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.buildWrapEnv (cognitive 70) REDACTED:12251— index.buildWrapEnv has cognitive complexity 70 (threshold 15). Drivers by points: if/else 26 (43 pts), boolean chains 12, ternaries 5 (8 pts), error handling 2 (5 pts), loops 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.cleanClaudeProfile (cognitive 67) REDACTED:11095— index.cleanClaudeProfile has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (51 pts), boolean chains 8, loops 3 (8 pts) (nesting depth added 35). Of this number, 53 points are the body's own statements and 14 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
apply.planModules (cognitive 66) packages/cli/src/modules/apply.ts:363— apply.planModules has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 12 (26 pts), if/else 9 (16 pts), loops 9 (14 pts), boolean chains 5, error handling 2 (5 pts) (nesting depth added 29). Of this number, 63 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.writeReceipt (cognitive 65) proxy/internal/nativeruntime/receipt.go:38— Runtime.writeReceipt has cognitive complexity 65 (threshold 15). Drivers by points: if/else 22 (48 pts), boolean chains 9, match/switch 3 (7 pts), loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.streamAnthropicToChat (cognitive 65) proxy/internal/translate/chat_stream.go:304— translate.streamAnthropicToChat has cognitive complexity 65 (threshold 15). Drivers by points: if/else 18 (53 pts), match/switch 3 (8 pts), boolean chains 3, loops 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
apply.applyModules (cognitive 65) packages/cli/src/modules/apply.ts:464— apply.applyModules has cognitive complexity 65 (threshold 15). Drivers by points: if/else 18 (26 pts), ternaries 10 (20 pts), loops 7 (10 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 22). Of this number, 60 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.kiloRouteOverride (cognitive 65) REDACTED:15179— index.kiloRouteOverride has cognitive complexity 65 (threshold 15). Drivers by points: if/else 22 (49 pts), boolean chains 9, ternaries 3 (6 pts), loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.assemble (cognitive 65) packages/sdk/typescript/src/index.ts:1818— index.assemble has cognitive complexity 65 (threshold 15). Drivers by points: if/else 20 (42 pts), loops 3 (11 pts), boolean chains 9, ternaries 1 (2 pts), error handling 1 (nesting depth added 31). Of this number, 55 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
handle (cognitive 65) src/hooks/caveman-mode-tracker.js:142— handle has cognitive complexity 65 (threshold 15). Drivers by points: if/else 27 (39 pts), boolean chains 15, ternaries 4 (8 pts), error handling 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.perMessage (cognitive 64) proxy/internal/gateway/route.go:973— gateway.perMessage has cognitive complexity 64 (threshold 15). Drivers by points: if/else 24 (48 pts), boolean chains 11, loops 3 (4 pts), match/switch 1 (nesting depth added 25). Of this number, 59 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providers.mergeSnakeUsage (cognitive 64) proxy/providers/adapter.go:1451— providers.mergeSnakeUsage has cognitive complexity 64 (threshold 15). Drivers by points: if/else 28 (52 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.setup (cognitive 64) REDACTED:3841— index.setup has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (23 pts), error handling 5 (16 pts), ternaries 6 (13 pts), boolean chains 12 (nesting depth added 26). Of this number, 24 points are the body's own statements and 40 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ai-sdk.project (cognitive 64) packages/middleware/typescript/src/ai-sdk.ts:137— ai-sdk.project has cognitive complexity 64 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 16, loops 5 (8 pts), ternaries 4 (7 pts) (nesting depth added 25). Of this number, 60 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.focusAXRecords (cognitive 63) engine/compressors/axtree.go:374— compressors.focusAXRecords has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (35 pts), loops 11 (19 pts), boolean chains 9 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.containsNonTextInput (cognitive 63) proxy/internal/gateway/stats_accounting.go:173— gateway.containsNonTextInput has cognitive complexity 63 (threshold 15). Drivers by points: if/else 11 (46 pts), loops 3 (9 pts), match/switch 3 (7 pts), boolean chains 1 (nesting depth added 45). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Server.applyEffort (cognitive 62) proxy/internal/gateway/route.go:781— Server.applyEffort has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (36 pts), boolean chains 22, loops 1 (2 pts), match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.installHooks (cognitive 62) REDACTED:1775— install.installHooks has cognitive complexity 62 (threshold 15). Drivers by points: if/else 15 (20 pts), error handling 7 (13 pts), boolean chains 10, ternaries 7 (10 pts), loops 6 (9 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsonCompressor.selectArray (cognitive 61) engine/compressors/json.go:142— jsonCompressor.selectArray has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (37 pts), loops 13 (21 pts), boolean chains 3 (nesting depth added 28). Of this number, 48 points are the body's own statements and 13 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.learn (cognitive 61) REDACTED:19988— index.learn has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (27 pts), ternaries 9 (22 pts), boolean chains 10, error handling 1 (2 pts) (nesting depth added 22). Of this number, 56 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.chatResponsesBody (cognitive 60) proxy/internal/translate/chat_in.go:317— translate.chatResponsesBody has cognitive complexity 60 (threshold 15). Drivers by points: if/else 26 (45 pts), boolean chains 8, match/switch 4 (5 pts), loops 1 (2 pts) (nesting depth added 21). Of this number, 33 points are the body's own statements and 27 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeIntegrationStatus.files (cognitive 60) REDACTED:11310— index.nativeIntegrationStatus.files has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 22, ternaries 7 (21 pts), if/else 14 (15 pts), error handling 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.status (cognitive 60) REDACTED:20832— index.status has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 21 (26 pts), if/else 20, boolean chains 14 (nesting depth added 5). Of this number, 57 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
caveman-parse.parseModeChange (cognitive 60) src/hooks/caveman-parse.js:209— caveman-parse.parseModeChange has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 14, ternaries 3 (9 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.respond (cognitive 59) proxy/internal/nativeruntime/runtime.go:301— Runtime.respond has cognitive complexity 59 (threshold 15). Drivers by points: if/else 30 (49 pts), boolean chains 8, loops 1, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.streamAnthropicToResponses (cognitive 59) proxy/internal/translate/responses_stream.go:488— translate.streamAnthropicToResponses has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (44 pts), match/switch 4 (11 pts), boolean chains 3, loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderRouter.apply (cognitive 59) packages/pi-extension/src/provider.ts:64— ProviderRouter.apply has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (25 pts), ternaries 9 (18 pts), boolean chains 9, error handling 4 (7 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
doctor.modulesDoctor (cognitive 58) packages/cli/src/modules/doctor.ts:9— doctor.modulesDoctor has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (26 pts), ternaries 6 (18 pts), loops 7 (8 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.installGemini (cognitive 57) REDACTED:719— install.installGemini has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (25 pts), error handling 6 (16 pts), boolean chains 9, ternaries 2 (7 pts) (nesting depth added 22). Of this number, 45 points are the body's own statements and 12 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeDoctor (cognitive 56) REDACTED:11556— index.nativeDoctor has cognitive complexity 56 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 14, ternaries 9 (13 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.renderLearnPlan (cognitive 56) REDACTED:19390— index.renderLearnPlan has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (35 pts), ternaries 8 (19 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.main (cognitive 55) REDACTED:2729— install.main has cognitive complexity 55 (threshold 15). Drivers by points: if/else 26 (39 pts), boolean chains 9, loops 4 (7 pts) (nesting depth added 16). Of this number, 54 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.mcpInstall (cognitive 55) REDACTED:16101— index.mcpInstall has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (26 pts), ternaries 6 (21 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (nesting depth added 24). Of this number, 38 points are the body's own statements and 17 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validate.validate (cognitive 55) REDACTED:31— validate.validate has cognitive complexity 55 (threshold 15). Drivers by points: if/else 20 (36 pts), boolean chains 7, loops 3 (7 pts), ternaries 2 (5 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.responsesChatBody (cognitive 54) proxy/internal/translate/responses_in.go:384— translate.responsesChatBody has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (40 pts), loops 5 (9 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google.project (cognitive 54) packages/middleware/typescript/src/google.ts:99— google.project has cognitive complexity 54 (threshold 15). Drivers by points: if/else 9 (28 pts), boolean chains 11, ternaries 3 (9 pts), loops 1 (6 pts) (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
index.agentShortcut (cognitive 53) REDACTED:6363— index.agentShortcut has cognitive complexity 53 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 11, ternaries 6 (9 pts), error handling 3 (4 pts), loops 2 (nesting depth added 11). Of this number, 48 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mastra.createProcessor.prepare (cognitive 52) packages/middleware/typescript/src/mastra.ts:180— mastra.createProcessor.prepare has cognitive complexity 52 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 13, loops 4 (8 pts), ternaries 2 (6 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caveman-config.safeWriteFlag (cognitive 52) src/hooks/caveman-config.js:225— caveman-config.safeWriteFlag has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (36 pts), error handling 7 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Server.serveTarget (cognitive 51) proxy/internal/gateway/route_pool.go:77— Server.serveTarget has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 13, match/switch 2 (3 pts), loops 1 (nesting depth added 11). Of this number, 49 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.simulateLearnPlan (cognitive 51) proxy/internal/store/learn_simulate.go:46— store.simulateLearnPlan has cognitive complexity 51 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 6, loops 5 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport.createCavemanFetch::cavemanFetch (cognitive 51) packages/middleware/typescript/src/transport.ts:81— transport.createCavemanFetch::cavemanFetch has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 8 (15 pts), boolean chains 10, error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
evals.Grade (cognitive 50) engine/evals/graders.go:50— evals.Grade has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (44 pts), match/switch 2 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
index.buildOpenClawOverlay (cognitive 50) REDACTED:11800— index.buildOpenClawOverlay has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 11 (21 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.hooksCmd (cognitive 50) REDACTED:18583— index.hooksCmd has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (38 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.runLearn (cognitive 49) proxy/cmd/caveman-proxy/main.go:823— main.runLearn has cognitive complexity 49 (threshold 15). Drivers by points: if/else 23 (46 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Link.ask (cognitive 49) proxy/internal/cloudlink/link.go:1111— Link.ask has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (31 pts), match/switch 5 (8 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 15). Of this number, 41 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.ServeHTTP (cognitive 49) proxy/internal/middleware/http.go:48— Runtime.ServeHTTP has cognitive complexity 49 (threshold 15). Drivers by points: if/else 30 (42 pts), boolean chains 5, match/switch 2 (nesting depth added 12). Of this number, 41 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.replayCompressionMove (cognitive 49) proxy/internal/store/trial_store.go:515— Store.replayCompressionMove has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 23). Of this number, 48 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.responsesZones (cognitive 49) proxy/providers/openai/content_compress.go:184— openai.responsesZones has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 11, loops 3 (4 pts), match/switch 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
collectInjectionModelIds (cognitive 49) agents/compile.mjs:222— collectInjectionModelIds has cognitive complexity 49 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 5 (17 pts), boolean chains 10 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.publish (cognitive 48) REDACTED:417— Runtime.publish has cognitive complexity 48 (threshold 15). Drivers by points: if/else 25 (37 pts), loops 6 (7 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.scanLearnSessionMetricsUntil (cognitive 48) proxy/internal/store/learn_portfolio.go:140— store.scanLearnSessionMetricsUntil has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (31 pts), boolean chains 9, loops 4 (8 pts) (nesting depth added 22). Most of this is not in the body itself: 13 of the 48 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 161, 153). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.runCavemanDeviceFlow (cognitive 48) packages/device-auth/src/index.ts:114— index.runCavemanDeviceFlow has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (28 pts), ternaries 4 (11 pts), boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.chatMessagesBody (cognitive 47) proxy/internal/translate/chat_in.go:85— translate.chatMessagesBody has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (34 pts), boolean chains 7, loops 2 (5 pts), match/switch 1 (nesting depth added 14). Most of this is not in the body itself: 13 of the 47 points are its own statements and the rest belongs to one function literal inside it that branches (line 95). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
CavemanASGIMiddleware.__call__ (cognitive 47) packages/middleware/python/caveman_middleware/asgi.py:79— CavemanASGIMiddleware.__call__ has cognitive complexity 47 (threshold 15). Drivers by points: if/else 25 (33 pts), boolean chains 7, error handling 5 (6 pts), loops 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
owned-install.installOwned (cognitive 47) installer/lib/owned-install.js:234— owned-install.installOwned has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 8, ternaries 3 (6 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessionEventConsumer.consume (cognitive 46) proxy/internal/store/session_source.go:118— sessionEventConsumer.consume has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (36 pts), boolean chains 6, loops 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providers.parseUsageBytes (cognitive 46) proxy/providers/adapter.go:986— providers.parseUsageBytes has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (33 pts), boolean chains 9, match/switch 1 (3 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.retroStreamCutTokens (cognitive 45) proxy/internal/store/learn_retro.go:338— store.retroStreamCutTokens has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 7 (10 pts), boolean chains 9 (nesting depth added 16). Of this number, 44 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
owned-install.uninstallOwned (cognitive 45) installer/lib/owned-install.js:306— owned-install.uninstallOwned has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 6, ternaries 3 (6 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
native-hook-fast.main (cognitive 45) packages/cli/src/native-hook-fast.ts:434— native-hook-fast.main has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 18, ternaries 7, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
measureHarness (cognitive 45) packages/subagent-tax/run.mjs:154— measureHarness has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 9 (13 pts), if/else 9 (11 pts), boolean chains 7, other 7, error handling 2 (4 pts), loops 3 (nesting depth added 8). Of this number, 34 points are the body's own statements and 11 belong to 12 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.readJSONTOONValue (cognitive 44) engine/compressors/toon_encode.go:123— compressors.readJSONTOONValue has cognitive complexity 44 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 2 (6 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.appendChatMessage (cognitive 44) proxy/internal/translate/messages_in.go:412— translate.appendChatMessage has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 6, loops 2 (5 pts), match/switch 2 (nesting depth added 16). Of this number, 19 points are the body's own statements and 25 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.parsePytestJSON (cognitive 43) engine/compressors/testreport.go:289— compressors.parsePytestJSON has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.runServe (cognitive 43) proxy/cmd/caveman-proxy/main.go:201— main.runServe has cognitive complexity 43 (threshold 15). Drivers by points: if/else 27 (32 pts), boolean chains 6, loops 3, match/switch 2 (nesting depth added 5). Of this number, 38 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
middleware.caseFolded (cognitive 43) proxy/internal/middleware/presence.go:88— middleware.caseFolded has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 6 (13 pts), boolean chains 1, match/switch 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
run.main (cognitive 43) packages/subagent-tax/run.mjs:340— run.main has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 8 (12 pts), loops 7 (10 pts), boolean chains 6 (nesting depth added 16). Of this number, 41 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tabularCompressor.compress (cognitive 42) engine/compressors/tabular.go:86— tabularCompressor.compress has cognitive complexity 42 (threshold 15). Drivers by points: if/else 22 (32 pts), loops 7 (8 pts), boolean chains 2 (nesting depth added 11). Of this number, 39 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.parseRetrieveCall (cognitive 42) proxy/internal/gateway/retrieve_tool.go:392— gateway.parseRetrieveCall has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (34 pts), loops 4 (8 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.retrieve (cognitive 42) proxy/internal/middleware/recovery.go:20— Runtime.retrieve has cognitive complexity 42 (threshold 15). Drivers by points: if/else 26 (33 pts), boolean chains 8, loops 1 (nesting depth added 7). Of this number, 35 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
requestScan.str (cognitive 42) proxy/providers/inspect.go:253— requestScan.str has cognitive complexity 42 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 3 (10 pts), boolean chains 9, loops 3 (7 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanModel._project (cognitive 42) packages/middleware/python/caveman_middleware/strands.py:65— CavemanModel._project has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 7 (10 pts), loops 4 (7 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.parseTOONObject (cognitive 41) engine/compressors/toon_decode.go:90— compressors.parseTOONObject has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 4, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Link.decide (cognitive 41) proxy/internal/cloudlink/link.go:559— Link.decide has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 11 (nesting depth added 9). Of this number, 29 points are the body's own statements and 12 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.runRetrieveLoop (cognitive 41) proxy/internal/gateway/retrieve_tool.go:924— Server.runRetrieveLoop has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (40 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.treeAt (cognitive 41) proxy/internal/translate/jsonfast.go:592— translate.treeAt has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (33 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.transformResponse (cognitive 41) src/mcp-servers/caveman-shrink/index.js:146— index.transformResponse has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 5 (12 pts), boolean chains 2 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
pruneOrphanedManagedHooks (cognitive 41) installer/lib/settings.js:345— pruneOrphanedManagedHooks has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 13, loops 2 (3 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 12). Of this number, 22 points are the body's own statements and 19 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.comparableConfigTokens (cognitive 40) proxy/internal/store/learn_outcomes.go:538— store.comparableConfigTokens has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 4 (10 pts), boolean chains 1, match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
store.buildLearnTrends (cognitive 40) proxy/internal/store/learn_trends.go:275— store.buildLearnTrends has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 6 (8 pts), boolean chains 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
opencodeSessionSource.scanSession (cognitive 40) proxy/internal/store/source_opencode.go:51— opencodeSessionSource.scanSession has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime.#optimize (cognitive 40) packages/sdk/typescript/src/middleware/runtime.ts:374— MiddlewareRuntime.#optimize has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 8, ternaries 4 (7 pts), loops 2 (nesting depth added 9). Of this number, 39 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.sanitizeRequestRecord (cognitive 39) proxy/internal/store/store.go:493— store.sanitizeRequestRecord has cognitive complexity 39 (threshold 15). Drivers by points: if/else 25, boolean chains 12, match/switch 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Base.SanitizeAndMapHeaders (cognitive 39) proxy/providers/adapter.go:556— Base.SanitizeAndMapHeaders has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
apply.inactiveReason (cognitive 39) packages/cli/src/modules/apply.ts:567— apply.inactiveReason has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 4 (8 pts), boolean chains 6, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.formatSessionSavings (cognitive 39) REDACTED:5730— index.formatSessionSavings has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 13 (16 pts), if/else 12 (13 pts), boolean chains 10 (nesting depth added 4). Of this number, 37 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.claudeProfileMutations (cognitive 39) REDACTED:8802— index.claudeProfileMutations has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 10, ternaries 6 (7 pts), loops 3 (4 pts), error handling 1 (3 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Creds.Resolve (cognitive 38) proxy/internal/standalone/standalone.go:145— Creds.Resolve has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 7, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.retroSessionPathsUntil (cognitive 38) proxy/internal/store/learn_retro.go:561— store.retroSessionPathsUntil has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 14). Of this number, 16 points are the body's own statements and 22 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
version.cmpVersion (cognitive 38) agents/version.mjs:2— version.cmpVersion has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 5 (15 pts), boolean chains 3, loops 2 (nesting depth added 17). Of this number, 37 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.login (cognitive 38) REDACTED:12570— index.login has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 15, if/else 11, ternaries 9 (11 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
middleware.New (cognitive 37) REDACTED:122— middleware.New has cognitive complexity 37 (threshold 15). Drivers by points: if/else 25 (29 pts), boolean chains 6, loops 2 (nesting depth added 4). Of this number, 34 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
catalog.DecodeAndValidate (cognitive 37) shared/platform/catalog/catalog.go:341— catalog.DecodeAndValidate has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google.delegatedClient (cognitive 37) packages/middleware/typescript/src/google.ts:154— google.delegatedClient has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 7 (12 pts), error handling 3 (6 pts), boolean chains 4 (nesting depth added 17). Most of this is not in the body itself: 3 of the 37 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 165, 175, 156, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
gateway.collectOpenAIChatPixelLiveZone (cognitive 36) proxy/internal/gateway/pixel.go:402— gateway.collectOpenAIChatPixelLiveZone has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 5, loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.newRouteRun (cognitive 36) proxy/internal/gateway/route.go:443— gateway.newRouteRun has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 9, match/switch 4 (8 pts), loops 2 (nesting depth added 11). Of this number, 34 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validate_catalog.validate_row (cognitive 36) shared/provider-catalog/validate_catalog.py:116— validate_catalog.validate_row has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 8, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.stripJsonComments (cognitive 36) installer/lib/settings.js:30— settings.stripJsonComments has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent-mcp.validateTraceFilters (cognitive 36) packages/cli/src/agent-mcp.ts:445— agent-mcp.validateTraceFilters has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 11, loops 3 (nesting depth added 9). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
onboard.choose (cognitive 36) packages/cli/src/modules/onboard.ts:763— onboard.choose has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 10 (16 pts), if/else 9 (10 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 8). None of this is in the body itself: all 36 points belong to 7 function items inside it that branch (a function literal at line 803, render, gaveWay, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.learnSummaryMoves (cognitive 36) REDACTED:19202— index.learnSummaryMoves has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 9 (24 pts), if/else 6 (11 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
verbs-gate.scanSkillBody (cognitive 36) skills/verbs-gate.mjs:164— verbs-gate.scanSkillBody has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 7, loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
attributeByMode (cognitive 36) src/hooks/caveman-stats.js:289— attributeByMode has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 12, loops 3 (4 pts) (nesting depth added 8). Of this number, 35 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.parseJestJSON (cognitive 35) engine/compressors/testreport.go:395— compressors.parseJestJSON has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.stripToolSchema (cognitive 35) proxy/internal/gateway/toolschema_strip.go:97— Server.stripToolSchema has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 6 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.outcomeSink (cognitive 35) proxy/internal/store/detect_outcomes.go:154— store.outcomeSink has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 12). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.AttachLearnTrendHistory (cognitive 35) proxy/internal/store/learn_trends.go:376— store.AttachLearnTrendHistory has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 9 (10 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime.report (cognitive 35) packages/sdk/python/caveman_cloud/middleware/runtime.py:388— MiddlewareRuntime.report has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 17, boolean chains 11, if/else 4 (5 pts), error handling 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.hookCommandTokens (cognitive 35) REDACTED:7908— index.hookCommandTokens has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 7, loops 1, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.qwenControlSurfaceOverride (cognitive 35) REDACTED:15342— index.qwenControlSurfaceOverride has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 5, loops 3, ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.transactOwnedMcpConfig (cognitive 35) REDACTED:15982— index.transactOwnedMcpConfig has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 5 (7 pts), boolean chains 5, error handling 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.renderLearnSavings (cognitive 35) REDACTED:19705— index.renderLearnSavings has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 7 (20 pts), loops 6 (10 pts), if/else 2 (3 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.usage (cognitive 35) REDACTED:20248— index.usage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 9 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ingest.toRow (cognitive 35) supabase/functions/cli-telemetry/ingest.ts:89— ingest.toRow has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 23, if/else 9, ternaries 2, loops 1. Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
uninstallOpenclaw (cognitive 35) REDACTED:431— uninstallOpenclaw has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 2 (6 pts), boolean chains 5, error handling 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.parseTOONArray (cognitive 34) engine/compressors/toon_decode.go:160— compressors.parseTOONArray has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.buildLearnPlan (cognitive 34) proxy/internal/store/learn.go:171— Store.buildLearnPlan has cognitive complexity 34 (threshold 15). Drivers by points: if/else 27 (28 pts), boolean chains 4, loops 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.sseLines (cognitive 34) proxy/internal/translate/messages_stream.go:71— translate.sseLines has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (5 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 18). None of this is in the body itself: all 34 points belong to 3 function literals inside it that branch (lines 101, 78, 143). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
translate.estimateInputTokens (cognitive 34) proxy/internal/translate/messages_stream.go:499— translate.estimateInputTokens has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 3 (10 pts), boolean chains 2, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
status.renderModuleGrid (cognitive 34) packages/cli/src/modules/status.ts:43— status.renderModuleGrid has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 9 (31 pts), boolean chains 1, if/else 1, loops 1 (nesting depth added 22). Of this number, 22 points are the body's own statements and 12 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
index.restoreNativeJournalFiles (cognitive 34) REDACTED:11157— index.restoreNativeJournalFiles has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 3 (7 pts), loops 3 (5 pts), ternaries 2 (5 pts), boolean chains 2 (nesting depth added 17). Of this number, 30 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.renderStatus (cognitive 34) REDACTED:20787— index.renderStatus has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 11 (13 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mastra.withCavemanMastra (cognitive 34) packages/middleware/typescript/src/mastra.ts:80— mastra.withCavemanMastra has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 7 (12 pts), boolean chains 5 (nesting depth added 12). Most of this is not in the body itself: 11 of the 34 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 118, protection, a function literal at line 108, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
mastra.createProcessor (cognitive 34) packages/middleware/typescript/src/mastra.ts:141— mastra.createProcessor has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 6 (10 pts), boolean chains 8, error handling 1 (2 pts) (nesting depth added 7). Of this number, 22 points are the body's own statements and 12 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parseSession (cognitive 34) src/hooks/caveman-stats.js:161— parseSession has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 4 (10 pts), boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CDPDriver.waitActionable (cognitive 33) browse/cdp.go:256— CDPDriver.waitActionable has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 5, match/switch 2 (5 pts), loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
main.runPixelRender (cognitive 33) engine/cmd/caveman-engine/main.go:312— main.runPixelRender has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (27 pts), match/switch 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google._prepare (cognitive 33) packages/middleware/python/caveman_middleware/google.py:303— google._prepare has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 14, if/else 14, ternaries 2 (4 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
onboard.toggle (cognitive 33) packages/cli/src/modules/onboard.ts:683— onboard.toggle has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 10 (12 pts), boolean chains 6, loops 1 (nesting depth added 7). Most of this is not in the body itself: 3 of the 33 points are its own statements and the rest belongs to 8 function items inside it that branch (render, a function literal at line 725, a function literal at line 695, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
provider-routing.verifiedProviderRoute (cognitive 33) packages/cli/src/provider-routing.ts:73— provider-routing.verifiedProviderRoute has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 10 (18 pts), if/else 7 (10 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.collectOpenAIResponsesPixelLiveZone (cognitive 32) proxy/internal/gateway/pixel.go:454— gateway.collectOpenAIResponsesPixelLiveZone has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 4, loops 2, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.record (cognitive 32) REDACTED:1865— Server.record has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 7). Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
middleware.previousPlan (cognitive 32) REDACTED:721— middleware.previousPlan has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.messagesToResponses (cognitive 32) proxy/internal/translate/messages_in.go:714— translate.messagesToResponses has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 3, loops 1 (3 pts), match/switch 1 (nesting depth added 13). Most of this is not in the body itself: 2 of the 32 points are its own statements and the rest belongs to one function literal inside it that branches (line 719). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
llama_index._message_view (cognitive 32) packages/middleware/python/caveman_middleware/llama_index.py:242— llama_index._message_view has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (7 pts), ternaries 2 (6 pts), boolean chains 3, error handling 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
verify-extension-stage.verifyExtensionRoot (cognitive 32) extension/scripts/verify-extension-stage.mjs:79— verify-extension-stage.verifyExtensionRoot has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 6 (8 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
command-args.parseCommandArgs (cognitive 32) installer/lib/command-args.js:6— command-args.parseCommandArgs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.parseArgs (cognitive 32) REDACTED:88— install.parseArgs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.hooksDirectiveCmd (cognitive 32) REDACTED:18530— index.hooksDirectiveCmd has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 2 (6 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
langchain-model.prepareLangChain (cognitive 32) packages/middleware/typescript/src/langchain-model.ts:59— langchain-model.prepareLangChain has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 3 (5 pts), boolean chains 4, ternaries 3 (nesting depth added 8). Most of this is not in the body itself: 4 of the 32 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 67, 72, 80, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
compressors.parseJUnitXML (cognitive 31) engine/compressors/testreport.go:164— compressors.parseJUnitXML has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 17). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.appendRetrieveResult (cognitive 31) proxy/internal/gateway/retrieve_tool.go:514— gateway.appendRetrieveResult has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
postgresMiddlewareTx.ExpireBatch (cognitive 31) proxy/internal/store/middleware_postgres.go:542— postgresMiddlewareTx.ExpireBatch has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
snapshot_contract.validate_snapshot (cognitive 31) evals/snapshot_contract.py:30— snapshot_contract.validate_snapshot has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openclaw.installOpenclaw (cognitive 31) REDACTED:353— openclaw.installOpenclaw has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (19 pts), error handling 4 (7 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stats-cli.renderStatsSummary (cognitive 31) packages/cli/src/stats-cli.ts:105— stats-cli.renderStatsSummary has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 6 (13 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 14). Of this number, 28 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.stripJson5Comments (cognitive 31) REDACTED:7254— index.stripJson5Comments has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.syncLocalSavings (cognitive 31) REDACTED:13214— index.syncLocalSavings has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 6 (9 pts), boolean chains 5, error handling 3, loops 2 (3 pts) (nesting depth added 6). Of this number, 20 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.qwenArgsPermitRecovery (cognitive 31) REDACTED:15626— index.qwenArgsPermitRecovery has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
formatStats (cognitive 31) src/hooks/caveman-stats.js:413— formatStats has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 9, if/else 7 (9 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prefixMonitor.observe (cognitive 30) proxy/internal/gateway/prefix_monitor.go:134— prefixMonitor.observe has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 12, match/switch 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.ensureTaskContract (cognitive 30) proxy/internal/nativeruntime/runtime.go:978— Runtime.ensureTaskContract has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 6, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.measureAppliedFix (cognitive 30) proxy/internal/store/learn_outcomes.go:437— store.measureAppliedFix has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 3 (5 pts), match/switch 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanLLM._options (cognitive 30) packages/middleware/python/caveman_middleware/llama_index.py:431— CavemanLLM._options has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 4 (6 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_ContextPacking.pack (cognitive 30) packages/sdk/python/caveman_cloud/core.py:970— _ContextPacking.pack has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, loops 5 (6 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent-mcp.validateTraceSearch (cognitive 30) packages/cli/src/agent-mcp.ts:507— agent-mcp.validateTraceSearch has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 9). Of this number, 28 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stats-cli.parseStatsOptions (cognitive 30) packages/cli/src/stats-cli.ts:32— stats-cli.parseStatsOptions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 7, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.setupInstallLocked (cognitive 30) REDACTED:3231— index.setupInstallLocked has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 5 (9 pts), boolean chains 2, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.mem (cognitive 30) REDACTED:20147— index.mem has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
index.default (cognitive 30) packages/pi-extension/src/index.ts:112— index.default has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 9, error handling 3, ternaries 3 (nesting depth added 1). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 178, a function literal at line 234, a function literal at line 265, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
caveman-config.appendFlag (cognitive 30) src/hooks/caveman-config.js:448— caveman-config.appendFlag has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), error handling 5 (7 pts), ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CDPDriver.Act (cognitive 29) browse/cdp.go:160— CDPDriver.Act has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
compressors.curateAXTree (cognitive 29) engine/compressors/axtree.go:145— compressors.curateAXTree has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 8 (11 pts), boolean chains 3 (nesting depth added 8). Of this number, 20 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.expandYAMLContext (cognitive 29) engine/compressors/config.go:207— compressors.expandYAMLContext has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 5 (9 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.anomalyIndices (cognitive 29) engine/compressors/json.go:333— compressors.anomalyIndices has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 8 (13 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
annotationStripper.walkObject (cognitive 29) engine/compressors/toolschema_annotations.go:237— annotationStripper.walkObject has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cloudlink.askTextFor (cognitive 29) proxy/internal/cloudlink/link.go:966— cloudlink.askTextFor has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 6, match/switch 2 (4 pts), loops 1 (nesting depth added 12). Of this number, 25 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.armCacheWarm (cognitive 29) REDACTED:614— Server.armCacheWarm has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 3 (6 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.validate (cognitive 29) proxy/internal/middleware/validate.go:34— Runtime.validate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 9, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.duplicateRulesSink (cognitive 29) proxy/internal/store/detect_memory_health.go:571— store.duplicateRulesSink has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.responsesMessagesBody (cognitive 29) proxy/internal/translate/responses_in.go:166— translate.responsesMessagesBody has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Adapter.ResolveUpstreamURL (cognitive 29) proxy/providers/bedrock/routing.go:147— Adapter.ResolveUpstreamURL has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 3, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime.__init__ (cognitive 29) packages/sdk/python/caveman_cloud/middleware/runtime.py:206— MiddlewareRuntime.__init__ has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 7, if/else 5 (6 pts), error handling 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
release-smoke.main (cognitive 29) REDACTED:33— release-smoke.main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 7, error handling 2 (3 pts), ternaries 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
install.inspectOmpRegistration (cognitive 29) REDACTED:1344— install.inspectOmpRegistration has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, error handling 3 (6 pts) (nesting depth added 9). Of this number, 27 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeHooksDocument (cognitive 29) REDACTED:8016— index.nativeHooksDocument has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 9 (14 pts), if/else 5 (8 pts), boolean chains 5, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime.#exchange (cognitive 29) packages/sdk/typescript/src/middleware/runtime.ts:633— MiddlewareRuntime.#exchange has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 4 (5 pts), boolean chains 4, loops 2 (3 pts), error handling 2 (nesting depth added 7). Of this number, 26 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caveman-stats.findRecentSession (cognitive 29) src/hooks/caveman-stats.js:87— caveman-stats.findRecentSession has cognitive complexity 29 (threshold 15). Drivers by points: error handling 5 (9 pts), if/else 5 (9 pts), loops 4 (6 pts), boolean chains 3, ternaries 2 (nesting depth added 10). Of this number, 19 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
contextwindow.Pack (cognitive 28) engine/contextwindow/contextwindow.go:69— contextwindow.Pack has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 4, boolean chains 1 (nesting depth added 8). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.runUsage (cognitive 28) proxy/cmd/caveman-proxy/main.go:753— main.runUsage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (21 pts), match/switch 4 (7 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.gatewayScanJSONValue (cognitive 28) proxy/internal/gateway/retrieve_tool.go:227— gateway.gatewayScanJSONValue has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (17 pts), match/switch 3 (7 pts), loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.retroRepeatedStreamCandidates (cognitive 28) proxy/internal/store/learn_retro.go:456— store.retroRepeatedStreamCandidates has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 13). Of this number, 22 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.retroScanClaudeFile (cognitive 28) proxy/internal/store/learn_retro.go:633— store.retroScanClaudeFile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.injectBreakpointRaw (cognitive 28) proxy/providers/anthropic/cache_breakpoints.go:86— anthropic.injectBreakpointRaw has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (5 pts), boolean chains 4, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.collectAnthropicBlocks (cognitive 28) proxy/providers/anthropic/content_compress.go:319— anthropic.collectAnthropicBlocks has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.scanJSONValue (cognitive 28) proxy/providers/anthropic/splice.go:103— anthropic.scanJSONValue has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (17 pts), match/switch 3 (7 pts), loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Adapter.SanitizeAndMapHeaders (cognitive 28) proxy/providers/bedrock/signing.go:29— Adapter.SanitizeAndMapHeaders has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
openai.scanJSONValue (cognitive 28) proxy/providers/openai/content_compress.go:545— openai.scanJSONValue has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (17 pts), match/switch 3 (7 pts), loops 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanChatCompletionClient._project (cognitive 28) packages/middleware/python/caveman_middleware/autogen.py:234— CavemanChatCompletionClient._project has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 3 (4 pts), boolean chains 3, ternaries 2, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
google._selected (cognitive 28) packages/middleware/python/caveman_middleware/google.py:282— google._selected has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuntimePolicyClient._accept (cognitive 28) packages/sdk/python/caveman_cloud/core.py:2340— RuntimePolicyClient._accept has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 7, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuntimePolicyClient._decide (cognitive 28) packages/sdk/python/caveman_cloud/core.py:2468— RuntimePolicyClient._decide has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 5, ternaries 3, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
protocol.resolve_proxy (cognitive 28) packages/sdk/python/caveman_cloud/middleware/protocol.py:315— protocol.resolve_proxy has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, ternaries 5 (8 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.rewriteLegacyManagedHookCommands (cognitive 28) installer/lib/settings.js:302— settings.rewriteLegacyManagedHookCommands has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.importSkill (cognitive 28) REDACTED:2335— index.importSkill has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 3 (4 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.opencodeNativeMutations (cognitive 28) REDACTED:9535— index.opencodeNativeMutations has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (8 pts), ternaries 5 (7 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.hermesNativeConfig (cognitive 28) REDACTED:10132— index.hermesNativeConfig has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
probe-native-codex-recovery.upstream (cognitive 28) scripts/probe-native-codex-recovery.mjs:198— probe-native-codex-recovery.upstream has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 6 (9 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 11). None of this is in the body itself: all 28 points belong to 5 function literals inside it that branch (lines 201, 228, 245, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
caveman-config.safeDeleteFlag (cognitive 28) src/hooks/caveman-config.js:349— caveman-config.safeDeleteFlag has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 4 (6 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
main.runPixelSimulate (cognitive 27) engine/cmd/caveman-engine/main.go:509— main.runPixelSimulate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.fallbackKey (cognitive 27) proxy/internal/gateway/auth_fallback.go:55— gateway.fallbackKey has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.recordChatGPT (cognitive 27) proxy/internal/gateway/chatgpt.go:390— Server.recordChatGPT has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 6 (nesting depth added 4). Of this number, 23 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
middleware.requestPresence (cognitive 27) proxy/internal/middleware/presence.go:29— middleware.requestPresence has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nativepack.validate (cognitive 27) proxy/internal/nativepack/pack.go:91— nativepack.validate has cognitive complexity 27 (threshold 15). Drivers by points: loops 7 (12 pts), if/else 5 (11 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.saveIf (cognitive 27) proxy/internal/pool/pool.go:237— Store.saveIf has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.scanConfig (cognitive 27) proxy/internal/store/config_scan.go:169— store.scanConfig has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 2 (4 pts) (nesting depth added 13). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.collectInstructionFiles (cognitive 27) proxy/internal/store/detect_memory_health.go:189— store.collectInstructionFiles has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 6). Of this number, 20 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.buildLearnRetro (cognitive 27) proxy/internal/store/learn_retro.go:195— Store.buildLearnRetro has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 3, loops 3, match/switch 1 (nesting depth added 6). Of this number, 25 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Reply.serve (cognitive 27) proxy/internal/translate/translate.go:485— Reply.serve has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 7, match/switch 2 (3 pts) (nesting depth added 8). Of this number, 24 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanLLM._options (cognitive 27) packages/middleware/python/caveman_middleware/crewai.py:204— CavemanLLM._options has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 8, if/else 7 (8 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
snapshot_contract.validate_usage (cognitive 27) evals/snapshot_contract.py:93— snapshot_contract.validate_usage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings.stripTrailingCommas (cognitive 27) installer/lib/settings.js:70— settings.stripTrailingCommas has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
learn-trends.learnTrendTable (cognitive 27) packages/cli/src/learn-trends.ts:128— learn-trends.learnTrendTable has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (15 pts), if/else 7 (9 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). Of this number, 15 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.yamlScopedBaseUrl (cognitive 27) REDACTED:4577— index.yamlScopedBaseUrl has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 8, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.qwenWorkspaceTrusted (cognitive 27) REDACTED:14841— index.qwenWorkspaceTrusted has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wire.parseWire::walk (cognitive 27) packages/middleware/typescript/src/wire.ts:23— wire.parseWire::walk has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.contextPack (cognitive 27) packages/sdk/typescript/src/index.ts:1722— index.contextPack has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 7, loops 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
evals.runManifestWithSystem (cognitive 26) engine/evals/harness.go:217— evals.runManifestWithSystem has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oidcVerifier.verify (cognitive 26) REDACTED:220— oidcVerifier.verify has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 8, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
repointel.buildBundle (cognitive 26) proxy/internal/repointel/index.go:633— repointel.buildBundle has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 7 (9 pts), boolean chains 3, match/switch 1 (nesting depth added 8). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.sanitizeStatsMeasurement (cognitive 26) proxy/internal/store/stats.go:147— store.sanitizeStatsMeasurement has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 7, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.BuildTrialPlan (cognitive 26) proxy/internal/store/trial_store.go:222— Store.BuildTrialPlan has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 5, loops 3 (nesting depth added 2). Of this number, 19 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
translate.valueEnd (cognitive 26) proxy/internal/translate/jsonfast.go:63— translate.valueEnd has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 3 (6 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
msgBuilder.assemble (cognitive 26) proxy/internal/translate/msgbuild.go:265— msgBuilder.assemble has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.contentBlocksCarryBreakpoint (cognitive 26) proxy/providers/anthropic/breakpoint_plan.go:272— anthropic.contentBlocksCarryBreakpoint has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock.parseBedrockText (cognitive 26) proxy/providers/bedrock/usage.go:152— bedrock.parseBedrockText has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 6, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ssrf.checkAddr (cognitive 26) shared/platform/ssrf/ssrf.go:309— ssrf.checkAddr has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, loops 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validate.plan (cognitive 26) packages/sdk/python/caveman_cloud/middleware/validate.py:52— validate.plan has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (11 pts), loops 2, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
llm_run.main (cognitive 26) REDACTED:174— llm_run.main has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 4 (5 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
apply.moduleSwitchCommand (cognitive 26) packages/cli/src/modules/apply.ts:629— apply.moduleSwitchCommand has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 7 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 5). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
provider-logins.withIndexLock (cognitive 26) packages/cli/src/modules/provider-logins.ts:75— provider-logins.withIndexLock has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 4 (11 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index-file.ensureModuleBinaries (cognitive 26) packages/cli/src/modules/index-file.ts:129— index-file.ensureModuleBinaries has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 2 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 14). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openclaw-provider-compat.preserveOpenClawProviderCompat (cognitive 26) packages/cli/src/openclaw-provider-compat.ts:50— openclaw-provider-compat.preserveOpenClawProviderCompat has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (12 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.skills (cognitive 26) REDACTED:2561— index.skills has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 2 (5 pts), ternaries 4, loops 2, boolean chains 1 (nesting depth added 7). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.startOptions (cognitive 26) REDACTED:2645— index.startOptions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, ternaries 3 (4 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.renderLearnSpendLines (cognitive 26) REDACTED:19353— index.renderLearnSpendLines has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 7, boolean chains 4, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
provider-response.tailObject (cognitive 26) packages/middleware/typescript/src/provider-response.ts:6— provider-response.tailObject has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (4 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadSurfaces (cognitive 26) skills/verbs-gate.mjs:42— loadSurfaces has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (12 pts), loops 5 (6 pts), boolean chains 5, error handling 2, ternaries 1 (nesting depth added 2). Of this number, 25 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ccr.openWithBudgetHooks (cognitive 25) REDACTED:168— ccr.openWithBudgetHooks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
engine.collectJSONRecordGroups (cognitive 25) engine/retrieve_query.go:163— engine.collectJSONRecordGroups has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 5 (11 pts), boolean chains 1, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
compressors.RestoreLineNumberedListing (cognitive 25) engine/compressors/code_listing.go:143— compressors.RestoreLineNumberedListing has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
configCompressor.compress (cognitive 25) engine/compressors/config.go:60— configCompressor.compress has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 4, loops 4 (nesting depth added 4). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
evals.valueMatchesAnyType (cognitive 25) engine/evals/graders.go:359— evals.valueMatchesAnyType has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
evals.summarizeQuality (cognitive 25) engine/evals/quality.go:254— evals.summarizeQuality has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
image.anthropicVersion (cognitive 25) engine/image/tokens.go:144— image.anthropicVersion has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 6, match/switch 1 (nesting depth added 7). Of this number, 21 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.prefixModel (cognitive 25) proxy/internal/gateway/chatgpt_auto.go:412— gateway.prefixModel has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (15 pts), match/switch 2 (4 pts), boolean chains 3, loops 3 (nesting depth added 13). Of this number, 20 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pool.lockIndex (cognitive 25) proxy/internal/pool/pool.go:323— pool.lockIndex has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 3, loops 1 (nesting depth added 13). Of this number, 21 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.memoryOrphansSink (cognitive 25) proxy/internal/store/detect_memory_health.go:367— store.memoryOrphansSink has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). Of this number, 20 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.claudeMDSectionSink (cognitive 25) proxy/internal/store/detect_sections.go:56— store.claudeMDSectionSink has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.mergeBehaviorScan (cognitive 25) proxy/internal/store/learn.go:1142— store.mergeBehaviorScan has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (14 pts), loops 7, boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
store.buildLearnSavings (cognitive 25) proxy/internal/store/learn_attribution.go:249— store.buildLearnSavings has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.strictNode (cognitive 25) proxy/internal/translate/messages_in.go:257— translate.strictNode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, loops 4 (5 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
responsesToMessages.assembled (cognitive 25) proxy/internal/translate/messages_responses.go:270— responsesToMessages.assembled has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.objectMemberSpan (cognitive 25) proxy/providers/anthropic/frozen.go:165— anthropic.objectMemberSpan has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.chatRecoveryCallIDs (cognitive 25) proxy/providers/openai/content_compress.go:275— openai.chatRecoveryCallIDs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanLLM._stream (cognitive 25) packages/middleware/python/caveman_middleware/llama_index.py:579— CavemanLLM._stream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (7 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CavemanLLM._astream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
CavemanLLM._astream (cognitive 25) packages/middleware/python/caveman_middleware/llama_index.py:614— CavemanLLM._astream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (7 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (CavemanLLM._stream) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
learn-autopilot.runAutopilot (cognitive 25) packages/cli/src/learn-autopilot.ts:262— learn-autopilot.runAutopilot has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts), ternaries 4, error handling 2, loops 1 (2 pts) (nesting depth added 2). Of this number, 17 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
apply.externalRuns (cognitive 25) packages/cli/src/modules/apply.ts:318— apply.externalRuns has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2 (6 pts), boolean chains 5, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.withIntegrationLock (cognitive 25) REDACTED:10229— index.withIntegrationLock has cognitive complexity 25 (threshold 15). Drivers by points: error handling 9 (17 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.memHook (cognitive 25) REDACTED:17826— index.memHook has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.agentMcpRequest (cognitive 25) REDACTED:21779— index.agentMcpRequest has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 3, boolean chains 2, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ingest.toRow (cognitive 25) supabase/functions/blocks-telemetry/ingest.ts:124— ingest.toRow has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 17, if/else 6, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
main.runDirect (cognitive 24) browse/cmd/caveman-browse/main.go:135— main.runDirect has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mem.bm25Scores (cognitive 24) mem/bm25.go:51— mem.bm25Scores has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 7 (11 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.observeCachedPrefix (cognitive 24) proxy/internal/gateway/prefix_monitor.go:237— Server.observeCachedPrefix has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Resolver.Identify (cognitive 24) REDACTED:204— Resolver.Identify has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oidcVerifier.fetch (cognitive 24) REDACTED:140— oidcVerifier.fetch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.procedureSinks (cognitive 24) proxy/internal/store/detect_procedures.go:148— store.procedureSinks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 10). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.crossProviderSinks (cognitive 24) proxy/internal/store/learn.go:769— store.crossProviderSinks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 8). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.detectLearningLoops (cognitive 24) proxy/internal/store/learn_loops.go:38— store.detectLearningLoops has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (10 pts), boolean chains 1 (nesting depth added 11). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.trendSparkSVG (cognitive 24) proxy/internal/store/learn_trends.go:518— store.trendSparkSVG has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 3, boolean chains 2 (nesting depth added 6). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.parseAiderHistory (cognitive 24) proxy/internal/store/source_aider.go:115— store.parseAiderHistory has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, loops 2 (nesting depth added 9). Of this number, 14 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.parseCodexFile (cognitive 24) proxy/internal/store/usage_import.go:226— store.parseCodexFile has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.InitMiddleware (cognitive 24) proxy/internal/store/middleware.go:133— Store.InitMiddleware has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.appendToolMessage (cognitive 24) proxy/internal/translate/messages_in.go:542— translate.appendToolMessage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 11). Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 550). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
translate.bridgeTools (cognitive 24) proxy/internal/translate/responses.go:160— translate.bridgeTools has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 9). Of this number, 14 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.recoveryToolUseIDs (cognitive 24) proxy/providers/anthropic/content_compress.go:271— anthropic.recoveryToolUseIDs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock.normalizeBedrockCacheDetails (cognitive 24) proxy/providers/bedrock/usage.go:334— bedrock.normalizeBedrockCacheDetails has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
langchain._message_view (cognitive 24) packages/middleware/python/caveman_middleware/langchain.py:55— langchain._message_view has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (5 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanModel._project (cognitive 24) packages/middleware/python/caveman_middleware/pydantic_ai.py:232— CavemanModel._project has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 10, error handling 2, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.parseWrapArgs (cognitive 24) REDACTED:6239— index.parseWrapArgs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.logout (cognitive 24) REDACTED:12668— index.logout has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 2 (5 pts), boolean chains 4 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
index.installSettingsHookGeneric (cognitive 24) REDACTED:17559— index.installSettingsHookGeneric has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 4 (7 pts), boolean chains 3, loops 2 (3 pts), error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.receiptsVerify (cognitive 24) REDACTED:21318— index.receiptsVerify has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3, error handling 2, boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport.acceptsRecovery (cognitive 24) packages/middleware/typescript/src/transport.ts:20— transport.acceptsRecovery has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 15, if/else 6, ternaries 3. Of this number, 20 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
logCompressor.compress (cognitive 23) engine/compressors/log.go:89— logCompressor.compress has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 5, boolean chains 4 (nesting depth added 4). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.Recall (cognitive 23) REDACTED:411— Store.Recall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cloudlink.spawnedAgentType (cognitive 23) proxy/internal/cloudlink/link.go:896— cloudlink.spawnedAgentType has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Link.poolAnswer (cognitive 23) proxy/internal/cloudlink/link.go:1334— Link.poolAnswer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config.withDefaults (cognitive 23) proxy/internal/config/config.go:377— Config.withDefaults has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (18 pts), match/switch 3, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Server.routeHeal (cognitive 23) proxy/internal/gateway/route.go:1434— Server.routeHeal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.prepareChoice (cognitive 23) proxy/internal/middleware/choices.go:50— Runtime.prepareChoice has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.receipt (cognitive 23) proxy/internal/middleware/recovery.go:184— Runtime.receipt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 5). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.buildLearnPortfolio (cognitive 23) proxy/internal/store/learn_portfolio.go:269— store.buildLearnPortfolio has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, loops 4 (nesting depth added 6). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sqliteMiddlewareTx.ExpireBatch (cognitive 23) proxy/internal/store/middleware.go:806— sqliteMiddlewareTx.ExpireBatch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 7). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock.injectAnthropicCacheControlRaw (cognitive 23) proxy/providers/bedrock/cache_points.go:211— bedrock.injectAnthropicCacheControlRaw has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agno.with_caveman_agent (cognitive 23) packages/middleware/python/caveman_middleware/agno.py:525— agno.with_caveman_agent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime._telemetry (cognitive 23) packages/sdk/python/caveman_cloud/middleware/runtime.py:678— MiddlewareRuntime._telemetry has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 3 (6 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
provider-routing.unforwardedProviderHeaders (cognitive 23) packages/cli/src/provider-routing.ts:127— provider-routing.unforwardedProviderHeaders has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 4). Of this number, 16 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.acquireClaimLock (cognitive 23) REDACTED:1431— index.acquireClaimLock has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 4 (9 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.removeNativeHookEntries (cognitive 23) REDACTED:10712— index.removeNativeHookEntries has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (6 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). Of this number, 18 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.applyConfigFileInjection (cognitive 23) REDACTED:11941— index.applyConfigFileInjection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 4 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.mcpUninstall (cognitive 23) REDACTED:14068— index.mcpUninstall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, ternaries 1 (2 pts), loops 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.emitShrunk (cognitive 23) REDACTED:16594— index.emitShrunk has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (7 pts), ternaries 3 (6 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.enableHermesPluginInConfig (cognitive 23) REDACTED:18287— index.enableHermesPluginInConfig has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 2, loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
provider-compat.compatForRoutedModel (cognitive 23) packages/pi-extension/src/provider-compat.ts:49— provider-compat.compatForRoutedModel has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 18, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RuntimePolicyClient.refresh (cognitive 23) packages/sdk/typescript/src/index.ts:1111— RuntimePolicyClient.refresh has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, error handling 3, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RuntimePolicyClient.evaluate (cognitive 23) packages/sdk/typescript/src/index.ts:1276— RuntimePolicyClient.evaluate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 5, boolean chains 3, loops 1 (nesting depth added 1). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cavecrew-model-overrides.applyOverrides (cognitive 23) src/hooks/cavecrew-model-overrides.js:112— cavecrew-model-overrides.applyOverrides has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 3 (8 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validateHookFields (cognitive 23) installer/lib/settings.js:152— validateHookFields has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 8). Of this number, 14 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadJournal (cognitive 23) installer/lib/owned-install.js:103— loadJournal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 3 (5 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
collectUsage (cognitive 23) agents/delegate/caveman-delegate-mcp.mjs:38— collectUsage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 6, error handling 2 (4 pts), loops 2 (3 pts), other 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.putObject (cognitive 22) REDACTED:622— Store.putObject has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (22 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.unwrapCodexExec (cognitive 22) engine/codexexec.go:36— engine.unwrapCodexExec has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
compressors.writeTOONArray (cognitive 22) engine/compressors/toon_encode.go:251— compressors.writeTOONArray has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.runTrial (cognitive 22) proxy/cmd/caveman-proxy/main.go:677— main.runTrial has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.toolNameInList (cognitive 22) proxy/internal/gateway/retrieve_tool.go:355— gateway.toolNameInList has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.pixelRequest (cognitive 22) proxy/internal/gateway/pixel.go:30— Server.pixelRequest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 5). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.readSkillFrontmatter (cognitive 22) proxy/internal/store/config_scan.go:404— store.readSkillFrontmatter has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.simpleShellWords (cognitive 22) proxy/internal/store/detect_reread.go:219— store.simpleShellWords has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, loops 1 (nesting depth added 7). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
requestScan.number (cognitive 22) proxy/providers/inspect.go:317— requestScan.number has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, loops 1, match/switch 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.chatZones (cognitive 22) proxy/providers/openai/content_compress.go:146— openai.chatZones has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.collectOpenAICandidates (cognitive 22) proxy/providers/openai/content_compress.go:395— openai.collectOpenAICandidates has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Provider.Credentials (cognitive 22) shared/platform/awscreds/awscreds.go:172— Provider.Credentials has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_native.accepts_recovery (cognitive 22) packages/middleware/python/caveman_middleware/_native.py:227— _native.accepts_recovery has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 7, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
agno._message_view (cognitive 22) packages/middleware/python/caveman_middleware/agno.py:53— agno._message_view has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, ternaries 2 (5 pts), loops 2 (3 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google._apply (cognitive 22) packages/middleware/python/caveman_middleware/google.py:356— google._apply has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
onboard.signInStep (cognitive 22) packages/cli/src/modules/onboard.ts:454— onboard.signInStep has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 4 (5 pts), error handling 1, loops 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.resolveInvocation (cognitive 22) REDACTED:748— index.resolveInvocation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.resolveCapabilities (cognitive 22) REDACTED:4649— index.resolveCapabilities has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 8). Of this number, 18 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.geminiRouteShadow (cognitive 22) REDACTED:8924— index.geminiRouteShadow has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (4 pts), error handling 1 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 11). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.aiderNativeConfig (cognitive 22) REDACTED:9635— index.aiderNativeConfig has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 4, boolean chains 3, loops 1 (2 pts) (nesting depth added 4). Of this number, 20 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.applyNativeMutations (cognitive 22) REDACTED:10346— index.applyNativeMutations has cognitive complexity 22 (threshold 15). Drivers by points: error handling 5 (9 pts), if/else 5 (7 pts), loops 2 (3 pts), ternaries 2, boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.installNativeVoiceSkills (cognitive 22) REDACTED:10546— index.installNativeVoiceSkills has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 4 (7 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.readOwnedMcpPendingJournalAt (cognitive 22) REDACTED:15832— index.readOwnedMcpPendingJournalAt has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 14, if/else 5 (6 pts), error handling 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.traceSearchBody (cognitive 22) REDACTED:21494— index.traceSearchBody has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuntimePolicyClient.verifyBundle (cognitive 22) packages/sdk/typescript/src/index.ts:1240— RuntimePolicyClient.verifyBundle has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, ternaries 4 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.gatewayFindObjectField (cognitive 21) proxy/internal/gateway/retrieve_tool.go:161— gateway.gatewayFindObjectField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.requestAccounting (cognitive 21) proxy/internal/gateway/stats_accounting.go:33— gateway.requestAccounting has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
store.memoryHealthSinks (cognitive 21) proxy/internal/store/detect_memory_health.go:62— store.memoryHealthSinks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 7). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.buildExperimentReport (cognitive 21) proxy/internal/store/learn_experiment.go:251— store.buildExperimentReport has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recurringMiner.merge (cognitive 21) proxy/internal/store/recurring.go:112— recurringMiner.merge has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recurringMiner.observeBlocks (cognitive 21) proxy/internal/store/recurring.go:231— recurringMiner.observeBlocks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessionEventConsumer.resolveWindows (cognitive 21) proxy/internal/store/session_source.go:289— sessionEventConsumer.resolveWindows has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.namespaceEvent (cognitive 21) proxy/internal/translate/translate.go:1004— translate.namespaceEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.findObjectField (cognitive 21) proxy/providers/anthropic/splice.go:37— anthropic.findObjectField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Adapter.InspectRequest (cognitive 21) proxy/providers/bedrock/routing.go:273— Adapter.InspectRequest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock.validateBedrockRawTotal (cognitive 21) proxy/providers/bedrock/usage.go:407— bedrock.validateBedrockRawTotal has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 7 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.prefixSignature (cognitive 21) proxy/providers/openai/cache_key.go:231— openai.prefixSignature has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.findObjectField (cognitive 21) proxy/providers/openai/content_compress.go:479— openai.findObjectField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.with_caveman_openai_tools (cognitive 21) packages/middleware/python/caveman_middleware/openai.py:76— openai.with_caveman_openai_tools has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 3 (4 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
core._policy_guard_passes (cognitive 21) packages/sdk/python/caveman_cloud/core.py:2049— core._policy_guard_passes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-profile-scope.checkProfileScope (cognitive 21) agents/check-profile-scope.mjs:44— check-profile-scope.checkProfileScope has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, loops 1 (nesting depth added 7). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caveman-delegate-mcp.handle (cognitive 21) agents/delegate/caveman-delegate-mcp.mjs:128— caveman-delegate-mcp.handle has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
portable-process.resolveWindowsCommand (cognitive 21) installer/lib/portable-process.js:11— portable-process.resolveWindowsCommand has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 2 (5 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 9). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openclaw.appendBootstrapToSoul (cognitive 21) REDACTED:290— openclaw.appendBootstrapToSoul has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 4 (7 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.installViaSkills (cognitive 21) REDACTED:848— install.installViaSkills has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
learn-autopilot.claimLearnNudge (cognitive 21) packages/cli/src/learn-autopilot.ts:349— learn-autopilot.claimLearnNudge has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 5 (8 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
onboard.foundRows (cognitive 21) packages/cli/src/modules/onboard.ts:390— onboard.foundRows has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 6 (7 pts), boolean chains 3, loops 2 (nesting depth added 5). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.clearAutoModelChoice (cognitive 21) REDACTED:4424— index.clearAutoModelChoice has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 8). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.capabilityConfigCommand (cognitive 21) REDACTED:4763— index.capabilityConfigCommand has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.routedAiderArgs (cognitive 21) REDACTED:6557— index.routedAiderArgs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.codexHooksTrusted (cognitive 21) REDACTED:9844— index.codexHooksTrusted has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 5, error handling 3 (5 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 5). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeMutationsFor (cognitive 21) REDACTED:10518— index.nativeMutationsFor has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (21 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
index.qwenMigratePolicySettings (cognitive 21) REDACTED:14653— index.qwenMigratePolicySettings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 7). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.qwenEnvironmentFilePaths (cognitive 21) REDACTED:14960— index.qwenEnvironmentFilePaths has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 6). Of this number, 15 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mastra.remember (cognitive 21) packages/middleware/typescript/src/mastra.ts:42— mastra.remember has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanStrandsModel.project (cognitive 21) packages/middleware/typescript/src/strands.ts:49— CavemanStrandsModel.project has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, loops 3 (4 pts), ternaries 4 (nesting depth added 3). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tool-output.shrinkToolResult (cognitive 21) packages/pi-extension/src/tool-output.ts:21— tool-output.shrinkToolResult has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, ternaries 2, error handling 1, loops 1 (nesting depth added 2). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
validate.checkPlan (cognitive 21) packages/sdk/typescript/src/middleware/validate.ts:86— validate.checkPlan has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (9 pts), loops 2 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MiddlewareRuntime.constructor (cognitive 21) packages/sdk/typescript/src/middleware/runtime.ts:187— MiddlewareRuntime.constructor has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts), error handling 2, ternaries 1 (nesting depth added 1). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
run.parseArgs (cognitive 21) packages/subagent-tax/run.mjs:26— run.parseArgs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 4, loops 1 (nesting depth added 1). Of this number, 17 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
caveman-stats.main (cognitive 21) src/hooks/caveman-stats.js:526— caveman-stats.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 5 (6 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
addCommandHook (cognitive 21) installer/lib/settings.js:187— addCommandHook has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resolveWindowsCommand (cognitive 21) agents/delegate/portable-process.mjs:15— resolveWindowsCommand has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), ternaries 3 (4 pts), other 2, boolean chains 1 (nesting depth added 8). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.tokenize (cognitive 20) engine/compressors/redundancy.go:186— compressors.tokenize has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). Of this number, 14 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
evals.toolNamesFromValue (cognitive 20) engine/evals/graders.go:428— evals.toolNamesFromValue has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
gateway.compiledPlanRoutes (cognitive 20) REDACTED:1218— gateway.compiledPlanRoutes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.standalonePriceForUsage (cognitive 20) REDACTED:2058— gateway.standalonePriceForUsage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, match/switch 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.copyFlush (cognitive 20) REDACTED:2292— gateway.copyFlush has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
chatGPTSSECompletionReader.Read (cognitive 20) proxy/internal/gateway/chatgpt.go:601— chatGPTSSECompletionReader.Read has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
chatGPTSSECompletionReader.scan (cognitive 20) proxy/internal/gateway/chatgpt.go:652— chatGPTSSECompletionReader.scan has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
identity.loadTokenMap (cognitive 20) REDACTED:366— identity.loadTokenMap has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nativehook.currentRepositoryState (cognitive 20) REDACTED:168— nativehook.currentRepositoryState has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, loops 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Store.LoginChatGPT (cognitive 20) proxy/internal/pool/chatgpt.go:71— Store.LoginChatGPT has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (13 pts), match/switch 4 (6 pts), boolean chains 1 (nesting depth added 3). Of this number, 15 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
repointel.ImpactTests (cognitive 20) proxy/internal/repointel/index.go:201— repointel.ImpactTests has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.bashReadPath (cognitive 20) proxy/internal/store/detect_reread.go:268— store.bashReadPath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
procedureMiner.observeSession (cognitive 20) proxy/internal/store/detect_procedures.go:60— procedureMiner.observeSession has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
geminiSessionSource.scanSession (cognitive 20) proxy/internal/store/source_gemini.go:48— geminiSessionSource.scanSession has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.InsertConfigSnapshots (cognitive 20) proxy/internal/store/config_scan.go:593— Store.InsertConfigSnapshots has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.messagesChatBody (cognitive 20) proxy/internal/translate/messages_in.go:186— translate.messagesChatBody has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
translate.appendResponsesToolOutput (cognitive 20) proxy/internal/translate/messages_in.go:828— translate.appendResponsesToolOutput has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (3 pts), match/switch 2, boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 841). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
translate.messagesFinish (cognitive 20) proxy/internal/translate/msgbuild.go:307— translate.messagesFinish has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
gemini.collectUserCandidates (cognitive 20) proxy/providers/gemini/content_compress.go:146— gemini.collectUserCandidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
requestScan.object (cognitive 20) proxy/providers/inspect.go:174— requestScan.object has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UsageReader.feed (cognitive 20) packages/middleware/python/caveman_middleware/_usage.py:46— UsageReader.feed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 1 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OTelExporter.record_span (cognitive 20) packages/sdk/python/caveman_cloud/core.py:1661— OTelExporter.record_span has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, boolean chains 6, ternaries 3, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiddlewareRuntime._http (cognitive 20) packages/sdk/python/caveman_cloud/middleware/runtime.py:854— MiddlewareRuntime._http has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (4 pts), error handling 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
agent-mcp.handleMessage (cognitive 20) packages/cli/src/agent-mcp.ts:616— agent-mcp.handleMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
portable-command.resolveWindowsCommand (cognitive 20) packages/cli/src/portable-command.ts:87— portable-command.resolveWindowsCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), ternaries 3 (5 pts), boolean chains 1 (nesting depth added 9). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
provider-logins.providersAdd (cognitive 20) packages/cli/src/modules/provider-logins.ts:167— provider-logins.providersAdd has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). Of this number, 14 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
onboard.routingStep (cognitive 20) packages/cli/src/modules/onboard.ts:312— onboard.routingStep has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 3 (4 pts), error handling 1 (nesting depth added 5). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.preflightAgentNativeBundleComponents (cognitive 20) REDACTED:3728— index.preflightAgentNativeBundleComponents has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.renderRetroReveal (cognitive 20) REDACTED:6036— index.renderRetroReveal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 3 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.stripTrailingCommas (cognitive 20) REDACTED:7301— index.stripTrailingCommas has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.withMcpConfigLock (cognitive 20) REDACTED:10274— index.withMcpConfigLock has cognitive complexity 20 (threshold 15). Drivers by points: error handling 8 (13 pts), if/else 3 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeRoutePinnedFor (cognitive 20) REDACTED:10446— index.nativeRoutePinnedFor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (routeIn). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.validateLoginArgs (cognitive 20) REDACTED:12482— index.validateLoginArgs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.qwenSettingsPermitRecovery (cognitive 20) REDACTED:14897— index.qwenSettingsPermitRecovery has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.ownedMcpRegistration (cognitive 20) REDACTED:15661— index.ownedMcpRegistration has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.installMcpCodexToml (cognitive 20) REDACTED:16286— index.installMcpCodexToml has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 4 (5 pts), error handling 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.stats (cognitive 20) REDACTED:18708— index.stats has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.normalizeExperiment (cognitive 20) packages/sdk/typescript/src/index.ts:1479— index.normalizeExperiment has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.toolSearch (cognitive 20) packages/sdk/typescript/src/index.ts:1578— index.toolSearch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 5, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
protocol.resolveProxy (cognitive 20) packages/sdk/typescript/src/middleware/protocol.ts:154— protocol.resolveProxy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 7, ternaries 2 (3 pts), error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime.report (cognitive 20) packages/sdk/typescript/src/middleware/runtime.ts:301— MiddlewareRuntime.report has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (16 pts), boolean chains 2, error handling 1, if/else 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.pixelDensityChecks (cognitive 19) engine/cmd/caveman-engine/main.go:701— main.pixelDensityChecks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.SplitLineNumberedListing (cognitive 19) engine/compressors/code_listing.go:37— compressors.SplitLineNumberedListing has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.skipValue (cognitive 19) engine/compressors/toolschema_annotations.go:322— compressors.skipValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Engine.Detect (cognitive 19) engine/detect.go:48— Engine.Detect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
image.Apply (cognitive 19) engine/image/image.go:157— image.Apply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fanout.enter (cognitive 19) proxy/internal/gateway/route_cache.go:228— fanout.enter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 252). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Runtime.optimize (cognitive 19) REDACTED:323— Runtime.optimize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 2 (nesting depth added 2). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
nativeruntime.StripSessionMarkers (cognitive 19) proxy/internal/nativeruntime/marker.go:89— nativeruntime.StripSessionMarkers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.Entries (cognitive 19) proxy/internal/pool/pool.go:391— Store.Entries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.brokenImportsSink (cognitive 19) proxy/internal/store/detect_memory_health.go:426— store.brokenImportsSink has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.staleReferencesSink (cognitive 19) proxy/internal/store/detect_memory_health.go:477— store.staleReferencesSink has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.learnRepos (cognitive 19) proxy/internal/store/learn_portfolio.go:215— store.learnRepos has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 2 (nesting depth added 6). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PostgresMiddleware.initMiddleware (cognitive 19) proxy/internal/store/middleware_postgres.go:223— PostgresMiddleware.initMiddleware has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Store.InsertUsageEvents (cognitive 19) proxy/internal/store/trial_store.go:94— Store.InsertUsageEvents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.eachItem (cognitive 19) proxy/internal/translate/jsonfast.go:403— translate.eachItem has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.messageZones (cognitive 19) proxy/providers/anthropic/content_compress.go:210— anthropic.messageZones has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 3 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
bedrock.injectConverseCachePointRaw (cognitive 19) proxy/providers/bedrock/cache_points.go:167— bedrock.injectConverseCachePointRaw has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsonsplice.value (cognitive 19) proxy/providers/jsonsplice/jsonsplice.go:244— jsonsplice.value has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
redact.candidateLooksLikeSecret (cognitive 19) shared/platform/redact/residual.go:227— redact.candidateLooksLikeSecret has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
shrink.profileOf (cognitive 19) shrink/shrink.go:299— shrink.profileOf has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (9 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanChatCompletionClient.create_stream (cognitive 19) packages/middleware/python/caveman_middleware/autogen.py:330— CavemanChatCompletionClient.create_stream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 3 (4 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanMCPHost._project (cognitive 19) packages/middleware/python/caveman_middleware/mcp.py:105— CavemanMCPHost._project has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, loops 2, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiddlewareRuntime._capabilities (cognitive 19) packages/sdk/python/caveman_cloud/middleware/runtime.py:592— MiddlewareRuntime._capabilities has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, error handling 4 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
onboard.parseOnboardArgs (cognitive 19) packages/cli/src/modules/onboard.ts:76— onboard.parseOnboardArgs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.recoverPendingAgentNativeBundle (cognitive 19) REDACTED:3608— index.recoverPendingAgentNativeBundle has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 6, if/else 3 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.managedHookIdentity (cognitive 19) REDACTED:7970— index.managedHookIdentity has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), ternaries 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.sync (cognitive 19) REDACTED:13444— index.sync has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (19 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.recoverOwnedMcpTransaction (cognitive 19) REDACTED:15923— index.recoverOwnedMcpTransaction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 8. Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
compatibility.frameworkGate (cognitive 19) packages/middleware/typescript/src/compatibility.ts:71— compatibility.frameworkGate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (3 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanMCPHost.project (cognitive 19) packages/middleware/typescript/src/mcp.ts:80— CavemanMCPHost.project has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 4, loops 2 (nesting depth added 1). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ccr.inspectSQLiteGeneration (cognitive 18) engine/ccr/store_generation.go:35— ccr.inspectSQLiteGeneration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ccr.secureSQLiteFile (cognitive 18) REDACTED:344— ccr.secureSQLiteFile has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
compressors.droppableGeneric (cognitive 18) engine/compressors/axtree.go:254— compressors.droppableGeneric has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.keepNumericExtrema (cognitive 18) engine/compressors/tabular.go:292— compressors.keepNumericExtrema has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.splitSentences (cognitive 18) engine/compressors/toolschema.go:297— compressors.splitSentences has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.writeTOONValue (cognitive 18) engine/compressors/toon_encode.go:194— compressors.writeTOONValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
compressors.tabularRows (cognitive 18) engine/compressors/toon_encode.go:312— compressors.tabularRows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diffCompressor.Compress (cognitive 18) engine/compressors/diff.go:29— diffCompressor.Compress has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
textCompressor.compress (cognitive 18) engine/compressors/text.go:47— textCompressor.compress has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
image.DecideWithDetail (cognitive 18) engine/image/image.go:97— image.DecideWithDetail has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
image.downscale (cognitive 18) engine/image/image.go:230— image.downscale has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (8 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
cloudlink.requestFor (cognitive 18) proxy/internal/cloudlink/link.go:788— cloudlink.requestFor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Link.flush (cognitive 18) proxy/internal/cloudlink/events.go:220— Link.flush has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.collectAnthropicPixelBlocks (cognitive 18) proxy/internal/gateway/pixel.go:357— gateway.collectAnthropicPixelBlocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
warmTable.record (cognitive 18) proxy/internal/gateway/cache_warm_table.go:163— warmTable.record has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
effortWire.markAt (cognitive 18) proxy/internal/gateway/route.go:1094— effortWire.markAt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
releaseOnRead.Read (cognitive 18) proxy/internal/gateway/route_cache.go:326— releaseOnRead.Read has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 5, match/switch 2 (4 pts), loops 1 (2 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
nativehook.findGitDir (cognitive 18) REDACTED:238— nativehook.findGitDir has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nativeruntime.ServeUnix (cognitive 18) proxy/internal/nativeruntime/server_unix.go:32— nativeruntime.ServeUnix has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.UniqueRecentSession (cognitive 18) proxy/internal/nativeruntime/runtime.go:584— Runtime.UniqueRecentSession has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.toolPortfolioSink (cognitive 18) proxy/internal/store/detect_tool_portfolio.go:184— store.toolPortfolioSink has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2, boolean chains 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.newestLearnSnapshotSink (cognitive 18) proxy/internal/store/learn_outcomes.go:139— store.newestLearnSnapshotSink has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.mapReconcileHeader (cognitive 18) proxy/internal/store/learn_reconcile.go:86— store.mapReconcileHeader has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.parseClaudeTranscript (cognitive 18) proxy/internal/store/usage_import.go:315— store.parseClaudeTranscript has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.objectAt (cognitive 18) proxy/internal/translate/jsonfast.go:478— translate.objectAt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.stripForeignThinking (cognitive 18) proxy/internal/translate/messages.go:286— translate.stripForeignThinking has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, loops 1 (nesting depth added 1). Of this number, 10 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Adapter.ApplyProviderNativeTransforms (cognitive 18) proxy/providers/anthropic/cache_breakpoints.go:26— Adapter.ApplyProviderNativeTransforms has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
anthropic.injectBreakpoint (cognitive 18) proxy/providers/anthropic/cache_breakpoints.go:170— anthropic.injectBreakpoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
anthropic.stripCacheControl (cognitive 18) proxy/providers/anthropic/frozen.go:112— anthropic.stripCacheControl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsonsplice.Field (cognitive 18) proxy/providers/jsonsplice/jsonsplice.go:35— jsonsplice.Field has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
openai.applyReasoningEffort (cognitive 18) proxy/providers/openai/reasoning_effort.go:52— openai.applyReasoningEffort has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
redact.compileOrgRules (cognitive 18) shared/platform/redact/payload.go:529— redact.compileOrgRules has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
redact.screenBytes (cognitive 18) shared/platform/redact/residual.go:123— redact.screenBytes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ssrf.dialContextWith (cognitive 18) shared/platform/ssrf/ssrf.go:446— ssrf.dialContextWith has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 2 (nesting depth added 3). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 447). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
HTTPTransport.__call__ (cognitive 18) REDACTED:206— HTTPTransport.__call__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 4 (6 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
opencode-agent.transformOpencodeAgentFrontmatter (cognitive 18) installer/lib/opencode-agent.js:62— opencode-agent.transformOpencodeAgentFrontmatter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.telemetryTokenDelta (cognitive 18) REDACTED:1514— index.telemetryTokenDelta has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 2, error handling 1. Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.start (cognitive 18) REDACTED:2677— index.start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.durableCavemen (cognitive 18) REDACTED:4050— index.durableCavemen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.capabilityInputValue (cognitive 18) REDACTED:4507— index.capabilityInputValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.managedHookTargetsExist (cognitive 18) REDACTED:8171— index.managedHookTargetsExist has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.planRemoveMcpKiloJson (cognitive 18) REDACTED:14433— index.planRemoveMcpKiloJson has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (index.planRemoveMcpQwenJson) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
index.planRemoveMcpQwenJson (cognitive 18) REDACTED:15721— index.planRemoveMcpQwenJson has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (index.planRemoveMcpKiloJson) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
index.nativeRuntimeRequest (cognitive 18) REDACTED:17109— index.nativeRuntimeRequest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.nativeInspect (cognitive 18) REDACTED:17268— index.nativeInspect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (5 pts), boolean chains 4, loops 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.verifyFirstRequest (cognitive 18) REDACTED:18762— index.verifyFirstRequest has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (7 pts), loops 2 (4 pts) (nesting depth added 5). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport.project (cognitive 18) packages/middleware/typescript/src/transport.ts:136— transport.project has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OTelExporter.recordSpan (cognitive 18) packages/sdk/typescript/src/index.ts:2225— OTelExporter.recordSpan has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 4, ternaries 2 (3 pts), loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiddlewareRuntime.preflight (cognitive 18) packages/sdk/typescript/src/middleware/runtime.ts:244— MiddlewareRuntime.preflight has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 4, error handling 1 (2 pts), if/else 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caveman-config.findRepoConfigPath (cognitive 18) src/hooks/caveman-config.js:109— caveman-config.findRepoConfigPath has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 2 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browse.NewCDPDriver (cognitive 17) browse/cdp.go:39— browse.NewCDPDriver has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ccr.prepareObject (cognitive 17) engine/ccr/store.go:105— ccr.prepareObject has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
compressors.renderTestReport (cognitive 17) engine/compressors/testreport.go:104— compressors.renderTestReport has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 5 (8 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
annotationStripper.schema (cognitive 17) engine/compressors/toolschema_annotations.go:178— annotationStripper.schema has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 7). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.memTools (cognitive 17) mem/cmd/cavemem/main.go:133— main.memTools has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 5 function literals inside it that branch (lines 139, 169, 196, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
main.runStats (cognitive 17) proxy/cmd/caveman-proxy/main.go:623— main.runStats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.parseStatsReportOptions (cognitive 17) proxy/cmd/caveman-proxy/stats.go:17— main.parseStatsReportOptions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
identity.firstURISAN (cognitive 17) REDACTED:259— identity.firstURISAN has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
repointel.gitTrackedFiles (cognitive 17) proxy/internal/repointel/index.go:291— repointel.gitTrackedFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.caveScore (cognitive 17) proxy/internal/store/learn.go:876— store.caveScore has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
store.learnTLDR (cognitive 17) REDACTED:612— store.learnTLDR has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, match/switch 2 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
translate.streamResponsesToAnthropic (cognitive 17) proxy/internal/translate/messages_responses.go:213— translate.streamResponsesToAnthropic has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.Request (cognitive 17) proxy/internal/translate/translate.go:152— translate.Request has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), match/switch 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
translate.unsignedThinking (cognitive 17) proxy/internal/translate/translate.go:1113— translate.unsignedThinking has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
messageStream.consume (cognitive 17) proxy/internal/translate/messages_stream.go:286— messageStream.consume has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providers.decodeAccountingBody (cognitive 17) proxy/providers/adapter.go:924— providers.decodeAccountingBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providers.mergeGeminiUsage (cognitive 17) proxy/providers/adapter.go:1404— providers.mergeGeminiUsage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
providers.mergePricingQualifiers (cognitive 17) proxy/providers/adapter.go:1868— providers.mergePricingQualifiers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock.bedrockObjectCompletion (cognitive 17) proxy/providers/bedrock/usage.go:116— bedrock.bedrockObjectCompletion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Adapter.ApplyProviderNativeTransforms (cognitive 17) proxy/providers/openai/cache_key.go:42— Adapter.ApplyProviderNativeTransforms has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
postgresconfig.ParsePoolConfig (cognitive 17) shared/platform/postgresconfig/postgresconfig.go:39— postgresconfig.ParsePoolConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Cave.tools (cognitive 17) packages/sdk/python/caveman_cloud/core.py:652— Cave.tools has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HTTPTransport._connect (cognitive 17) REDACTED:264— HTTPTransport._connect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
score_fidelity.main (cognitive 17) evals/score_fidelity.py:87— score_fidelity.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 5 (7 pts), error handling 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compile.checkConformancePins (cognitive 17) agents/compile.mjs:472— compile.checkConformancePins has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3, boolean chains 2, error handling 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
probe-installed.which (cognitive 17) agents/probe-installed.mjs:30— probe-installed.which has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 8). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
apply.moduleStates (cognitive 17) packages/cli/src/modules/apply.ts:599— apply.moduleStates has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 8 (nesting depth added 1). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 607, 615, 604). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
onboard.stepRows (cognitive 17) packages/cli/src/modules/onboard.ts:423— onboard.stepRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 3 (4 pts), loops 2, boolean chains 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
learn-tui.renderLearnTui (cognitive 17) packages/cli/src/learn-tui.ts:105— learn-tui.renderLearnTui has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 2 (3 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.discoverSkillTargets (cognitive 17) REDACTED:1941— index.discoverSkillTargets has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.runExternalSkillAdd (cognitive 17) REDACTED:2500— index.runExternalSkillAdd has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 4, error handling 1 (2 pts), ternaries 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.removeAgentNativeBundle (cognitive 17) REDACTED:3793— index.removeAgentNativeBundle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (4 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.applyWithDurableCli (cognitive 17) REDACTED:4097— index.applyWithDurableCli has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, ternaries 3 (4 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 4111, 4125). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.generatedInvocation (cognitive 17) REDACTED:8134— index.generatedInvocation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.opencodeUnroutedActiveProvider (cognitive 17) REDACTED:9496— index.opencodeUnroutedActiveProvider has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (3 pts), loops 3, boolean chains 2, ternaries 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.repairNativeAgent (cognitive 17) REDACTED:11243— index.repairNativeAgent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 11251). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
index.localScanUploadFromRetro (cognitive 17) REDACTED:12826— index.localScanUploadFromRetro has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), loops 1, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
index.syncRequestSpan (cognitive 17) REDACTED:13164— index.syncRequestSpan has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 4 (5 pts) (nesting depth added 1). Of this number, 12 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.syncLocalPracticeFindings (cognitive 17) REDACTED:13384— index.syncLocalPracticeFindings has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (5 pts), ternaries 5, error handling 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.readLearnDiff (cognitive 17) REDACTED:19513— index.readLearnDiff has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (3 pts), loops 3, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
google.selected (cognitive 17) packages/middleware/typescript/src/google.ts:67— google.selected has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 2 (nesting depth added 4). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 73, 70). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
provider-compat.unpreservedAttributionHeaders (cognitive 17) packages/pi-extension/src/provider-compat.ts:11— provider-compat.unpreservedAttributionHeaders has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, error handling 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.isValidPolicyDoc (cognitive 17) packages/sdk/typescript/src/index.ts:1407— index.isValidPolicyDoc has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.guardPasses (cognitive 17) packages/sdk/typescript/src/index.ts:1432— index.guardPasses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transport.createNodeTransport.fetch (cognitive 17) REDACTED:65— transport.createNodeTransport.fetch has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (10 pts), loops 2 (3 pts), if/else 2, boolean chains 1, error handling 1 (nesting depth added 4). Of this number, 9 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiddlewareRuntime.optimize (cognitive 17) packages/sdk/typescript/src/middleware/runtime.ts:332— MiddlewareRuntime.optimize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (6 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caveman-stats.aggregateHistory (cognitive 17) src/hooks/caveman-stats.js:365— caveman-stats.aggregateHistory has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (6 pts), error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
spawn-options.resolveWindowsCommand (cognitive 17) src/mcp-servers/caveman-shrink/spawn-options.js:20— spawn-options.resolveWindowsCommand has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 3 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plugin.applyModeChange (cognitive 17) src/plugins/opencode/plugin.js:210— plugin.applyModeChange has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readModeLog (cognitive 17) src/hooks/caveman-stats.js:257— readModeLog has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 5). Of this number, 14 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
skillsRoot (cognitive 17) installer/lib/provider-skills.js:21— skillsRoot has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ccr.windowsACLGrantsBroadWrite (cognitive 16) REDACTED:39— ccr.windowsACLGrantsBroadWrite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.pruneDuplicateAXText (cognitive 16) engine/compressors/axtree.go:346— compressors.pruneDuplicateAXText has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.expandSectionContext (cognitive 16) engine/compressors/config.go:252— compressors.expandSectionContext has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compressors.accumulateScores (cognitive 16) engine/compressors/html.go:127— compressors.accumulateScores has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 130). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
compressors.primarySeries (cognitive 16) engine/compressors/json.go:458— compressors.primarySeries has cognitive complexity 16 (threshold 15). Drivers by points: loops 8 (11 pts), if/else 3 (5 pts) (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
compressors.splitTextSections (cognitive 16) engine/compressors/text.go:117— compressors.splitTextSections has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
searchResultCompressor.compress (cognitive 16) engine/compressors/searchresult.go:44— searchResultCompressor.compress has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
toolSchemaCompressor.compressSchema (cognitive 16) engine/compressors/toolschema.go:192— toolSchemaCompressor.compressSchema has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
gateway.warmBody (cognitive 16) REDACTED:384— gateway.warmBody has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1 (nesting depth added 2). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
gateway.withAutoModel (cognitive 16) proxy/internal/gateway/chatgpt_auto.go:82— gateway.withAutoModel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gateway.pairPrefix (cognitive 16) proxy/internal/gateway/route.go:1637— gateway.pairPrefix has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), loops 2 (nesting depth added 1). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
warmTable.load (cognitive 16) proxy/internal/gateway/cache_warm_table.go:78— warmTable.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessionLedger.Observe (cognitive 16) proxy/internal/gateway/ledger.go:153— sessionLedger.Observe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.sendCacheWarm (cognitive 16) REDACTED:697— Server.sendCacheWarm has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nativehook.preToolRequest (cognitive 16) REDACTED:96— nativehook.preToolRequest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
nativehook.configuredMode (cognitive 16) REDACTED:306— nativehook.configuredMode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Runtime.repositoryEvidenceContext (cognitive 16) proxy/internal/nativeruntime/runtime.go:786— Runtime.repositoryEvidenceContext has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.configTurnsPerDay (cognitive 16) proxy/internal/store/learn.go:518— store.configTurnsPerDay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.buildLearnSpend (cognitive 16) proxy/internal/store/learn_pricing.go:185— store.buildLearnSpend has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 2 (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.claudeStructuredSkillReferences (cognitive 16) proxy/internal/store/source_claude.go:214— store.claudeStructuredSkillReferences has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.quotaEventsFromAny (cognitive 16) proxy/internal/store/usage_import.go:431— store.quotaEventsFromAny has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 8). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 434). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
MiddlewareTx.SaveOriginals (cognitive 16) proxy/internal/store/middleware.go:399— MiddlewareTx.SaveOriginals has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 2, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
postgresMiddlewareTx.sweepable (cognitive 16) proxy/internal/store/middleware_postgres.go:632— postgresMiddlewareTx.sweepable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sessionEventConsumer.finish (cognitive 16) proxy/internal/store/session_source.go:233— sessionEventConsumer.finish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 4, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
codexSessionSource.scanSession (cognitive 16) proxy/internal/store/source_codex.go:37— codexSessionSource.scanSession has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.writeExportSpans (cognitive 16) REDACTED:143— Store.writeExportSpans has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.ObserveSummarySince (cognitive 16) proxy/internal/store/store.go:969— Store.ObserveSummarySince has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Store.InsertQuotaEvents (cognitive 16) proxy/internal/store/trial_store.go:150— Store.InsertQuotaEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.topMember (cognitive 16) proxy/internal/translate/jsonfast.go:447— translate.topMember has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.validText (cognitive 16) proxy/internal/translate/jsonfast.go:658— translate.validText has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 3 (5 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translate.relayContent (cognitive 16) proxy/internal/translate/translate.go:714— translate.relayContent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
providers.mergeProviderOutcomeQualifiers (cognitive 16) proxy/providers/adapter.go:1931— providers.mergeProviderOutcomeQualifiers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bedrock.eventStreamErrorHeader (cognitive 16) proxy/providers/bedrock/usage.go:264— bedrock.eventStreamErrorHeader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gemini.rewritableZones (cognitive 16) proxy/providers/gemini/content_compress.go:100— gemini.rewritableZones has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
counttokens.decodeJSONObjectFields (cognitive 16) proxy/providers/internal/counttokens/counttokens.go:187— counttokens.decodeJSONObjectFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsonsplice.AppendObjectFields (cognitive 16) proxy/providers/jsonsplice/jsonsplice.go:158— jsonsplice.AppendObjectFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Guard.Inspect (cognitive 16) shared/platform/cacheguard/cacheguard.go:85— Guard.Inspect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Cave.compress (cognitive 16) packages/sdk/python/caveman_cloud/core.py:778— Cave.compress has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6, boolean chains 5, if/else 4, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiddlewareRuntime.preflight (cognitive 16) packages/sdk/python/caveman_cloud/middleware/runtime.py:331— MiddlewareRuntime.preflight has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 3, error handling 1, if/else 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
build-release-binaries.parseArgs (cognitive 16) scripts/build-release-binaries.mjs:140— build-release-binaries.parseArgs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
onboard.confirm (cognitive 16) packages/cli/src/modules/onboard.ts:742— onboard.confirm has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 5, boolean chains 3 (nesting depth added 3). None of this is in the body itself: all 16 points belong to 3 function items inside it that branch (a function literal at line 749, render, a function literal at line 757). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
stop.endRuntimes (cognitive 16) packages/cli/src/modules/stop.ts:53— stop.endRuntimes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (nesting depth added 7). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.parseProxyStatsPayload (cognitive 16) REDACTED:1317— index.parseProxyStatsPayload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, loops 2 (3 pts), error handling 1, ternaries 1 (nesting depth added 4). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.parsePixelRenderReport (cognitive 16) REDACTED:2114— index.parsePixelRenderReport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.durableReplaceFileIfUnchanged (cognitive 16) REDACTED:8522— index.durableReplaceFileIfUnchanged has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.recoverPendingNativeInstallUnlocked (cognitive 16) REDACTED:10480— index.recoverPendingNativeInstallUnlocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), error handling 2 (4 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.readLocalScanState (cognitive 16) REDACTED:12941— index.readLocalScanState has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (11 pts), boolean chains 2, if/else 2, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.syncAfterLogin (cognitive 16) REDACTED:13497— index.syncAfterLogin has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.canonicalMcpConfigPath (cognitive 16) REDACTED:14313— index.canonicalMcpConfigPath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 pts), error handling 2 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.planMcpKiloJson (cognitive 16) REDACTED:14393— index.planMcpKiloJson has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.qwenEffectiveEnvValue (cognitive 16) REDACTED:15017— index.qwenEffectiveEnvValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.nativeRepositoryState (cognitive 16) REDACTED:17061— index.nativeRepositoryState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 2, error handling 2, ternaries 1 (2 pts), loops 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.removeShrinkPluginOpenClaw (cognitive 16) REDACTED:18444— index.removeShrinkPluginOpenClaw has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, error handling 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.verifyChain (cognitive 16) REDACTED:21242— index.verifyChain has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.saveConfig (cognitive 16) REDACTED:21947— index.saveConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
native-hook-fast.repositoryState (cognitive 16) packages/cli/src/native-hook-fast.ts:271— native-hook-fast.repositoryState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 2, error handling 2, ternaries 1 (2 pts), loops 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.acknowledge (cognitive 16) packages/device-auth/src/index.ts:69— index.acknowledge has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
protocol.sanitizeHookResponse (cognitive 16) packages/pi-extension/src/protocol.ts:48— protocol.sanitizeHookResponse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
index.compress (cognitive 16) packages/sdk/typescript/src/index.ts:1661— index.compress has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 4, ternaries 3, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiddlewareRuntime.#http (cognitive 16) packages/sdk/typescript/src/middleware/runtime.ts:606— MiddlewareRuntime.#http has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caveman-activate.activate (cognitive 16) src/hooks/caveman-activate.js:267— caveman-activate.activate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plugin.CavemanPlugin.chat.message (cognitive 16) src/plugins/opencode/plugin.js:320— plugin.CavemanPlugin.chat.message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gcSessionStore (cognitive 16) src/hooks/caveman-config.js:674— gcSessionStore has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 5, error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validateConfigStrings (cognitive 16) agents/compile.mjs:155— validateConfigStrings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 3, other 3, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
removeCavemanHooks (cognitive 16) installer/lib/settings.js:270— removeCavemanHooks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 1 (nesting depth added 3). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CavemanPlugin.chat.message (cognitive 16) src/plugins/opencode/plugin.js:320— CavemanPlugin.chat.message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
startSink (cognitive 16) packages/subagent-tax/lib/sink.mjs:321— startSink has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 4 (6 pts), boolean chains 2, error handling 1, other 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 332, 325, 329, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
resolveWindowsCommand (cognitive 16) packages/subagent-tax/lib/process-tree.mjs:10— resolveWindowsCommand has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 3 (4 pts), loops 2 (3 pts), other 2, boolean chains 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D22 · Internal API Consistency· Inconsistent parameter signatures for framework-specific wrapper functions. Some accept `manifest_bytes` (Anthropic, LangChain), some accept `runtime_key` (Autogen), and others accept neither. This forces consumers to guess which optional arguments are required for which framework. · ×1
Inconsistent parameter signatures for framework-specific wrapper functions. Some accept `manifest_bytes` (Anthropic, LangChain), some accept `runtime_key` (Autogen), and others accept neither. This forces consumers to guess which optional arguments are required for which framework. — Standardize the signature to accept a common `options` dict or explicitly define which parameters are universal vs. framework-specific. Ideally, `manifest_bytes` and `runtime_key` should be optional keyword arguments with defaults, or handled via a unified `CavemanConfig` object. (signatures: agno.with_caveman_model(model: Model, runtime, scope, accept_framework_version) | anthropic.with_caveman_anthropic(client, runtime, scope, accept_framework_version, manifest_bytes) | autogen.with_caveman_model(model_client, runtime, scope, runtime_key, accept_framework_version) | crewai.with_caveman_llm(llm, runtime, scope, accept_framework_version) | google.with_caveman_google(client, runtime, scope, accept_framework_version) | langchain.with_caveman_model(model: BaseChatModel, runtime, scope, accept_framework_version, manifest_bytes))
D22 · Internal API Consistency· Inconsistent parameter signatures for agent wrapper functions. Similar to the model wrappers, `manifest_bytes` is present in LangChain but not others, and `runtime_key` is present in Autogen but not others. · ×1
Inconsistent parameter signatures for agent wrapper functions. Similar to the model wrappers, `manifest_bytes` is present in LangChain but not others, and `runtime_key` is present in Autogen but not others. — Unify the signature across all framework integrations. If `manifest_bytes` and `runtime_key` are optional, they should be optional in all signatures to prevent `TypeError` when switching frameworks. (signatures: agno.with_caveman_agent(options: dict, runtime, scope, accept_framework_version): dict | autogen.with_caveman_agent(options: dict, runtime, scope, runtime_key, accept_framework_version): dict | crewai.with_caveman_agent(options, runtime, scope, accept_framework_version) | langchain.with_caveman_agent(options: dict, runtime, scope, accept_framework_version, manifest_bytes): dict)
D22 · Internal API Consistency· Inconsistent invocation patterns. The Agno integration exposes a high-level `invoke`/`ainvoke` API similar to LangChain's standard `BaseChatModel`, but the Langchain integration itself exposes low-level `wrap_model_call` hooks instead of a direct `invoke` method on the middleware class. This creates a confusing API surface where one framework feels like a drop-in replacement and the other feels like a hook-based interceptor. · ×1
Inconsistent invocation patterns. The Agno integration exposes a high-level `invoke`/`ainvoke` API similar to LangChain's standard `BaseChatModel`, but the Langchain integration itself exposes low-level `wrap_model_call` hooks instead of a direct `invoke` method on the middleware class. This creates a confusing API surface where one framework feels like a drop-in replacement and the other feels like a hook-based interceptor. — If the goal is to provide a consistent `CavemanModel`-like interface across frameworks, the Langchain middleware should expose `invoke`/`ainvoke` methods that delegate to the internal handler, or the Agno integration should be refactored to use the same hook-based pattern if that is the core architectural choice. (signatures: agno.CavemanModel.invoke(self, messages) | agno.CavemanModel.ainvoke(self, messages) | agno.CavemanModel.invoke_stream(self, messages) | agno.CavemanModel.ainvoke_stream(self, messages) | langchain.CavemanMiddleware.wrap_model_call(self, request, handler) | langchain.CavemanMiddleware.awrap_model_call(self, request, handler))
D22 · Internal API Consistency· Inconsistent token counting APIs. Agno's `count_tokens` takes no arguments (likely using internal state), while Autogen's `count_tokens` requires `messages` and `tools`. This inconsistency makes it difficult to write generic code that works across frameworks. · ×1
Inconsistent token counting APIs. Agno's `count_tokens` takes no arguments (likely using internal state), while Autogen's `count_tokens` requires `messages` and `tools`. This inconsistency makes it difficult to write generic code that works across frameworks. — Standardize the token counting signature. Either all should accept the input payload to calculate tokens, or all should rely on internal state/context. If internal state is used, ensure the state is consistently maintained. (signatures: agno.CavemanModel.count_tokens(self) | agno.CavemanModel.acount_tokens(self) | autogen.CavemanChatCompletionClient.count_tokens(self, messages, tools) | autogen.CavemanChatCompletionClient.remaining_tokens(self, messages, tools))
D22 · Internal API Consistency· Duplicate intent with different type names. `_usage.UsageReader` and `google._Usage` have identical method signatures (`feed`, `event`, `finish`) and field structures (`sse`, `decoder`, `text`, etc.). This suggests code duplication rather than a unified usage tracking interface. · ×1
Duplicate intent with different type names. `_usage.UsageReader` and `google._Usage` have identical method signatures (`feed`, `event`, `finish`) and field structures (`sse`, `decoder`, `text`, etc.). This suggests code duplication rather than a unified usage tracking interface. — Extract a common `UsageReader` or `SSEParser` interface/class and use it in both the generic `_usage` module and the `google` integration. Remove `google._Usage` if it is merely a copy-paste of `UsageReader`. (signatures: google._Usage.feed(self, chunk) | google._Usage.event(self, value) | google._Usage.finish(self) | _usage.UsageReader.feed(self, chunk) | _usage.UsageReader.event(self, value) | _usage.UsageReader.finish(self))
Duplicated block (40 lines × 2) proxy/providers/anthropic/splice.go:38— proxy/providers/anthropic/splice.go:38-77 | proxy/providers/openai/content_compress.go:480-519 — before extracting anything, compare `proxy/providers/anthropic/splice.go` and `proxy/providers/openai/content_compress.go` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 159 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (33 lines × 3) proxy/internal/gateway/retrieve_tool.go:241— proxy/internal/gateway/retrieve_tool.go:241-273 | proxy/providers/anthropic/splice.go:117-149 | proxy/providers/openai/content_compress.go:559-591 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/gateway/retrieve_tool.go:241` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `proxy/internal/gateway/retrieve_tool.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (24–27 lines × 2) proxy/providers/adapter.go:999— proxy/providers/adapter.go:999-1025 | proxy/providers/bedrock/usage.go:159-182 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/adapter.go:999` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–21 lines × 2) REDACTED:832— REDACTED:832-852 | REDACTED:886-901 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:832` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 3) engine/compressors/toolschema_annotations.go:330— engine/compressors/toolschema_annotations.go:330-348 | proxy/internal/translate/jsonfast.go:71-89 | proxy/providers/jsonsplice/jsonsplice.go:253-271 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Check import visibility before settling on that home: `proxy/internal/translate/jsonfast.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (18 lines × 2) proxy/internal/translate/chat_stream.go:316— proxy/internal/translate/chat_stream.go:316-333 | proxy/internal/translate/responses_stream.go:493-510 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/internal/translate/chat_stream.go:316` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `proxy/internal/translate/chat_stream.go:334` calls `start` and `proxy/internal/translate/responses_stream.go:511` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–17 lines × 2) proxy/internal/translate/chat_stream.go:393— proxy/internal/translate/chat_stream.go:393-407 | proxy/internal/translate/responses_stream.go:582-598 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14–16 lines × 2) proxy/providers/anthropic/breakpoint_plan.go:128— proxy/providers/anthropic/breakpoint_plan.go:128-141 | proxy/providers/anthropic/breakpoint_plan.go:191-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `proxy/providers/anthropic/breakpoint_plan.go:128` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–15 lines × 2) proxy/internal/gateway/chatgpt.go:55— proxy/internal/gateway/chatgpt.go:55-65 | REDACTED:119-133 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–15 lines × 2) shared/platform/ssrf/ssrf.go:194— shared/platform/ssrf/ssrf.go:194-202 | shared/platform/ssrf/ssrf.go:247-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) shared/platform/ssrf/ssrf.go:31— shared/platform/ssrf/ssrf.go:31-40 | shared/platform/ssrf/ssrf.go:75-84 | shared/platform/ssrf/ssrf.go:95-104 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `shared/platform/ssrf/ssrf.go:31` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 3) proxy/providers/anthropic/breakpoint_plan.go:131— proxy/providers/anthropic/breakpoint_plan.go:131-139 | proxy/providers/anthropic/breakpoint_plan.go:161-169 | proxy/providers/anthropic/breakpoint_plan.go:196-204 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) engine/compressors/log.go:119— engine/compressors/log.go:119-126 | engine/compressors/searchresult.go:60-67 | engine/compressors/text.go:66-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (163 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:933— plugins/caveman/skills/caveman-compress/scripts/compress.py:933-1095 | skills/caveman-compress/scripts/compress.py:933-1095 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (71 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:122— plugins/caveman/skills/caveman-compress/scripts/validate.py:122-192 | skills/caveman-compress/scripts/validate.py:122-192 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (57 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:610— plugins/caveman/skills/caveman-compress/scripts/compress.py:610-666 | skills/caveman-compress/scripts/compress.py:610-666 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (51 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:808— plugins/caveman/skills/caveman-compress/scripts/compress.py:808-858 | skills/caveman-compress/scripts/compress.py:808-858 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (50 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:69— plugins/caveman/skills/caveman-compress/scripts/validate.py:69-118 | skills/caveman-compress/scripts/validate.py:69-118 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (47 lines × 2) plugins/caveman/skills/caveman-compress/scripts/cli.py:36— plugins/caveman/skills/caveman-compress/scripts/cli.py:36-82 | skills/caveman-compress/scripts/cli.py:36-82 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/cli.py` and `skills/caveman-compress/scripts/cli.py` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (44 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:154— plugins/caveman/skills/caveman-compress/scripts/compress.py:154-197 | skills/caveman-compress/scripts/compress.py:154-197 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (43 lines × 2) plugins/caveman/skills/caveman-compress/scripts/detect.py:78— plugins/caveman/skills/caveman-compress/scripts/detect.py:78-120 | skills/caveman-compress/scripts/detect.py:78-120 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/detect.py` and `skills/caveman-compress/scripts/detect.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (41 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:238— plugins/caveman/skills/caveman-compress/scripts/validate.py:238-278 | skills/caveman-compress/scripts/validate.py:238-278 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/caveman/skills/caveman-compress/scripts/validate.py:238` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (39 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:891— plugins/caveman/skills/caveman-compress/scripts/compress.py:891-929 | skills/caveman-compress/scripts/compress.py:891-929 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (34 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:220— plugins/caveman/skills/caveman-compress/scripts/compress.py:220-253 | skills/caveman-compress/scripts/compress.py:220-253 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (27 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:196— plugins/caveman/skills/caveman-compress/scripts/validate.py:196-222 | skills/caveman-compress/scripts/validate.py:196-222 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:421— plugins/caveman/skills/caveman-compress/scripts/compress.py:421-446 | skills/caveman-compress/scripts/compress.py:421-446 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23 lines × 2) plugins/caveman/skills/caveman-compress/scripts/validate.py:285— plugins/caveman/skills/caveman-compress/scripts/validate.py:285-307 | skills/caveman-compress/scripts/validate.py:285-307 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/validate.py` and `skills/caveman-compress/scripts/validate.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 284 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) plugins/caveman/skills/caveman-compress/scripts/compress.py:258— plugins/caveman/skills/caveman-compress/scripts/compress.py:258-277 | skills/caveman-compress/scripts/compress.py:258-277 — before extracting anything, compare `plugins/caveman/skills/caveman-compress/scripts/compress.py` and `skills/caveman-compress/scripts/compress.py` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 774 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/caveman/skills/caveman-compress/scripts/compress.py:258` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Off the main sequence: @caveman-ai/sdk — @caveman-ai/sdk: abstractness 0.25, instability 0.00, distance 0.75 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Duplication concentrated across 9 sibling directories (10 clone groups) browse/bin/caveman-browse.mjs:12— 10 duplicated blocks under the repository root have copies in at least two of the sibling directories agents, browse, installer, integrations, mcp, packages (+3 more sibling(s) not listed) — 9 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 4 sibling directories (7 clone groups) REDACTED:22419— 7 of the duplicated blocks reported below have copies in at least two of the sibling directories cli, pi-extension, shared, subagent-tax under packages/. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication· Duplicated block with local edits (49 matched lines × 2 locations) · ×1
Duplicated block with local edits (49 matched lines × 2 locations) supabase/functions/blocks-telemetry/ingest.ts:40— supabase/functions/blocks-telemetry/ingest.ts:40 · supabase/functions/cli-telemetry/ingest.ts:33 — the two spans are one implementation copied and then locally edited — 457 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (44 lines × 2 locations) browse/bin/caveman-browse.mjs:12— browse/bin/caveman-browse.mjs:12 · mcp/bin/caveman-mcp.mjs:12 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication· Duplicated block with local edits (42 matched lines × 2 locations) · ×1
Duplicated block with local edits (42 matched lines × 2 locations) installer/lib/portable-process.js:6— installer/lib/portable-process.js:6 · src/mcp-servers/caveman-shrink/spawn-options.js:15 — the two spans are one implementation copied and then locally edited — 375 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (39 lines × 2 locations) REDACTED:14433— REDACTED:14433 · REDACTED:15721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2 locations) REDACTED:17014— REDACTED:17014 · packages/cli/src/native-hook-fast.ts:228 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (30 lines × 2 locations) supabase/functions/blocks-telemetry/index.ts:19— supabase/functions/blocks-telemetry/index.ts:19 · supabase/functions/cli-telemetry/index.ts:17 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (27 lines × 2 locations) REDACTED:17070— REDACTED:17070 · packages/cli/src/native-hook-fast.ts:277 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (24 matched lines × 2 locations) · ×1
Duplicated block with local edits (24 matched lines × 2 locations) agents/delegate/portable-process.mjs:74— agents/delegate/portable-process.mjs:74 · packages/cli/src/portable-command.ts:48 — the two spans are one implementation copied and then locally edited — 285 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (22 lines × 2 locations) src/hooks/caveman-config.js:235— src/hooks/caveman-config.js:235 · src/hooks/caveman-config.js:355 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (19 lines × 2 locations) REDACTED:14034— REDACTED:14034 · REDACTED:18374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2 locations) REDACTED:10818— REDACTED:10818 · REDACTED:10842 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2 locations) REDACTED:17112— REDACTED:17112 · packages/cli/src/native-hook-fast.ts:314 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication· Duplicated block with local edits (11 matched lines × 2 locations) · ×1
Duplicated block with local edits (11 matched lines × 2 locations) REDACTED:2745— REDACTED:2745 · shrink/bin/caveman-shrink.mjs:12 — the two spans are one implementation copied and then locally edited — 53 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (10 lines × 3 locations) REDACTED:10774— REDACTED:10774 · REDACTED:10813 · REDACTED:10837 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Complex function spawnWrapped (cyclomatic 167, cognitive 199) REDACTED:6591— spawnWrapped has cyclomatic complexity 167 and cognitive complexity 199; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function uninstall (cyclomatic 160, cognitive 325) REDACTED:2145— uninstall has cyclomatic complexity 160 and cognitive complexity 325; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function restoreNativeOperation (cyclomatic 118, cognitive 200) REDACTED:10758— restoreNativeOperation has cyclomatic complexity 118 and cognitive complexity 200; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function nativeHook (cyclomatic 99, cognitive 94) REDACTED:17364— nativeHook has cyclomatic complexity 99 and cognitive complexity 94; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function nativeIntegrationStatus (cyclomatic 88, cognitive 75) REDACTED:11303— nativeIntegrationStatus has cyclomatic complexity 88 and cognitive complexity 75; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function onboard (cyclomatic 82, cognitive 140) packages/cli/src/modules/onboard.ts:123— onboard has cyclomatic complexity 82 and cognitive complexity 140; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function checkPlan (cyclomatic 74, cognitive 32) packages/sdk/typescript/src/middleware/validate.ts:86— checkPlan has cyclomatic complexity 74 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateReceiptContent (cyclomatic 73, cognitive 79) REDACTED:21140— validateReceiptContent has cyclomatic complexity 73 and cognitive complexity 79; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function compatForRoutedModel (cyclomatic 73, cognitive 44) packages/pi-extension/src/provider-compat.ts:49— compatForRoutedModel has cyclomatic complexity 73 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function qwenRouteOverride (cyclomatic 66, cognitive 103) REDACTED:15406— qwenRouteOverride has cyclomatic complexity 66 and cognitive complexity 103; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function status (cyclomatic 64, cognitive 63) · ×1
Complex function status (cyclomatic 64, cognitive 63) REDACTED:20832— status has cyclomatic complexity 64 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validate (cyclomatic 60, cognitive 76) agents/compile.mjs:289— validate has cyclomatic complexity 60 and cognitive complexity 76; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function main (cyclomatic 60, cognitive 53) · ×1
Complex function main (cyclomatic 60, cognitive 53) packages/cli/src/native-hook-fast.ts:434— main has cyclomatic complexity 60 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readOwnedMcpPendingJournalAt (cyclomatic 54, cognitive 38) REDACTED:15832— readOwnedMcpPendingJournalAt has cyclomatic complexity 54 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function apply (cyclomatic 53, cognitive 73) packages/pi-extension/src/provider.ts:64— apply has cyclomatic complexity 53 and cognitive complexity 73; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 53, cognitive 65) REDACTED:11310— (anonymous) has cyclomatic complexity 53 and cognitive complexity 65; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function nativeDoctor (cyclomatic 52, cognitive 57) REDACTED:11556— nativeDoctor has cyclomatic complexity 52 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function buildWrapEnv (cyclomatic 51, cognitive 70) REDACTED:12251— buildWrapEnv has cyclomatic complexity 51 and cognitive complexity 70; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function project (cyclomatic 51, cognitive 67) packages/middleware/typescript/src/ai-sdk.ts:137— project has cyclomatic complexity 51 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function login (cyclomatic 51, cognitive 47) REDACTED:12570— login has cyclomatic complexity 51 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
REDACTED: 2656 lines of code REDACTED:1— REDACTED has 2656 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/sdk/typescript/src/index.ts · ×1
packages/sdk/typescript/src/index.ts: 2306 lines of code packages/sdk/typescript/src/index.ts:1— packages/sdk/typescript/src/index.ts has 2306 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/cli/src/modules/onboard.ts · ×1
packages/cli/src/modules/onboard.ts: 815 lines of code packages/cli/src/modules/onboard.ts:1— packages/cli/src/modules/onboard.ts has 815 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/hooks/caveman-config.js · ×1
src/hooks/caveman-config.js: 813 lines of code src/hooks/caveman-config.js:1— src/hooks/caveman-config.js has 813 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/sdk/typescript/src/middleware/runtime.ts · ×1
packages/sdk/typescript/src/middleware/runtime.ts: 654 lines of code packages/sdk/typescript/src/middleware/runtime.ts:1— packages/sdk/typescript/src/middleware/runtime.ts has 654 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/cli/src/agent-mcp.ts · ×1
packages/cli/src/agent-mcp.ts: 651 lines of code packages/cli/src/agent-mcp.ts:1— packages/cli/src/agent-mcp.ts has 651 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/cli/src/modules/apply.ts · ×1
packages/cli/src/modules/apply.ts: 642 lines of code packages/cli/src/modules/apply.ts:1— packages/cli/src/modules/apply.ts has 642 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
src/hooks/caveman-stats.js: 609 lines of code src/hooks/caveman-stats.js:1— src/hooks/caveman-stats.js has 609 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
agents/compile.mjs: 588 lines of code agents/compile.mjs:1— agents/compile.mjs has 588 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/hooks/caveman-activate.js · ×1
src/hooks/caveman-activate.js: 576 lines of code src/hooks/caveman-activate.js:1— src/hooks/caveman-activate.js has 576 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 478 lines of code REDACTED:1— REDACTED has 478 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/cli/src/native-hook-fast.ts · ×1
packages/cli/src/native-hook-fast.ts: 471 lines of code packages/cli/src/native-hook-fast.ts:1— packages/cli/src/native-hook-fast.ts has 471 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/shared/contracts/conformance/run.mjs · ×1
packages/shared/contracts/conformance/run.mjs: 467 lines of code packages/shared/contracts/conformance/run.mjs:1— packages/shared/contracts/conformance/run.mjs has 467 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/hooks/caveman-mode-tracker.js · ×1
src/hooks/caveman-mode-tracker.js: 424 lines of code src/hooks/caveman-mode-tracker.js:1— src/hooks/caveman-mode-tracker.js has 424 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
installer/lib/settings.js: 410 lines of code installer/lib/settings.js:1— installer/lib/settings.js has 410 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· packages/subagent-tax/run.mjs · ×1
packages/subagent-tax/run.mjs: 401 lines of code packages/subagent-tax/run.mjs:1— packages/subagent-tax/run.mjs has 401 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling· The declared test suite includes a file that cannot be loaded · ×1
The declared test suite includes a file that cannot be loaded packages/middleware/typescript/tests/required.mjs:4— This repository declares test tooling, and the ✓ above records that declaration — but packages/middleware/typescript/tests/required.mjs and 2 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to.
Dead file (~503 LoC) packages/cli/src/native-hook-fast.ts— no import path from any entry point (235 application, 60 tooling, 287 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~340 LoC) packages/shared/contracts/scripts/validate-continuous-improvement.mjs— no import path from any entry point (235 application, 60 tooling, 287 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~298 LoC) skills/compile.mjs— no import path from any entry point (235 application, 60 tooling, 287 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~213 LoC) skills/verbs-gate.mjs— no import path from any entry point (235 application, 60 tooling, 287 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (skills/compile.mjs) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~97 LoC) src/plugins/opencode/server.js— no import path from any entry point (235 application, 60 tooling, 287 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Silent fallback default on error engine/cmd/caveman-engine/main.go:613— `modelFromJSON` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error engine/compressors/axtree.go:597— `compactAXString` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error engine/pixel/transform_anthropic.go:1515— `jsonCompact` turns a non-nil `err` into `return "null"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error engine/pixel/transform_anthropic.go:1523— `safeStringifyLen` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/cloudlink/link.go:469— `macKeychain` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/cloudlink/link.go:1369— `poolAnswer` turns a non-nil `err` into `return nil, "", "login_unusable"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error REDACTED:422— `warmBody` turns a non-nil `err` into `return nil, 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error REDACTED:192— `currentRepositoryState` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error REDACTED:240— `findGitDir` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error REDACTED:315— `configuredMode` turns a non-nil `err` into `return "compress"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error REDACTED:354— `fileInputState` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/repointel/index.go:620— `gitActivity` turns a non-nil `err` into `return map[string]int{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:68— `claudeRoot` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:82— `codexRoot` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:100— `geminiRoot` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:120— `opencodeRoot` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:137— `piRoot` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:252— `claudeGlobalConfigPath` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:406— `readSkillFrontmatter` turns a non-nil `err` into `return skillFrontmatter{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:483— `scanHooks` turns a non-nil `err` into `return 0, nil` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/config_scan.go:561— `countPlugins` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/learn_loops.go:161— `toolInputSummary` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/learn_trends.go:701— `learnTrendsHTML` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/usage_import.go:559— `int64FromAny` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error proxy/internal/store/usage_import.go:590— `float64FromAny` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Duplicated predicate proxy/internal/store/learn_portfolio.go:179— `!event.Timestamp.IsZero() || event.ContextUsagePresent || len(event.TextPayloads) > 0 || len(event.ToolCalls) > 0` appears character-identically in 2 files — proxy/internal/store/learn_portfolio.go, proxy/internal/store/session_source.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/pixel.go:317— `!ok || messagesSpan.start >= len(body) || body[messagesSpan.start] != '['` appears character-identically in 3 files — proxy/internal/gateway/pixel.go, proxy/providers/anthropic/content_compress.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/store/source_claude.go:73— `!since.IsZero() && !ts.IsZero() && ts.Before(since)` appears character-identically in 6 files — proxy/internal/store/source_claude.go, proxy/internal/store/source_codex.go, proxy/internal/store/source_gemini.go, proxy/internal/store/source_opencode.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate engine/compressors/config.go:128— `!utf8.Valid(input) || len(bytes.TrimSpace(input)) == 0` appears character-identically in 2 files — engine/compressors/config.go, engine/compressors/tabular.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/retrieve_tool.go:204— `arr.start < 0 || arr.end > len(body) || arr.start >= arr.end || body[arr.start] != '['` appears character-identically in 3 files — proxy/internal/gateway/retrieve_tool.go, proxy/providers/anthropic/splice.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/pixel.go:363— `block.start >= block.end || body[block.start] != '{'` appears character-identically in 2 files — proxy/internal/gateway/pixel.go, proxy/providers/anthropic/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate engine/compressors/toolschema_annotations.go:380— `c == ' ' || c == '\n' || c == '\r' || c == '\t'` appears character-identically in 2 files — engine/compressors/toolschema_annotations.go, proxy/internal/translate/jsonfast.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/providers/anthropic/splice.go:221— `c.start < last || c.end > len(body) || c.start >= c.end` appears character-identically in 2 files — proxy/providers/anthropic/splice.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/pixel.go:352— `content.start < content.end && body[content.start] == '['` appears character-identically in 3 files — proxy/internal/gateway/pixel.go, proxy/providers/anthropic/content_compress.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/pixel.go:518— `content.start >= content.end || body[content.start] != '['` appears character-identically in 2 files — proxy/internal/gateway/pixel.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/store/source_claude.go:32— `err != nil || d.IsDir() || !strings.HasSuffix(path, ".jsonl")` appears character-identically in 2 files — proxy/internal/store/source_claude.go, proxy/internal/store/source_pi.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate engine/evals/harness.go:139— `err != nil || rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator))` appears character-identically in 2 files — engine/evals/harness.go, proxy/internal/store/learn.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/translate/chat_stream.go:513— `event.Response != nil && event.Response.Error != nil` appears character-identically in 2 files — proxy/internal/translate/chat_stream.go, proxy/internal/translate/messages_responses.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/store/source_codex.go:143— `fresh64 < 0 || cached64 < 0 || out64 < 0 || fresh64 > math.MaxInt || cached64 > math.MaxInt || out64 > math.MaxInt` appears character-identically in 2 files — proxy/internal/store/source_codex.go, proxy/internal/store/source_gemini.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/store/source_claude.go:116— `fresh64 < 0 || out64 < 0 || fresh64 > math.MaxInt || out64 > math.MaxInt` appears character-identically in 2 files — proxy/internal/store/source_claude.go, proxy/internal/store/source_opencode.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/pixel.go:473— `item.start >= item.end || body[item.start] != '{'` appears character-identically in 2 files — proxy/internal/gateway/pixel.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/providers/anthropic/content_compress.go:374— `len(original) < minCompressBlockBytes && !(allowForcedTOON && forcedTOONCandidate(original))` appears character-identically in 2 files — proxy/providers/anthropic/content_compress.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/translate/chat_stream.go:346— `len(start.Input) > 0 && string(start.Input) != "{}"` appears character-identically in 2 files — proxy/internal/translate/chat_stream.go, proxy/internal/translate/responses_stream.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/providers/anthropic/content_compress.go:385— `len(trimmed) > 0 && (trimmed[0] == '{' || trimmed[0] == '[')` appears character-identically in 2 files — proxy/providers/anthropic/content_compress.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/providers/adapter.go:1022— `line == "" || strings.HasPrefix(line, ":")` appears character-identically in 2 files — proxy/providers/adapter.go, proxy/providers/bedrock/usage.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/store/learn_outcomes.go:395— `metric.Observed && strings.TrimSpace(metric.Repo) != ""` appears character-identically in 2 files — proxy/internal/store/learn_outcomes.go, proxy/internal/store/learn_portfolio.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/retrieve_tool.go:162— `obj.start < 0 || obj.end > len(body) || obj.start >= obj.end || body[obj.start] != '{'` appears character-identically in 4 files — proxy/internal/gateway/retrieve_tool.go, proxy/providers/anthropic/frozen.go, proxy/providers/anthropic/splice.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/gateway/pixel.go:438— `part.start >= part.end || body[part.start] != '{'` appears character-identically in 2 files — proxy/internal/gateway/pixel.go, proxy/providers/openai/content_compress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/providers/anthropic/cache_breakpoints.go:50— `policy.AuthMode != "" && policy.AuthMode != "payg"` appears character-identically in 2 files — proxy/providers/anthropic/cache_breakpoints.go, proxy/providers/bedrock/cache_points.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate proxy/internal/store/source_claude.go:137— `read64 < 0 || creation64 < 0 || read64 > math.MaxInt || creation64 > math.MaxInt` appears character-identically in 2 files — proxy/internal/store/source_claude.go, proxy/internal/store/source_pi.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Hand-rolled JSON/XML parsing via regex REDACTED:2317— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/cloudlink/link.go:753— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/cloudlink/link.go:754— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/cloudlink/link.go:850— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/cloudlink/link.go:851— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/gateway/route_cache.go:161— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/gateway/route_cache.go:372— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/gateway/route_cache.go:373— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/gateway/route.go:1535— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex REDACTED:378— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/store/learn.go:1035— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/store/detect_subagent_spend.go:30— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/translate/translate.go:126— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex proxy/internal/translate/responses.go:275— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Go code already uses a real parser in the same package; use it here too.
README/code drift INSTALL.md:186— INSTALL.md names `.cursor/rules/caveman.mdc`, but no file or folder `.cursor/rules/caveman.mdc` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift INSTALL.md:455— INSTALL.md names `.github/copilot-instructions.md`, but no file or folder `.github/copilot-instructions.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/PACKAGE_RELEASES.md:116— docs/PACKAGE_RELEASES.md names the package `@caveman-ai/middleware@latest`, but no REDACTED of the workspace declares or depends on it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift evals/README.md:78— evals/README.md names `snapshots/fidelity.json`, but no file or folder `snapshots/fidelity.json` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/technical/agent-profile-registry.md:21— docs/technical/agent-profile-registry.md documents the environment variable `WRAP_BASE_URL_ENV_VARS`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/technical/configuration.md:66— docs/technical/configuration.md documents the environment variable `CAVEMAN_MCP`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/technical/context-recovery.md:145— docs/technical/context-recovery.md documents the environment variable `SQLITE_FCNTL_PERSIST_WAL`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/technical/deploy.md:99— docs/technical/deploy.md names `deploy/.env`, but no file or folder `deploy/.env` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/technical/learn.md:88— docs/technical/learn.md names `mem/mem.db`, but no file or folder `mem/mem.db` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/technical/provider-authentication.md:46— docs/technical/provider-authentication.md names OpenAI 1, but the manifest declares `openai` 7.12.1. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/technical/testing-and-benchmarks.md:58— docs/technical/testing-and-benchmarks.md runs `node --test --test-force-exit tests/*.js`, but `tests/*.js` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift packages/sdk/typescript/README.md:66— packages/sdk/typescript/README.md runs `node quickstart.mjs`, but `quickstart.mjs` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every REDACTED, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Silent fallback default in catch packages/middleware/python/caveman_middleware/_native.py:299— `registered` swallows every exception into `return False` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch packages/middleware/python/caveman_middleware/anthropic.py:67— `_messages_call` swallows every exception into `return False` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch packages/middleware/python/caveman_middleware/llama_index.py:540— `_still_registered` swallows every exception into `return False` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch packages/middleware/python/caveman_middleware/llama_index.py:850— `_reader_current` swallows every exception into `return False` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:170— `claude_version` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch agents/probe-installed.mjs:39— `executable` (in `which`) swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch browse/bin/binary-installer.generated.mjs:26— `executable` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch browse/bin/binary-installer.generated.mjs:112— `signedDigest` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch browse/bin/caveman-browse.mjs:40— `withoutOwnNpmBin` swallows every exception into `return true` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch extension/scripts/firefox-e2e.mjs:106— `ffVersion` swallows every exception into `return "unknown"` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:149— `takeCreatedDirs` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:354— `cursorExtPresent` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
P2 · Observability· Console output used as the logging channel · ×8
Console output used as the logging channel integrations/compile.mjs:50— `integrations/compile.mjs` reports through `console.*` at line 50 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel integrations/compile.mjs:184— `integrations/compile.mjs` reports through `console.*` at line 184 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel skills/compile.mjs:33— `skills/compile.mjs` reports through `console.*` at line 33 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel skills/compile.mjs:257— `skills/compile.mjs` reports through `console.*` at line 257 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel skills/compile.mjs:276— `skills/compile.mjs` reports through `console.*` at line 276 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel skills/compile.mjs:289— `skills/compile.mjs` reports through `console.*` at line 289 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel skills/compile.mjs:295— `skills/compile.mjs` reports through `console.*` at line 295 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel skills/compile.mjs:297— `skills/compile.mjs` reports through `console.*` at line 297 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Documentation: no project overview README.md— The root README is a banner with an A/B-test citation and no overview of what Caveman does or what it is for. State the project's purpose (AI agent that says less, reads less) and its main value proposition.
Documentation: no licence statement README.md— The root README has no licence statement in the banner or body. State the Apache-2.0 license and link to LICENSE.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 1 of 19 project(s) overshoot their size bounds, lowering Project Cohesion to 8.9/10. The most over is `(repository root)` (90777 LoC, 455 module-visible types across 75 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 1 of 316 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 316 of the 383 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: evals/plot.py. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
Orphaned file evals/plot.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
No runtime threat detection — No runtime threat-detection engine (Tetragon TracingPolicy / Falco) is committed. These observe process, file and network activity in-kernel and can alert or kill on malicious behaviour a static scan cannot catch.
M2 · Architecture documentation· ADRs not easily discoverable · ×1
ADRs not easily discoverable — 2 ADR-shaped document(s) detected by content — `tests/caveman-compress/project-notes.md`, `tests/caveman-compress/project-notes.original.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
Logging is not universal — Only 4/10 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `browse`, `mcp`, `packages/subagent-tax`, `shrink` and 1 more.
Unused export 'ensureBinary' packages/shared/binary-installer/installer.mjs:175— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused module-local declaration 'derivedCompleteness' · ×1
Unused module-local declaration 'derivedCompleteness' agents/compile.mjs:278— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'mcpMarkerPath' · ×1
Unused module-local declaration 'mcpMarkerPath' REDACTED:13650— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'recallHookInstalled' · ×1
Unused module-local declaration 'recallHookInstalled' REDACTED:17786— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'shrinkHookInstalled' · ×1
Unused module-local declaration 'shrinkHookInstalled' REDACTED:18474— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'dockerState' · ×1
Unused module-local declaration 'dockerState' REDACTED:22449— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration '_empty' · ×1
Unused module-local declaration '_empty' packages/sdk/typescript/tests/task-profile.test.ts:29— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
X2 · Cancellation propagation· Not all functions that make a request accept a context.Context or an AbortSignal · ×1
Not all functions that make a request accept a context.Context or an AbortSignal — Only 38/58 functions that make a cancellable request (fetch, axios, ky, ofetch; net/http, net.Dial) accept a context.Context or an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` (Go: `ctx context.Context`) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Null assertions (`!`) reduce the strict null checking score — ~9.7 `!` null assertions per 1k TypeScript source lines — 355 assertion(s) across the 36776 source line(s) of the 62 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: REDACTED (192), packages/sdk/typescript/src/index.ts (52), packages/cli/src/modules/onboard.ts (28). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
Silent fallback default on parse failure packages/middleware/python/caveman_middleware/langchain.py:222— `_recovery_intact` returns `False` when `(TypeError, ValueError, AttributeError, RecursionError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Subsumed condition operand proxy/internal/store/learn.go:1268— `strings.Contains(m, "[1m]")` can never decide this `||` — every value satisfying `strings.Contains(m, "[1m]")` also satisfies `strings.Contains(m, "1m")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Skipped (documented): untracked sessions keep their record proxy when a new wrap requests compression packages/cli/tests/wrap-restart.runtime.mjs:148— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): untracked sessions keep their proxy when a new wrap changes recovery packages/cli/tests/wrap-restart.runtime.mjs:180— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): another live session marker prevents restart and preserves running mode packages/cli/tests/wrap-restart.runtime.mjs:214— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): another live session with incompatible recovery gate makes new agent run direct packages/cli/tests/wrap-restart.runtime.mjs:245— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): mode mismatch sends no signal and still launches agent packages/cli/tests/wrap-restart.runtime.mjs:276— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): generation takeover aborts signal and reports successor live mode packages/cli/tests/wrap-restart.runtime.mjs:331— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): foreign listener is never signalled and forces a direct launch packages/cli/tests/wrap-restart.runtime.mjs:391— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): a wrap that starts the proxy itself reports it as its own, once packages/cli/tests/wrap-restart.runtime.mjs:439— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): failed local proxy startup launches agent without a dead proxy base URL packages/cli/tests/wrap-restart.runtime.mjs:476— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): interactive first command persists default-on with disclosure and a stable id packages/cli/tests/telemetry.runtime.mjs:166— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): an interactive stale-version opt-out stays byte-identical and silent packages/cli/tests/telemetry.runtime.mjs:363— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): command_run carries the proxy token delta, then stops repeating it packages/cli/tests/telemetry.runtime.mjs:401— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): two CLI processes racing the same watermark do not both claim the delta packages/cli/tests/telemetry.runtime.mjs:478— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): telemetry off drops the token watermark so re-enabling re-seeds packages/cli/tests/telemetry.runtime.mjs:560— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): a log line on the proxy's stdout does not break or poison the token read packages/cli/tests/telemetry.runtime.mjs:610— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): a rewound proxy store re-baselines instead of replaying or going negative packages/cli/tests/telemetry.runtime.mjs:654— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): a stale-version opt-in is re-disclosed once and never re-asked packages/cli/tests/telemetry.runtime.mjs:709— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): a stale-version opt-in sends nothing from a command that skips the re-disclosure packages/cli/tests/telemetry.runtime.mjs:747— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): an interactive run under DO_NOT_TRACK persists the opt-out packages/cli/tests/telemetry.runtime.mjs:875— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): two sync processes racing the same watermark upload each local row once packages/cli/tests/sync.runtime.mjs:789— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): CLI method mirror matches the Go verified-method registry packages/cli/tests/receipts.runtime.mjs:91— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): seeded Claude root sits on the real three-session recurrence threshold packages/cli/tests/harness-session-history.runtime.mjs:22— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): real proxy wraps stub agent through stub upstream and records SQLite telemetry packages/cli/tests/harness-agent-upstream.runtime.mjs:70— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): every shipped profile's selected supported transport preserves recovery through the real compression engine packages/cli/tests/agent-compression-conformance.runtime.mjs:420— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Skipped (documented): B9/§15: the default transport honors HTTP(S)_PROXY / NO_PROXY itself, never proxies loopback, and close() leaves no handles packages/sdk/typescript/tests/middleware-hardening.runtime.mjs:367— Skipped with a documented reason — a deferral, not lazy debt: skipped at run time by a this.skip()/t.skip() call
Outdated: github.com/Microsoft/go-winio — `github.com/Microsoft/go-winio` is required at v0.6.2 in go.mod, but v0.6.4 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/Microsoft/go-winio@v0.6.4 && go mod tidy` and commit the updated go.mod and go.sum.
Outdated: github.com/chromedp/cdproto — `github.com/chromedp/cdproto` is required at v0.0.0-20260714215040-dc233986426f in go.mod, but v0.158.4 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/chromedp/cdproto@v0.158.4 && go mod tidy` and commit the updated go.mod and go.sum.
Outdated: github.com/chromedp/chromedp — `github.com/chromedp/chromedp` is required at v0.16.0 in go.mod, but v0.21.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/chromedp/chromedp@v0.21.0 && go mod tidy` and commit the updated go.mod and go.sum.
Outdated: github.com/klauspost/compress — `github.com/klauspost/compress` is required at v1.20.1 in go.mod, but v1.20.3 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/klauspost/compress@v1.20.3 && go mod tidy` and commit the updated go.mod and go.sum.
Outdated: github.com/tiktoken-go/tokenizer — `github.com/tiktoken-go/tokenizer` is required at v0.8.1 in go.mod, but v0.10.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/tiktoken-go/tokenizer@v0.10.0 && go mod tidy` and commit the updated go.mod and go.sum.
Outdated: golang.org/x/net — `golang.org/x/net` is required at v0.60.0 in go.mod, but v0.61.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/net@v0.61.0 && go mod tidy` and commit the updated go.mod and go.sum.
Outdated: golang.org/x/sys — `golang.org/x/sys` is required at v0.48.0 in go.mod, but v0.49.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/sys@v0.49.0 && go mod tidy` and commit the updated go.mod and go.sum.
Outdated: modernc.org/sqlite — `modernc.org/sqlite` is required at v1.59.0 in go.mod, but v1.61.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get modernc.org/sqlite@v1.61.0 && go mod tidy` and commit the updated go.mod and go.sum.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 4 file(s) — `packages/middleware/typescript/src/ai-sdk.ts`, `packages/middleware/typescript/src/compatibility.ts`, `packages/shared/contracts/scripts/validate-continuous-improvement.mjs`, `proxy/internal/translate/jsonfast.go` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
Run 01a16e00-9cfd-7f7a-a502-2e4caa9d7ac4 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 33 · Warnings: 1828 · Recommendations: 126 · Info: 34 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 24-10-2026 @ 13:01 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.