Public report — SwarmAI, published 21 Sep 2026.
Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches,
dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase surveyMeasured under the Code Assurance Index · rubric rubric-2026.09.15 (frozen) · verify this surveyFiledcd_0b73263fe84f41fbbaf6766fdd8735e9
Filed 25 September 2026, 05:11 UTC
Public
Large · 268,829 LoC · rebuild ~3.4 person-years · weakest lens: Accessibility (49%)
Findings by grade
192 critical2137 serious41 minor38 could not be resolved — could be critical — see Limitations
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
21 September 2026, 18:22 UTC
A measurement, not a certificate. The Code Assurance Index does not certify,
approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The
standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said
here so the number is checked rather than believed.
Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸
2352findings with an exact file:lineof 2370 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
54/127dimensions across the health lenses268829 LoC — wide & deep
The system holds an adequate overall standing of 56%, indicating a workable asset carrying significant operational risk. While the architecture is robust, the platform’s large scale and weak accessibility compliance create a fragile foundation for future growth. This assessment reflects a system that functions but requires immediate attention to prevent escalating costs and compliance failures.
The platform is a substantial enterprise asset, comprising nearly 270,000 lines of production code with a rebuild cost estimated at €490,000. This represents a significant capital investment tied up in the current codebase. The composition suggests a mature, complex logic layer rather than simple boilerplate, meaning changes are non-trivial. Any remediation effort must be weighed against this high baseline value, as the cost of inaction compounds with every annual update cycle.
The most critical theme is Accessibility Debt, which poses a direct business and legal risk. With a score of 49%, this is the system’s weakest lens. For a platform of this size, poor accessibility is not just a technical flaw but a barrier to user adoption and a potential liability. The cost of ignoring this is substantial, as it drags down the efficiency of every change made to the codebase, effectively taxing the team’s velocity by up to 20% in affected areas.
A secondary theme is Operational Velocity Tax. The code quality signals indicate that modifications in weaker areas are significantly more expensive and time-consuming than in clean code. This creates a compounding drag on delivery speed. While the architecture is strong, the lack of standardized accessibility practices means that every new feature requires extra effort to ensure compliance, slowing down time-to-market and increasing long-term maintenance costs.
The system’s strength lies in its solid architectural foundation and high maturity, which provide a stable base for refactoring. The best leverage comes from addressing accessibility first. Implementing keyboard operability and proper labeling in custom controls will pay for itself within months by reducing the annual drag on development. This single action offers the highest return on investment, stabilizing the platform and freeing up engineering capacity for innovation rather than remediation.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
0.8× (at 56% quality) — the last 20% of quality is most of the work
Size & shape
Large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
Dead frontend code
~2942 LoC unreachable (12 file(s)) — that slice of this estimate buys code with zero runtime value; deleting it is the cheapest win in this report (the R7 card lists every file)
This codebase represents roughly ~3.4 person-years of build effort (about ~€490,000 to rebuild). Its weakest lens is Accessibility at 49% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 0.8× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
The top fix pays for itself · REDACTED · Economics
The top-ranked fix costs roughly 3–10 engineer-days once. Not doing it costs about 410.6–2463.7 engineer-days every year, paid as drag on the ~1,841,441 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 9–20% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 454,054 line(s) changed over a 90-day window ⇒ ~1,841,441/year · D1/D2/D4 code quality: averaging 4.4/10 ⇒ a 9–20% drag on each change · top-ranked remediation: REDACTED effort ⇒ about 3–10 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Value concentrated against a weak lens · REDACTED · Value at risk
This is a Large asset (~3.4 person-years to rebuild), and its weakest lens is Accessibility at 49%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Accessibility first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · REDACTED · Leverage
Of everything flagged, the best return on effort is: Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
A velocity tax on every change · REDACTED · Economics
The code-quality signals (complexity, duplication, cohesion) average 4.4/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 9–20% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 4.4/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency matrix
Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
504 modules, 311 dependencies. Every dependency points down the layering — no cycles.
Showing the 40 most-connected modules; 464 more are not drawn.
Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
backend.core.code_intel uses backend.core.code_intel.graph_store. Changing backend.core.code_intel.graph_store can break backend.core.code_intel, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→12 desktop.src.components.file-viewer.hooks.useFileViewerTabs depends on desktop.src.components.file-viewer.utils.fileViewTypes✕
Type pairs
1 distinct (type in desktop.src.components.file-viewer.hooks.useFileViewerTabs → type in desktop.src.components.file-viewer.utils.fileViewTypes) reference.
desktop.src.components.file-viewer.hooks.useFileViewerTabs uses desktop.src.components.file-viewer.utils.fileViewTypes. Changing desktop.src.components.file-viewer.utils.fileViewTypes can break desktop.src.components.file-viewer.hooks.useFileViewerTabs, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→20 desktop.src.components.file-viewer.hooks.useFileViewerTabs depends on desktop.src.types✕
Type pairs
1 distinct (type in desktop.src.components.file-viewer.hooks.useFileViewerTabs → type in desktop.src.types) reference.
desktop.src.components.file-viewer.hooks.useFileViewerTabs uses desktop.src.types. Changing desktop.src.types can break desktop.src.components.file-viewer.hooks.useFileViewerTabs, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
25→18 desktop.src.components.layout depends on desktop.src.services.ddd✕
Type pairs
3 distinct (type in desktop.src.components.layout → type in desktop.src.services.ddd) references.
desktop.src.components.layout uses desktop.src.services.ddd. Changing desktop.src.services.ddd can break desktop.src.components.layout, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
25→19 desktop.src.components.layout depends on desktop.src.services.jobs✕
Type pairs
1 distinct (type in desktop.src.components.layout → type in desktop.src.services.jobs) reference.
desktop.src.components.layout uses desktop.src.services.jobs. Changing desktop.src.services.jobs can break desktop.src.components.layout, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
25→21 desktop.src.components.layout depends on desktop.src.types.todo✕
Type pairs
2 distinct (type in desktop.src.components.layout → type in desktop.src.types.todo) references.
desktop.src.components.workspace-explorer.FileTreeNode uses desktop.src.types. Changing desktop.src.types can break desktop.src.components.workspace-explorer.FileTreeNode, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
28→20 desktop.src.pages.chat depends on desktop.src.types✕
Type pairs
2 distinct (type in desktop.src.pages.chat → type in desktop.src.types) references.
desktop.src.pages.chat.components.ContentBlockRenderer uses desktop.src.types. Changing desktop.src.types can break desktop.src.pages.chat.components.ContentBlockRenderer, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→20 desktop.src.services.system depends on desktop.src.types✕
Type pairs
1 distinct (type in desktop.src.services.system → type in desktop.src.types) reference.
desktop.src.components.common uses desktop.src.services.system. Changing desktop.src.services.system can break desktop.src.components.common, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→20 desktop.src.components.workspace-explorer depends on desktop.src.types✕
Type pairs
1 distinct (type in desktop.src.components.workspace-explorer → type in desktop.src.types) reference.
desktop.src.components.workspace-explorer uses desktop.src.types. Changing desktop.src.types can break desktop.src.components.workspace-explorer, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→27 desktop.src.components.workspace-explorer depends on desktop.src.components.workspace-explorer.FileTreeNode✕
Type pairs
1 distinct (type in desktop.src.components.workspace-explorer → type in desktop.src.components.workspace-explorer.FileTreeNode) reference.
desktop.src.components.workspace-explorer uses desktop.src.components.workspace-explorer.FileTreeNode. Changing desktop.src.components.workspace-explorer.FileTreeNode can break desktop.src.components.workspace-explorer, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→30 desktop.src.hooks.useUnifiedTabState depends on desktop.src.services.system✕
Type pairs
1 distinct (type in desktop.src.hooks.useUnifiedTabState → type in desktop.src.services.system) reference.
desktop.src.hooks.useUnifiedTabState uses desktop.src.services.system. Changing desktop.src.services.system can break desktop.src.hooks.useUnifiedTabState, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
36→20 desktop.src.pages depends on desktop.src.types✕
Type pairs
1 distinct (type in desktop.src.pages → type in desktop.src.types) reference.
desktop.src.pages uses desktop.src.pages.chat.components.ContentBlockRenderer. Changing desktop.src.pages.chat.components.ContentBlockRenderer can break desktop.src.pages, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→20 desktop.src.pages.chat.components depends on desktop.src.types✕
Type pairs
2 distinct (type in desktop.src.pages.chat.components → type in desktop.src.types) references.
desktop.src.pages.chat.components uses desktop.src.pages.chat.components.ContentBlockRenderer. Changing desktop.src.pages.chat.components.ContentBlockRenderer can break desktop.src.pages.chat.components, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→18 desktop.src.services depends on desktop.src.services.ddd✕
Type pairs
3 distinct (type in desktop.src.services → type in desktop.src.services.ddd) references.
desktop.src.services uses desktop.src.services.jobs. Changing desktop.src.services.jobs can break desktop.src.services, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
38→20 desktop.src.services depends on desktop.src.types✕
Type pairs
27 distinct (type in desktop.src.services → type in desktop.src.types) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
desktop.src.hooks.useChatStreamingLifecycle uses desktop.src.pages.chat.types. Changing desktop.src.pages.chat.types can break desktop.src.hooks.useChatStreamingLifecycle, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→35 desktop.src.hooks.useChatStreamingLifecycle depends on desktop.src.hooks.useUnifiedTabState✕
Type pairs
1 distinct (type in desktop.src.hooks.useChatStreamingLifecycle → type in desktop.src.hooks.useUnifiedTabState) reference.
desktop.src.hooks.useChatStreamingLifecycle uses desktop.src.hooks.useUnifiedTabState. Changing desktop.src.hooks.useUnifiedTabState can break desktop.src.hooks.useChatStreamingLifecycle, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→16 desktop.src.hooks depends on desktop.src.hooks.useVoiceConversation✕
Type pairs
2 distinct (type in desktop.src.hooks → type in desktop.src.hooks.useVoiceConversation) references.
desktop.src.hooks uses desktop.src.hooks.useVoiceConversation. Changing desktop.src.hooks.useVoiceConversation can break desktop.src.hooks, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→17 desktop.src.hooks depends on desktop.src.pages.chat.types✕
Type pairs
1 distinct (type in desktop.src.hooks → type in desktop.src.pages.chat.types) reference.
desktop.src.hooks uses desktop.src.hooks.useUnifiedTabState. Changing desktop.src.hooks.useUnifiedTabState can break desktop.src.hooks, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→39 desktop.src.hooks depends on desktop.src.hooks.useChatStreamingLifecycle✕
Type pairs
2 distinct (type in desktop.src.hooks → type in desktop.src.hooks.useChatStreamingLifecycle) references.
desktop.src.hooks uses desktop.src.hooks.useChatStreamingLifecycle. Changing desktop.src.hooks.useChatStreamingLifecycle can break desktop.src.hooks, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
At a glance — Code Health · 65% · Adequate · gated by D1, D2 ·
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
A03:2021 — Injection
105
REDACTED / Critical
A06:2021 — Vulnerable & Outdated Components
25
REDACTED / Critical
A02:2021 — Cryptographic Failures
5
REDACTED / Critical
Roadmap
First, fix keyboard navigation by ensuring custom controls are operable and anchors have valid links, while simultaneously adding programmatic labels to all forms and buttons. Next, implement comprehensive accessibility enforcement in the development toolchain and CI pipeline to catch issues early. Finally, improve page structure by declaring language and main landmarks, and provide accurate text alternatives for all media elements.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
5 of the 44 unreached modules are entry points — the browser loads some as a top-level script and something else executes the rest by path, so no import specifier addresses them and no public entry publishes them. An importing test cannot be written for them as they ship, and two different things are worth doing here — they are not the same thing. To EXERCISE them, a browser or end-to-end suite that loads the page, or a test that runs the script the way its caller does; that is worth having, but it will NOT clear this row, because reachability is measured over the import graph and running a file by path adds no edge to it. To CLEAR it, make them addressable: lift the logic into a module a test can import and leave the entry points thin shims over it, or put their bodies behind a main-guard (`import.meta.url === argv[1]`) and export them. Add tests that import the other 39 — directly or through their public entry.
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 — 192
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 — 2137
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 — 41
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 38
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. 49 of 54 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 — 54 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, 2352 of 2370 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.
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,618 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 566 test source file(s) (.py) that it cannot: it reads the test types the frontend declared, so a suite in any other language 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 (vitest via `npm ci --ignore-scripts` in desktop/ (2928 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 package.json, but the licence verdict published here was taken over its crate 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.
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 Python pyproject.toml/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Python 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-contributor repository — bus factor is not applicable (1 contributor(s) across 4008 commit(s) sampled, automation and bot accounts excluded). Concentration needs a team to concentrate: with one contributor there is nobody to spread the knowledge to, so there is nothing here for the owner to act on.
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. `desktop/src/pages/EvalDashboard.tsx`, `desktop/src/types/index.ts` 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.
AC2 Forms & labels — 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. 91 further occurrence(s) are not listed individually; the score already reflects all 131.
AC4 Keyboard semantics — 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. 7 further occurrence(s) are not listed individually; the score already reflects all 47.
AX3 Project dependency cycles — 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 is computed over which project references which — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
AX4 Dependency direction — 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 is computed over the direction each project reference points — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
AX6 Interface segregation — 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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing 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.
AX8 Test isolation — 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 is computed over which projects are test projects, and what they reference — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
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.
ED5 Idempotency — 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 finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
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. 110 further occurrence(s) are not listed individually; the score already reflects all 150.
R4 Test Coverage — 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. 4 further occurrence(s) are not listed individually; the score already reflects all 44.
R7 Dead Code — 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. 34 further occurrence(s) are not listed individually; the score already reflects all 74.
X1 Async correctness — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X12 Unreachable branch — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X13 Undrained process stream — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X14 Bypassable address classification — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X15 Unvalidated length from an untrusted reader — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X16 Unfloored truncation loop — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X17 Uncapped recursion over a caller-supplied document — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X18 Disposal-pattern correctness — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X19 Unrestored process-global state — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X2 Cancellation propagation — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X20 Mistyped argument guard — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X21 Side-effecting pattern guard — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X22 Contradicted release guard — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X23 Unguarded diagnostic materialisation — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X24 Document value interpolated into markup unescaped — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X25 Inert configuration knob — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X26 Unsynchronised callback handoff — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X27 Collection changed while being enumerated — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X28 Index access outside its own emptiness guard — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X29 Per-element action decided by a fixed element — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X3 Exception handling — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X30 Support guard that admits what it rejects — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X32 Type resolved by simple name across every loaded assembly — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X4 Structured logging — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
X5 Nullable reference types — 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
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.
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 REDACTED Scanning: REDACTED 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.
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.
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.
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 Dockerfile (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.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
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.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
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.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
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.
450 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was useChatStreamingLifecycle.useChatStreamingLifecycle at 587. A further 6 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 fileUtils.fileIcon at 40 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: desktop/src/utils/fileUtils.ts (fileUtils.fileIcon at 40). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 421 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 3 locked_write.locked_field_modify (cyclomatic 16) finding(s) in Cyclomatic Complexity — start with locked_write.py (3). — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 ai_ready_helpers.extract_import_graph (cyclomatic 40) finding(s) in Cyclomatic Complexity — start with ai_ready_helpers.py (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 swarmai finding(s) in Cyclomatic Complexity — start with lib.rs (2). — One of this dimension's main actionable groups (2 warning-level).
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.
+ 723 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 7 swarmai finding(s) in Cognitive Complexity — start with lib.rs (6), screen_capture.rs. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 3 locked_write.locked_field_modify (cognitive 28) finding(s) in Cognitive Complexity — start with locked_write.py (3). — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 ai_ready_helpers.extract_import_graph (cognitive 86) finding(s) in Cognitive Complexity — start with ai_ready_helpers.py (2). — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.8 / 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.
Resolve the 75 FunctionTooLong finding(s) in God Classes — start with EvalDashboard.tsx (6), SkillsPage.tsx (2), browser-agent.mjs (2). — One of this dimension's main actionable groups (75 warning-level).
Resolve the 70 FileTooLong finding(s) in God Classes — start with ai_ready_helpers.py (2), base.py (2), artifact_cli.py. — One of this dimension's main actionable groups (70 warning-level).
Resolve the 10 TooManyMethods finding(s) in God Classes — start with session_unit.py, eval_service.py, context_health_hook.py. — 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.
381 duplicated block group(s) detected. A further 15 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 2 of the 396 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population. Measured on part of this repository only: .tsx (19% 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.
+ 189 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 25 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with ai_ready_helpers.py (6), artifact_cli.py (2), ddd_health.py. — One of this dimension's main actionable groups (25 warning-level).
Resolve the 20 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with graph_store.py (2), sqlite.py (2), REDACTED (2). — One of this dimension's main actionable groups (20 warning-level).
Resolve the 16 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with ai_ready_helpers.py (3), artifact_cli.py (2), conversation_extract.py. — One of this dimension's main actionable groups (16 warning-level).
Detailed fixes: d4_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 1 mechanizable ADR(s) are enforced: 1 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.9 / 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.
13228 test methods: 13081 unit, 27 integration, 0 BDD, 120 e2e. The JavaScript/TypeScript suite contributes 2626 `it`/`test` case(s) across 237 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 30 `#[test]` function(s) across 3 file(s) declaring at least one; its unit/integration split is Cargo's own — 0 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 10572 test function(s) across 556 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.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ 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.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2618 tests. Measured on the suite only — at least 566 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.
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.
2 outdated, 0 yanked direct Cargo dependencies. Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from Cargo.lock there.
Outdated: tauri · ×2
✓ On the Gold path — maintain.
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 694 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's Cargo.lock closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json and a Python pyproject.toml/requirements.txt (pip/uv/Poetry), 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: desktop/src/hooks/useChatStreamingLifecycle.ts (107×308=32956); backend/scripts/artifact_cli.py (80×177=14160); backend/core/streaming_orchestrator.py (48×190=9120) Repeated repair below the complexity floor: desktop/src/hooks/useUnifiedTabState.ts (16 of 24 changes were fixes); desktop/src/components/common/Modal.tsx (13 of 18 changes were fixes); backend/routers/cultivation.py (7 of 13 changes were fixes)
Resolve the 154 Hotspot finding(s) in Churn × Complexity Hotspots — start with ai_ready_helpers.py (2), locked_write.py (2), REDACTED (2). — One of this dimension's main actionable groups (154 warning-level).
Resolve the 21 Repeated repair finding(s) in Churn × Complexity Hotspots — start with useUnifiedTabState.ts, Modal.tsx, cultivation.py. — One of this dimension's main actionable groups (21 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.
29 deducted task-comment markers across 268829 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.
Resolve the 28 TodoComment finding(s) in Explicit Debt — start with ChatPage.tsx (3), gate_scaffold.py (2), REDACTED (2). — One of this dimension's main actionable groups (28 warning-level).
Resolve the 1 HackComment finding(s) in Explicit Debt — start with NewBrainOverlay.interaction.test.tsx. — One of this dimension's main actionable groups (1 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
SwarmAI's documentation is clear and complete for an enterprise project: the README (1k words) introduces the self-evolving brain-first Agent OS with a compelling value proposition ('value compounds') and dives into Why an Agent OS and The Four Ideas. A dedicated 'Technical Documentation' set covers architecture, self-evolution harness, memory management, and post-mortem failure-learnings documents (3 doc set), plus a desktop README that shows how to run the Tauri frontend from the project root and a backend README with setup, environment variables, API docs, and a detailed release scope gate. The post-mortems are especially strong: they follow a consistent structure ('What happened', 'Why it happened', 'Structural prevention', 'The generalizable insight'), explain how each correction compounds into a structural fix, and show the same pattern across every release (e.g., pipeline confidence illusion → adversarial review gate). There is no visible gap in the outline despite the high volume of documents. The documentation is comprehensive and well-structured: the README files plus architecture/design docs (125) cover every skill in depth, with a clear user guide that includes prerequisites, installation, first-launch, configuration, getting started, core features, file attachments, channel integration, keyboard shortcuts, troubleshooting, and an exhaustive 9-stage self-evolution pipeline. The thesis document is the longest single entry but still fully outlines the compound-effect model, seven design convictions, and a six-layer architecture with all its numbered sections present. All documents are well-organized by heading (or TOC) and cover installation, usage, troubleshooting, and contributor guidance. This project is a well-organized suite of documentation covering the SwarmAI OS Eval Function with an architecture/Docs set of 125 markdown files (OS-Eval-Function-Design.md, Memory-Management-Design.md, Goal-Loop-Design.md, DDD-Platform-Overview.md, DDD-Cultivation-Engine-HLD.md, and CONVERGENCE.md), plus a standalone CODEBASE_METRICS.md. The documentation reflects the shipped system with a strong source-of-truth map (§1) and is structured around an architecture outline that lists every visible section present in each document — no missing sections to flag.
Documentation: no installation or build instructions · ×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 ConsistencyExemplary◐ 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.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED 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 REDACTED. 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.
4 finding(s): 0 critical, 4 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 4 REDACTED finding(s) in Secrets (history) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
105 finding(s): 0 critical, 88 high, 14 medium, 3 low. 68 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 15 file(s) — `backend/channels/swarmai_backend.sh` (line 110), `backend/channels/swarmai_guardian.sh` (line 104), `backend/skills/s_pollinate/channels/bilibili.yaml`, `backend/skills/s_pollinate/channels/xiaohongshu.yaml`, `backend/skills/s_pollinate/templates/html-deck/shared/export-pdf.sh` (line 131), … (+10 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 3 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
What to do
Resolve the 20 REDACTED finding(s) charged to Static Analysis (SAST) — the other 68 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (88 issue-level, 20 of them charged here).
Resolve the 14 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED, REDACTED. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 recommendation-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/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, Go, Java and Kotlin via Maven/Gradle, 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 17 REDACTED CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (17). — One of this dimension's main actionable groups (17 issue-level).
Resolve the 6 REDACTED CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 warning-level).
Resolve the 1 REDACTED vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d30_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.
Every significant source file has living knowledge — recently and meaningfully worked. Counted over 655 of the 780 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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.
Resolve the 3 Change coupling finding(s) in Change Coupling — start with ThreeColumnLayout.tsx, community_api.py, useCanvasAutoSurface.ts. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
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 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 0 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 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.
AC1 · Text alternatives5.7 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). — desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:58
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels5.0 / 10Weak✓ Tool-verified
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.
This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×5) — desktop/public/brain-hub-demo.html:408, desktop/public/brain-hub-demo.html:409, desktop/public/brain-hub-demo.html:410, …
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×2) — desktop/public/brain-hub-demo.html:408, desktop/public/brain-hub-demo.html:409
This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×9) — desktop/src/components/common/AgentFormModal.tsx:213, desktop/src/components/common/AgentFormModal.tsx:237, desktop/src/components/common/AgentFormModal.tsx:249, …
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. (×14) — desktop/src/components/common/AgentFormModal.tsx:214, desktop/src/components/common/AgentFormModal.tsx:238, desktop/src/components/common/AgentFormModal.tsx:250, …
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×5) — desktop/src/components/common/AgentFormModal.tsx:265, desktop/src/components/common/AgentFormModal.tsx:288, desktop/src/components/common/AgentFormModal.tsx:351, …
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×4) — desktop/src/components/common/FileEditorCore.tsx:1853, REDACTED:870, desktop/src/components/layout/BrainHub.tsx:233, …
This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label. — REDACTED:215
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
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.
A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>. — assets/SwarmAI-Architecture-Design-Doc.html:2
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×6) — assets/SwarmAI-Architecture-Design-Doc.html:2, backend/skills/s_html-artifact/templates/code-review.html:2, backend/skills/s_html-artifact/templates/comparison.html:2, …
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — assets/SwarmAI-Architecture-Design-Doc.html:2896
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). (×2) — desktop/src/components/layout/BottomBar.tsx:41, desktop/src/pages/EvalDashboard.tsx:624
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 interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: interactive elements plus elements the markup gives a click/key handler or the repo's own CSS styles `cursor: pointer`, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. (×25) — desktop/public/brain-hub-demo.html:270, desktop/public/brain-hub-demo.html:278, desktop/public/brain-hub-demo.html:287, …
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×12) — desktop/src/components/chat/VoiceConversationIndicator.tsx:69, desktop/src/components/common/Dropdown.tsx:73, desktop/src/components/common/Dropdown.tsx:142, …
A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}. — REDACTED:215
This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabIndex={0} in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabIndex={0}="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it. — desktop/src/components/common/ReviewModeGutter.tsx:122
This <span> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control. — desktop/src/components/file-viewer/FileViewerTabBar.tsx:93
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
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.
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 (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 186 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 eslint-plugin-jsx-a11y, then assert with vitest-axe 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 read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
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
Add a 'Testing' section to the root README — how to run the test suite.
Add a README to the 3 of 5 project(s) that lack one — worth up to 1.2 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 — `backend/skills/s_narrative-writing/reference/templates/adr.md`, `backend/skills/s_project-manager/SKILL.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 repo is organised deliberately — src/test separation and consistent project naming.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
What to do
Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
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.
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.
No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 38191 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
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 & Backup4.0 / 10Weak✓ 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 releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
Do you agree with this assessment?
R1 · Type Safety9.9 / 10Exemplary✓ 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.
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.
34 duplicated blocks under desktop/src/ have copies in at least two of the sibling directories components, contexts, hooks, pages, stores, utils — 9 of them are reported below, and 25 are 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 34 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 34 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 34 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. — desktop/src/components/settings/BackupTab.tsx:22
25 duplicated blocks under desktop/src/components/ have copies in at least two of the sibling directories common, file-viewer, layout, modals, settings, workspace (+2 more sibling(s) not listed) — 9 of them are reported below, and 16 are 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 25 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 25 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 25 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. — desktop/src/components/common/Modal.tsx:58
desktop/src/components/common/Dropdown.tsx:31 · desktop/src/components/common/MultiSelect.tsx:36 — the two spans are one implementation copied and then locally edited — 645 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. — desktop/src/components/common/Dropdown.tsx:31
desktop/src/components/settings/BackupTab.tsx:22 · desktop/src/pages/OnboardingPage.tsx:355 — the two spans are one implementation copied and then locally edited — 413 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. — desktop/src/components/settings/BackupTab.tsx:22
desktop/src/components/workspace/FileBrowser.tsx:159 · desktop/src/components/workspace/FolderPickerModal.tsx:164 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/components/workspace/FileBrowser.tsx:159
desktop/src/components/layout/HiveFleetOverlay.tsx:90 · desktop/src/components/layout/JobsRunsOverlay.tsx:142 — the two spans are one implementation copied and then locally edited — 396 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. — desktop/src/components/layout/HiveFleetOverlay.tsx:90
desktop/src/components/layout/PipelineOverlay.tsx:91 · desktop/src/components/layout/PollinateOverlay.tsx:109 — the two spans are one implementation copied and then locally edited — 407 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. — desktop/src/components/layout/PipelineOverlay.tsx:91
desktop/src/components/layout/ThreeColumnLayout.tsx:393 · desktop/src/components/layout/ThreeColumnLayout.tsx:466 — the two spans are one implementation copied and then locally edited — 330 tokens are still identical, in the same order in both spans, 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. — desktop/src/components/layout/ThreeColumnLayout.tsx:393
desktop/src/services/agents.ts:18 · desktop/src/services/channels.ts:64 — the two spans are one implementation copied and then locally edited — 401 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. — desktop/src/services/agents.ts:18
desktop/src/components/common/CommentPopover.tsx:107 · desktop/src/components/common/FileEditorCore.tsx:270 — the two spans are one implementation copied and then locally edited — 198 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. — desktop/src/components/common/CommentPopover.tsx:107
desktop/src/services/tasks.ts:18 · desktop/src/services/todos.ts:31 — the two spans are one implementation copied and then locally edited — 345 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. — desktop/src/services/tasks.ts:18
desktop/src/hooks/useChatStreamingLifecycle.ts:2017 · desktop/src/hooks/useStreamingActivity.ts:42 — 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. — desktop/src/hooks/useChatStreamingLifecycle.ts:2017
desktop/src/components/common/Modal.tsx:58 · desktop/src/components/layout/OverlayHost.tsx:100 — the two spans are one implementation copied and then locally edited — 253 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. — desktop/src/components/common/Modal.tsx:58
desktop/src/pages/chat/components/ChatInput.tsx:809 · desktop/src/pages/chat/components/ChatInput.tsx:849 — 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. — desktop/src/pages/chat/components/ChatInput.tsx:809
desktop/src/components/layout/CMBrainOverlay.tsx:1141 · desktop/src/components/layout/LibraryOverlay.tsx:520 — the two spans are one implementation copied and then locally edited — 193 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. — desktop/src/components/layout/CMBrainOverlay.tsx:1141
desktop/src/pages/SkillsPage.tsx:469 · desktop/src/pages/SkillsPage.tsx:579 · desktop/src/pages/SkillsPage.tsx:743 — 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. — desktop/src/pages/SkillsPage.tsx:469
desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:14 · desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:14 — 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. — desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:14
backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10 · backend/skills/s_pollinate/templates/remotion/components/ShortIntroCard.tsx: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. — backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10
desktop/src/hooks/useChatStreamingLifecycle.ts:546 · desktop/src/hooks/useChatStreamingLifecycle.ts:577 — 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. — desktop/src/hooks/useChatStreamingLifecycle.ts:546
desktop/src/pages/SkillsPage.tsx:946 · desktop/src/pages/SkillsPage.tsx:975 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/pages/SkillsPage.tsx:946
desktop/src/pages/chat/components/TSCCPanel.tsx:125 · desktop/src/pages/chat/components/TSCCPanel.tsx:202 — 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. — desktop/src/pages/chat/components/TSCCPanel.tsx:125
backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293 · backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx:30 — 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. — backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293
desktop/src/components/common/AgentFormModal.tsx:256 · desktop/src/components/common/AgentFormModal.tsx:279 — 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. — desktop/src/components/common/AgentFormModal.tsx:256
desktop/src/components/layout/JobsRunsOverlay.tsx:189 · desktop/src/components/layout/ToDoOverlay.tsx:749 — 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. — desktop/src/components/layout/JobsRunsOverlay.tsx:189
desktop/src/hooks/useHealthMonitor.ts:371 · desktop/src/hooks/useHealthMonitor.ts:479 — 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. — desktop/src/hooks/useHealthMonitor.ts:371
desktop/src/components/settings/SettingsTabs.tsx:82 · desktop/src/pages/EvalDashboard.tsx:253 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/components/settings/SettingsTabs.tsx:82
desktop/src/components/common/BackendStartupOverlay.tsx:408 · desktop/src/components/common/BackendStartupOverlay.tsx:460 — the two spans are one implementation copied and then locally edited — 104 tokens are still identical, in the same order in both spans, 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. — desktop/src/components/common/BackendStartupOverlay.tsx:408
backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135 · backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:166 — 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. — backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135
desktop/src/components/common/FileEditorCore.tsx:1380 · desktop/src/components/common/FileEditorCore.tsx:1399 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — desktop/src/components/common/FileEditorCore.tsx:1380
desktop/src/components/chat/FileAttachmentButton.tsx:64 · desktop/src/components/chat/ScreenshotButton.tsx:71 — 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. — desktop/src/components/chat/FileAttachmentButton.tsx:64
desktop/src/hooks/useChatStreamingLifecycle.ts:483 · desktop/src/hooks/useChatStreamingLifecycle.ts:504 — 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. — desktop/src/hooks/useChatStreamingLifecycle.ts:483
desktop/src/services/tscc.ts:133 · desktop/src/services/tscc.ts:169 — 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. — desktop/src/services/tscc.ts:133
backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134 · backend/skills/s_pollinate/templates/remotion/components/animations.tsx: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. — backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134
desktop/src/components/common/FileEditorCore.tsx:1644 · desktop/src/components/common/FileEditorCore.tsx:1674 — 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. — desktop/src/components/common/FileEditorCore.tsx:1644
desktop/src/components/layout/CMBrainOverlay.tsx:899 · desktop/src/components/layout/CMBrainOverlay.tsx:939 — 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. — desktop/src/components/layout/CMBrainOverlay.tsx:899
backend/skills/s_pollinate/templates/remotion/Video.tsx:118 · backend/skills/s_pollinate/templates/remotion/Video.tsx:258 — all 2 copies are in the same file, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents. — backend/skills/s_pollinate/templates/remotion/Video.tsx:118
desktop/src/hooks/streaming-machine.ts:134 · desktop/src/hooks/streaming-machine.ts:241 — 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. — desktop/src/hooks/streaming-machine.ts:134
desktop/src/hooks/useUnifiedAttachments.ts:167 · desktop/src/hooks/useUnifiedAttachments.ts:301 — 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. — desktop/src/hooks/useUnifiedAttachments.ts:167
backend/skills/s_pollinate/templates/remotion/Video.tsx:152 · backend/skills/s_pollinate/templates/remotion/Video.tsx:202 — 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. — backend/skills/s_pollinate/templates/remotion/Video.tsx:152
desktop/src/components/layout/CMBrainOverlay.tsx:328 · desktop/src/components/layout/CMBrainOverlay.tsx:1004 — 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. — desktop/src/components/layout/CMBrainOverlay.tsx:328
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 · 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.
(anonymous) has cyclomatic complexity 308 and cognitive complexity 576; 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. — desktop/src/hooks/useChatStreamingLifecycle.ts:2302
FileEditorCore has cyclomatic complexity 96 and cognitive complexity 83; 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. — desktop/src/components/common/FileEditorCore.tsx:606
main has cyclomatic complexity 93 and cognitive complexity 115; 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. — backend/skills/s_browser-agent/browser-agent.mjs:304
(anonymous) has cyclomatic complexity 76 and cognitive complexity 128; 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. — backend/skills/s_pptx/scripts/html2pptx.js:534
reconcile has cyclomatic complexity 69 and cognitive complexity 138; 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. — desktop/src/hooks/useChatStreamingLifecycle.ts:1235
(anonymous) has cyclomatic complexity 60 and cognitive complexity 90; 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. — desktop/src/pages/ChatPage.tsx:2156
ChatInput has cyclomatic complexity 57 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. — desktop/src/pages/chat/components/ChatInput.tsx:164
streamingReducer has cyclomatic complexity 53 and cognitive complexity 35; 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. — desktop/src/hooks/streaming-machine.ts:110
(anonymous) has cyclomatic complexity 50 and cognitive complexity 52; 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. — desktop/src/hooks/useChatStreamingLifecycle.ts:3756
AssistantMessageView has cyclomatic complexity 48 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. — desktop/src/pages/chat/components/AssistantMessageView.tsx:77
(anonymous) has cyclomatic complexity 44 and cognitive complexity 93; 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. — desktop/src/hooks/useChatStreamingLifecycle.ts:372
flattenTree has cyclomatic complexity 42 and cognitive complexity 50; 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. — desktop/src/components/workspace-explorer/VirtualizedTree.tsx:255
compress has cyclomatic complexity 40 and cognitive complexity 54; 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. — backend/skills/s_browser-agent/browser-agent.mjs:199
EngineMetricsTab has cyclomatic complexity 40 and cognitive complexity 39; 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. — desktop/src/components/settings/EngineMetricsTab.tsx:54
fetchFileContent has cyclomatic complexity 39 and cognitive complexity 66; 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. — desktop/src/components/file-viewer/FileViewer.tsx:262
FileViewerPanelImpl has cyclomatic complexity 38 and cognitive complexity 37; 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. — desktop/src/components/file-viewer/FileViewerPanel.tsx:139
(anonymous) has cyclomatic complexity 34 and cognitive complexity 56; 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. — backend/skills/s_pptx/scripts/html2pptx.js:422
step has cyclomatic complexity 34 and cognitive complexity 45; 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. — desktop/vite.config.js:14
(anonymous) has cyclomatic complexity 33 and cognitive complexity 49; 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. — desktop/src/pages/ChatPage.tsx:940
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files4.0 / 10Weak✓ 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.
45 file(s) over 400 lines (counted as significant lines — blank lines excluded — over production source only, tests excluded), largest first: desktop/src/hooks/useChatStreamingLifecycle.ts (4285), desktop/src/pages/ChatPage.tsx (3303), desktop/src/pages/EvalDashboard.tsx (2359), desktop/src/components/common/FileEditorCore.tsx (1915), desktop/src/components/layout/BrainHub.tsx (1329), desktop/src/stores/MessageStore.ts (1226) (+39 more).
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 Coverage8.4 / 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.
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. (×40) — desktop/src/pages/SkillsPage.tsx, backend/skills/s_pptx/scripts/html2pptx.js, backend/skills/s_browser-agent/browser-agent.mjs, …
What to do
5 of the 44 unreached modules are entry points — the browser loads some as a top-level script and something else executes the rest by path, so no import specifier addresses them and no public entry publishes them. An importing test cannot be written for them as they ship, and two different things are worth doing here — they are not the same thing. To EXERCISE them, a browser or end-to-end suite that loads the page, or a test that runs the script the way its caller does; that is worth having, but it will NOT clear this row, because reachability is measured over the import graph and running a file by path adds no edge to it. To CLEAR it, make them addressable: lift the logic into a module a test can import and leave the entry points thin shims over it, or put their bodies behind a main-guard (`import.meta.url === argv[1]`) and export them. Add tests that import the other 39 — 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.
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 package.json 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: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code7.1 / 10Strong✓ 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.
32 file(s) (~4159 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: backend/skills/s_pollinate/templates/remotion/Root.tsx imports './ShortVideo', 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. — backend/skills/s_pollinate/templates/remotion
Unreachable from the 60 application, 13 tooling and 253 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (60 application, 13 tooling, 253 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (desktop/src/components/settings/SkillsTab.tsx) — 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 — desktop/src/pages/SkillsPage.tsx
no import path from any entry point (60 application, 13 tooling, 253 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 (×11) — backend/skills/s_pptx/scripts/html2pptx.js, desktop/src/components/workspace/FolderPickerModal.tsx, desktop/src/components/workspace/FileBrowser.tsx, …
Nothing imports this binding — it is safe to review for removal. (×2) — backend/skills/s_pollinate/templates/remotion/Thumbnail.tsx:105, backend/skills/s_pollinate/templates/remotion/Video.tsx:360
Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists. (×24) — backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx:19, backend/skills/s_pollinate/templates/remotion/components/CodeBlock.tsx:5, backend/skills/s_pollinate/templates/remotion/components/ComparisonCard.tsx:5, …
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.
Declared in desktop/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×2)
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 · Security — Only what this repository's own non-C# files could be read for was assessed — and because this repository commits the configuration that serves its own HTTP surface, that configuration could be read in full for the security response headers it sets. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.
No Content-Security-Policy / X-Frame-Options / X-Content-Type-Options configuration found — defense in depth, even when a reverse proxy could set them. This is reported because `Caddyfile` is committed to this repository and declares the server that serves it, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.) — hive/Caddyfile:19
What to do
Set security response headers on the surface this repository serves: an `add_header` directive per header in the nginx/Caddy/Apache config, a `_headers` / `vercel.json` / `netlify.toml` entry for a static host, or `helmet()` in the HTTP server. `Content-Security-Policy` is the one that pays for itself first — it is what contains an injected script once one reaches the page — followed by `X-Content-Type-Options: nosniff` and a frame policy (`X-Frame-Options: DENY`, or CSP `frame-ancestors`). Where the app is served from a build container, the header configuration belongs in the image beside the built assets, so it ships with them rather than depending on where it lands.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 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.
Capped at Fair by a Critical contributor — resolve it before relying on this lens.
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 — 70 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.
AX1 Captive dependencies — no DI registrations detected
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph 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
AX4 Dependency direction — not assessed — project cycles and dependency direction are computed over a project-reference graph 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
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface 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 — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) 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
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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-contributor 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 — Production source is present (.py, .rs, .ts, .tsx) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. 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.
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — symbol resolution incomplete — navigability not assessed
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 2 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.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a CS/VB/GO/SCALA/SWIFT/DART class graph, and this repository's production source is .py, .rs, .ts, .tsx, which this pass does not read — so no class could be assessed. Not scored — this is a gap in the analyzer, not a finding about this repository.
D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — desktop/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (338 value object(s))
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. 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'.
P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
P8 Schema migrations — not assessed — schema-migration practice is read from 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
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) 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, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF2 Allocation hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF3 Async & latency hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X1 Async correctness — 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
X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X2 Cancellation propagation — 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
X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X3 Exception handling — 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
X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X4 Structured logging — 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
X5 Nullable reference types — 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
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×30
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:270— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:278— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:287— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:308— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:309— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:312— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:313— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:314— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:315— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:316— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:322— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:323— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:324— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:327— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:330— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:331— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:423— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:424— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:425— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:426— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/public/brain-hub-demo.html:427— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> desktop/src/components/chat/VoiceConversationIndicator.tsx:69— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> desktop/src/components/common/Dropdown.tsx:73— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> desktop/src/components/common/Dropdown.tsx:142— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> REDACTED:215— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
AC2 · Forms & labels· <label> that labels no control · ×14
<label> that labels no control desktop/public/brain-hub-demo.html:408— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/public/brain-hub-demo.html:409— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/public/brain-hub-demo.html:410— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/public/brain-hub-demo.html:420— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/public/brain-hub-demo.html:430— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/AgentFormModal.tsx:213— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/AgentFormModal.tsx:237— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/AgentFormModal.tsx:249— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/AgentFormModal.tsx:262— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/AgentFormModal.tsx:285— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/AgentFormModal.tsx:344— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/Dropdown.tsx:70— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/MultiSelect.tsx:91— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control desktop/src/components/common/ToolSelector.tsx:161— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC2 · Forms & labels· <input> without a programmatic label · ×14
<input> without a programmatic label desktop/public/brain-hub-demo.html:408— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/public/brain-hub-demo.html:409— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/common/AgentFormModal.tsx:214— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/common/AgentFormModal.tsx:238— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/common/AskUserQuestion.tsx:241— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/common/Dropdown.tsx:115— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/common/FileEditorCore.tsx:562— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label REDACTED:870— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label desktop/src/components/common/MultiSelect.tsx:150— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/common/SearchBar.tsx:21— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/layout/BrainHub.tsx:348— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/layout/CMBrainOverlay.tsx:808— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/layout/CommunityOverlay.tsx:591— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label desktop/src/components/layout/CommunityOverlay.tsx:656— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
AC2 · Forms & labels· <button> with no accessible text · ×5
<button> with no accessible text desktop/src/components/common/AgentFormModal.tsx:265— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text desktop/src/components/common/AgentFormModal.tsx:288— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text desktop/src/components/common/AgentFormModal.tsx:351— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text desktop/src/components/common/ToolSelector.tsx:193— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text desktop/src/components/common/ToolSelector.tsx:241— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels· <textarea> without a programmatic label · ×4
<textarea> without a programmatic label desktop/src/components/common/AgentFormModal.tsx:250— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label desktop/src/components/common/CommentPopover.tsx:143— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label desktop/src/components/common/FileEditorCore.tsx:317— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label desktop/src/components/common/FileEditorCore.tsx:1853— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics· Click handler on a non-interactive <span> · ×4
Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:398— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:432— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:433— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <span> desktop/public/brain-hub-demo.html:434— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC2 · Forms & labels· <select> without a programmatic label · ×2
<select> without a programmatic label desktop/src/components/layout/BrainHub.tsx:233— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label desktop/src/components/layout/CommunityOverlay.tsx:453— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics· Click handler on a non-interactive <th> · ×2
Click handler on a non-interactive <th> desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:286— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <th> desktop/src/components/layout/ToDoOverlay.tsx:585— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC2 · Forms & labels· Custom control with no accessible name on <div> · ×1
Custom control with no accessible name on <div> REDACTED:215— This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
AC3 · Page structure· Document without a <title> · ×1
Document without a <title> assets/SwarmAI-Architecture-Design-Doc.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>.
AC4 · Keyboard semantics· Clickable role="button" that no keyboard user can reach · ×1
Clickable role="button" that no keyboard user can reach desktop/src/components/common/ReviewModeGutter.tsx:122— This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabIndex={0} in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabIndex={0}="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it.
AC4 · Keyboard semantics· Click handler on a non-interactive <li> · ×1
Click handler on a non-interactive <li> desktop/src/components/file-viewer/CanvasOutputRail.tsx:156— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC4 · Keyboard semantics· Click handler on a <span> nested inside <button> · ×1
Click handler on a <span> nested inside <button> desktop/src/components/file-viewer/FileViewerTabBar.tsx:93— This <span> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control.
AC4 · Keyboard semantics· Click handler on a non-interactive <tr> · ×1
Click handler on a non-interactive <tr> desktop/src/components/layout/ToDoOverlay.tsx:619— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Hotspot: desktop/src/hooks/useChatStreamingLifecycle.ts desktop/src/hooks/useChatStreamingLifecycle.ts:2302— desktop/src/hooks/useChatStreamingLifecycle.ts changed 107 times in last 90 days, max cyclomatic complexity 308 in (anonymous) at line 2302. 70 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/hooks/useChatStreamingLifecycle.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: backend/scripts/artifact_cli.py backend/scripts/artifact_cli.py:3992— backend/scripts/artifact_cli.py changed 80 times in last 90 days, max cyclomatic complexity 177 in artifact_cli.cmd_run_report at line 3992. 51 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/scripts/artifact_cli.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: backend/core/streaming_orchestrator.py backend/core/streaming_orchestrator.py:525— backend/core/streaming_orchestrator.py changed 48 times in last 90 days, max cyclomatic complexity 190 in StreamingOrchestrator._read_formatted_response at line 525. 22 of those changes were fix/bug commits, and the other 26 changed it for other reasons — this file is under both repair and feature pressure. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/streaming_orchestrator.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: backend/scripts/pipeline_validator.py backend/scripts/pipeline_validator.py:2603— backend/scripts/pipeline_validator.py changed 41 times in last 90 days, max cyclomatic complexity 214 in pipeline_validator.validate at line 2603. 19 of those changes were fix/bug commits, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/scripts/pipeline_validator.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: backend/core/session_router.py backend/core/session_router.py:2782— backend/core/session_router.py changed 81 times in last 90 days, max cyclomatic complexity 90 in SessionRouter.run_conversation at line 2782. 44 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/session_router.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: backend/core/session_unit.py backend/core/session_unit.py:1867— backend/core/session_unit.py changed 105 times in last 90 days, max cyclomatic complexity 65 in SessionUnit.send at line 1867. 55 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/session_unit.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: desktop/src/pages/ChatPage.tsx desktop/src/pages/ChatPage.tsx:2156— desktop/src/pages/ChatPage.tsx changed 94 times in last 90 days, max cyclomatic complexity 60 in (anonymous) at line 2156. 56 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/pages/ChatPage.tsx`: 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: backend/scripts/eval_runner.py backend/scripts/eval_runner.py:2163— backend/scripts/eval_runner.py changed 43 times in last 90 days, max cyclomatic complexity 86 in eval_runner.generate_html_report at line 2163. 18 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/scripts/eval_runner.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: backend/hooks/context_health_hook.py backend/hooks/context_health_hook.py:1163— backend/hooks/context_health_hook.py changed 84 times in last 90 days, max cyclomatic complexity 35 in ContextHealthHook._auto_cultivate_session_signals at line 1163. 40 of those changes were fix/bug commits, and the other 44 changed it for other reasons — this file is under both repair and feature pressure. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/hooks/context_health_hook.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: REDACTED REDACTED:825— REDACTED changed 44 times in last 90 days, max cyclomatic complexity 61 in PromptBuilder.build_system_prompt at line 825. 17 of those changes were fix/bug commits, and the other 27 changed it for other reasons — this file is under both repair and feature pressure. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08: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: backend/core/proactive_intelligence.py backend/core/proactive_intelligence.py:1884— backend/core/proactive_intelligence.py changed 38 times in last 90 days, max cyclomatic complexity 69 in proactive_intelligence.build_session_briefing_data at line 1884. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/proactive_intelligence.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: backend/core/security_hooks.py backend/core/security_hooks.py:284— backend/core/security_hooks.py changed 42 times in last 90 days, max cyclomatic complexity 58 in security_hooks._segment_is_irreversible at line 284. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/security_hooks.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: backend/hooks/distillation_hook.py backend/hooks/distillation_hook.py:451— backend/hooks/distillation_hook.py changed 31 times in last 90 days, max cyclomatic complexity 69 in DistillationTriggerHook._distill_files at line 451. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/hooks/distillation_hook.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: REDACTED REDACTED:154— REDACTED changed 25 times in last 90 days, max cyclomatic complexity 64 in executor.execute_job at line 154. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08: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: backend/channels/gateway.py backend/channels/gateway.py:1619— backend/channels/gateway.py changed 9 times in last 90 days, max cyclomatic complexity 158 in ChannelGateway._handle_conversation at line 1619. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/channels/gateway.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: desktop/src/components/common/FileEditorCore.tsx desktop/src/components/common/FileEditorCore.tsx:606— desktop/src/components/common/FileEditorCore.tsx changed 14 times in last 90 days, max cyclomatic complexity 96 in FileEditorCore at line 606. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/components/common/FileEditorCore.tsx`: 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: backend/main.py backend/main.py:938— backend/main.py changed 29 times in last 90 days, max cyclomatic complexity 45 in main.lifespan at line 938. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/main.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: desktop/src/components/layout/ThreeColumnLayout.tsx desktop/src/components/layout/ThreeColumnLayout.tsx:378— desktop/src/components/layout/ThreeColumnLayout.tsx changed 53 times in last 90 days, max cyclomatic complexity 24 in NavSvgIcon at line 378. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/components/layout/ThreeColumnLayout.tsx`: 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: desktop/src/components/file-viewer/FileViewerPanel.tsx desktop/src/components/file-viewer/FileViewerPanel.tsx:139— desktop/src/components/file-viewer/FileViewerPanel.tsx changed 31 times in last 90 days, max cyclomatic complexity 38 in FileViewerPanelImpl at line 139. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/components/file-viewer/FileViewerPanel.tsx`: 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: backend/core/ddd_entry_lifecycle.py backend/core/ddd_entry_lifecycle.py:521— backend/core/ddd_entry_lifecycle.py changed 43 times in last 90 days, max cyclomatic complexity 27 in ddd_entry_lifecycle.parse_entries at line 521. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/ddd_entry_lifecycle.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: backend/core/ddd_cultivation.py backend/core/ddd_cultivation.py:984— backend/core/ddd_cultivation.py changed 40 times in last 90 days, max cyclomatic complexity 28 in ddd_cultivation.apply_to_ddd at line 984. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/ddd_cultivation.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: backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2388— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py changed 25 times in last 90 days, max cyclomatic complexity 40 in ai_ready_helpers.extract_import_graph at line 2388. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.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: desktop/src/stores/MessageStore.ts desktop/src/stores/MessageStore.ts:892— desktop/src/stores/MessageStore.ts changed 31 times in last 90 days, max cyclomatic complexity 30 in _applyMerge at line 892. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/stores/MessageStore.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: desktop/src/pages/EvalDashboard.tsx desktop/src/pages/EvalDashboard.tsx:289— desktop/src/pages/EvalDashboard.tsx changed 34 times in last 90 days, max cyclomatic complexity 26 in OverviewTab 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/pages/EvalDashboard.tsx`: 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: backend/core/ddd_orchestrator.py backend/core/ddd_orchestrator.py:582— backend/core/ddd_orchestrator.py changed 29 times in last 90 days, max cyclomatic complexity 29 in DddCultivationOrchestrator._auto_apply_ddd_proposals at line 582. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/ddd_orchestrator.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.
FunctionTooLong: ChatPage.ChatPage desktop/src/pages/ChatPage.tsx:129— FunctionTooLong — ChatPage runs 1923 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1823 over it, 19.23× 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: useChatStreamingLifecycle.useChatStreamingLifecycle desktop/src/hooks/useChatStreamingLifecycle.ts:1030— FunctionTooLong — useChatStreamingLifecycle runs 1648 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1548 over it, 16.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.
FunctionTooLong: SkillsPage.GenerateSkillForm desktop/src/pages/SkillsPage.tsx:327— FunctionTooLong — GenerateSkillForm runs 505 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 405 over it, 5.05× 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: AuthConfigPanel.AuthConfigPanel desktop/src/components/settings/AuthConfigPanel.tsx:29— FunctionTooLong — AuthConfigPanel runs 415 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 315 over it, 4.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: html2pptx.extractSlideData backend/skills/s_pptx/scripts/html2pptx.js:244— FunctionTooLong — extractSlideData runs 402 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 302 over it, 4.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: EvalDashboard.GuideTab desktop/src/pages/EvalDashboard.tsx:1698— FunctionTooLong — GuideTab runs 343 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 243 over it, 3.43× 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: BackendStartupOverlay.BackendStartupOverlay desktop/src/components/common/BackendStartupOverlay.tsx:241— FunctionTooLong — BackendStartupOverlay runs 328 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× 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: AgentFormModal.AgentFormModal desktop/src/components/common/AgentFormModal.tsx:36— FunctionTooLong — AgentFormModal runs 327 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 227 over it, 3.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: TabView.TabViewImpl desktop/src/pages/chat/components/TabView.tsx:208— FunctionTooLong — TabViewImpl runs 304 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 204 over it, 3.04× 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: browser-agent.main backend/skills/s_browser-agent/browser-agent.mjs:304— FunctionTooLong — main runs 286 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 186 over it, 2.86× 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: FileContextMenu.FileContextMenu desktop/src/components/workspace-explorer/FileContextMenu.tsx:58— FunctionTooLong — FileContextMenu runs 282 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 182 over it, 2.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.
FunctionTooLong: useUnifiedTabState.useUnifiedTabState desktop/src/hooks/useUnifiedTabState.ts:419— FunctionTooLong — useUnifiedTabState runs 279 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 179 over it, 2.79× 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: CapabilitiesOverlay.CapabilitiesContent desktop/src/components/layout/CapabilitiesOverlay.tsx:173— FunctionTooLong — CapabilitiesContent runs 269 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 169 over it, 2.69× 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: AIModelsTab.AIModelsTab desktop/src/components/settings/AIModelsTab.tsx:15— FunctionTooLong — AIModelsTab runs 242 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 142 over it, 2.42× 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: FolderPickerModal.FolderPickerModal desktop/src/components/workspace/FolderPickerModal.tsx:21— FunctionTooLong — FolderPickerModal runs 233 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 133 over it, 2.33× 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: VirtualizedTree.VirtualizedTree desktop/src/components/workspace-explorer/VirtualizedTree.tsx:688— FunctionTooLong — VirtualizedTree runs 214 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 114 over it, 2.14× 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: EvalDashboard.GoldenSetTab desktop/src/pages/EvalDashboard.tsx:495— FunctionTooLong — GoldenSetTab runs 211 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× 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: PollinateOverlay.PollinateContent desktop/src/components/layout/PollinateOverlay.tsx:108— FunctionTooLong — PollinateContent runs 203 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 103 over it, 2.03× 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: SkillsPage.SkillsPage desktop/src/pages/SkillsPage.tsx:77— FunctionTooLong — SkillsPage runs 202 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 102 over it, 2.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: EngineMetricsTab.EngineMetricsTab desktop/src/components/settings/EngineMetricsTab.tsx:54— FunctionTooLong — EngineMetricsTab runs 199 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 99 over it, 1.99× 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: useUnifiedAttachments.useUnifiedAttachments desktop/src/hooks/useUnifiedAttachments.ts:117— FunctionTooLong — useUnifiedAttachments runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× 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: useVoiceRecorder.useVoiceRecorder desktop/src/hooks/useVoiceRecorder.ts:48— FunctionTooLong — useVoiceRecorder runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× 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: KnowledgebasesTab.KnowledgebasesTab desktop/src/components/workspace-settings/KnowledgebasesTab.tsx:23— FunctionTooLong — KnowledgebasesTab runs 190 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 90 over it, 1.90× 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: ExplorerToolbar.ExplorerToolbar desktop/src/components/workspace-explorer/ExplorerToolbar.tsx:34— FunctionTooLong — ExplorerToolbar runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× 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: useHealthMonitor.useHealthMonitor desktop/src/hooks/useHealthMonitor.ts:134— FunctionTooLong — useHealthMonitor runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× 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.
FileTooLong: scripts/artifact_cli.py backend/scripts/artifact_cli.py— FileTooLong — 3360 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2860 over it, 6.72× 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/ai_ready_helpers.py backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py— FileTooLong — 2257 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1757 over it, 4.51× 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/pipeline_validator.py backend/scripts/pipeline_validator.py— FileTooLong — 2125 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1625 over it, 4.25× 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: core/session_unit.py backend/core/session_unit.py— FileTooLong — 2115 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1615 over it, 4.23× 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: hooks/useChatStreamingLifecycle.ts desktop/src/hooks/useChatStreamingLifecycle.ts— FileTooLong — 2045 significant lines (blank, comment-only and punctuation-only lines excluded), about 81% of them inside a single declaration: useChatStreamingLifecycle (1030-4584). The bar is 500 significant lines; this is 1545 over it, 4.09× 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: pages/EvalDashboard.tsx desktop/src/pages/EvalDashboard.tsx— FileTooLong — 2022 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1522 over it, 4.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: pages/ChatPage.tsx desktop/src/pages/ChatPage.tsx— FileTooLong — 1995 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: ChatPage (129-3557). The bar is 500 significant lines; this is 1495 over it, 3.99× 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: hooks/context_health_hook.py backend/hooks/context_health_hook.py— FileTooLong — 1992 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1492 over it, 3.98× 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/ai_ready_helpers.py backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py— FileTooLong — 1983 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1483 over it, 3.97× 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: database/sqlite.py backend/database/sqlite.py— FileTooLong — 1760 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1260 over it, 3.52× 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: core/session_router.py backend/core/session_router.py— FileTooLong — 1755 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1255 over it, 3.51× 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/eval_runner.py backend/scripts/eval_runner.py— FileTooLong — 1631 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1131 over it, 3.26× 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: hooks/distillation_hook.py backend/hooks/distillation_hook.py— FileTooLong — 1625 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1125 over it, 3.25× 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: channels/gateway.py backend/channels/gateway.py— FileTooLong — 1581 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1081 over it, 3.16× 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: src/lib.rs desktop/src-tauri/src/lib.rs— FileTooLong — 1491 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 38 free functions. The bar is 500 significant lines; this is 991 over it, 2.98× 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: common/FileEditorCore.tsx desktop/src/components/common/FileEditorCore.tsx— FileTooLong — 1460 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 960 over it, 2.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: core/security_hooks.py backend/core/security_hooks.py— FileTooLong — 1452 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 952 over it, 2.90× 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: core/proactive_intelligence.py backend/core/proactive_intelligence.py— FileTooLong — 1361 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 861 over it, 2.72× 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: backend/main.py backend/main.py— FileTooLong — 1281 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 781 over it, 2.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: REDACTED REDACTED— FileTooLong — 1272 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 772 over it, 2.54× 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 — 1261 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 761 over it, 2.52× 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: core/swarm_workspace_manager.py backend/core/swarm_workspace_manager.py— FileTooLong — 1242 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 742 over it, 2.48× 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: core/evolution_optimizer.py backend/core/evolution_optimizer.py— FileTooLong — 1188 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 688 over it, 2.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: core/ddd_cultivation.py backend/core/ddd_cultivation.py— FileTooLong — 1157 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 657 over it, 2.31× 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: code_intel/parser.py backend/core/code_intel/parser.py— FileTooLong — 1062 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 562 over it, 2.12× 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.
+ 45 more in this group — see findings.md.
R4 · Test Coverage· No test reaches this file · ×40
No test reaches this file desktop/src/pages/SkillsPage.tsx— 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 backend/skills/s_pptx/scripts/html2pptx.js— 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 backend/skills/s_browser-agent/browser-agent.mjs— 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 backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx— 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— 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 backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx— 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 backend/skills/s_pollinate/templates/remotion/Video.tsx— 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 desktop/src/components/workspace/FolderPickerModal.tsx— 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 desktop/src/components/workspace/FileBrowser.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/animations.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/AnimatedBackground.tsx— 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 backend/skills/s_pollinate/templates/remotion/Root.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/Subtitles.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/Timeline.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/MediaSection.tsx— 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/generate-update-manifest.js— 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 backend/skills/s_pollinate/templates/remotion/components/ChapterProgressBar.tsx— 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 desktop/src/services/logForwarder.ts— 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 backend/skills/s_pollinate/templates/remotion/Thumbnail.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/LottieAnimation.tsx— 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 desktop/src/components/modals/ConvertToTaskModal.tsx— 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 desktop/src/pages/chat/components/radar/EvolutionBadge.tsx— 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 backend/skills/s_pollinate/templates/remotion/components/Icon.tsx— 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.
TodoComment backend/main.py:1221— # ToDo lifecycle: auto-complete bound todos, implicit file matching — 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 backend/core/todo_manager.py:562— # ToDo flow-closure fields (run_d28de5fd) — Gate-1 C: _dict_to_response is an — 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 backend/core/evolution/gate_scaffold.py:36— # fail-open) — but the match body is a TODO and the gate exits 0 (allows all) until a — 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 backend/core/evolution/gate_scaffold.py:70— # TODO(human): inspect `event` (tool_name / tool_input) and return 2 with a reason — 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 backend/database/sqlite.py:3111— # ToDo Schema Extensions (Swarm Radar ToDos — Sub-Spec 2) — 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 backend/hooks/context_health_hook.py:1055— # opens with a non-type bracket like "[TODO] ..." or "[2026] ..." — 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 backend/jobs/system_jobs.py:323— # (Todo Resolution job removed run_50db230a — it auto-resolved/cancelled todos, — 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 backend/jobs/models.py:78— # path; `queries` is a commented-out TODO). Exposing member editing would be an — 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 REDACTED:1839— # ── Todo Lifecycle: Expiration, Escalation, Purge ──────────────────── — 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 REDACTED:1963— # todo still awaiting human review (review_state='completed'), even if it — 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 backend/jobs/adapters/web_search.py:36— # TODO: Implement Tavily search when API key is available — 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 backend/routers/todos.py:75— # ── ToDo flow-closure History (run_d28de5fd) ──────────────────────────────── — 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 backend/routers/todos.py:403— # ── ToDo Attachments (run_162b8817) ────────────────────────────────── — 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 backend/schemas/todo.py:144— # ToDo flow-closure fields (run_d28de5fd) — review dimension is ORTHOGONAL to status. — 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 backend/tests/test_todos_router.py:370— # ToDo Flow-Closure — History, Stats, Review (run_d28de5fd) — 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 backend/tests/test_todos_router.py:436— # ToDo Flow-Closure — Dispatch + Retreat (run_5088b841, A2) — 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 backend/tests/test_run2_type_wiring.py:221— # VALID_TYPES guard as the honor, or "[TODO] ..." loses 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 backend/tests/test_property_enum_validation.py:16— # --- ToDo enums --- — 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 backend/tests/test_distill_lesson_types.py:138— # A legitimate [TODO]-style lead is NOT in VALID_TYPES → must survive in body. — 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 desktop/src/components/layout/overlayHostE2E.test.tsx:149— // ToDo gone, Jobs shown — exactly one surface open — 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 desktop/src/components/layout/ThreeColumnLayout.tsx:503— // ToDo — a checklist: a card with a check mark (queued work you own). — 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 desktop/src/pages/ChatPage.tsx:64— // ToDo / Jobs & Runs / Pipeline / Pollinate + NewBrain overlays retired (M3+M4): — 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 desktop/src/pages/ChatPage.tsx:1199— // ToDo Dispatch ①→② (A2, run_5088b841). APPEND-ONLY record of dispatches whose — 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 desktop/src/pages/ChatPage.tsx:1920— // ToDo Dispatch backfill: this tab's session just materialized (active path). — 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 desktop/src/pages/chat/constants.ts:24— // ToDo Radar sidebar constants — 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.
Duplicated block (11 lines × 2) backend/core/ddd_health.py:177— backend/core/ddd_health.py:177-187 | backend/core/ddd_maturity.py:426-436 — 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 (11 lines × 2) backend/core/ingestion_gate.py:464— backend/core/ingestion_gate.py:464-474 | backend/core/ingestion_gate.py:823-833 — 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 (11 lines × 2) backend/core/knowledge_graph.py:213— backend/core/knowledge_graph.py:213-223 | backend/core/knowledge_graph.py:235-245 — 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 (11 lines × 2) backend/core/knowledge_store.py:277— backend/core/knowledge_store.py:277-287 | REDACTED:331-341 — 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 `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 (11 lines × 2) backend/core/memory_extractor.py:122— backend/core/memory_extractor.py:122-132 | backend/core/summarization.py:702-712 — 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 `backend/core/memory_extractor.py:122` 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 before the matched lines, `backend/core/memory_extractor.py:119` calls `get` and `backend/core/summarization.py:701` does not — after which the two agree again for 3 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 (11 lines × 2) backend/core/runtime_hooks.py:203— backend/core/runtime_hooks.py:203-214 | backend/core/runtime_hooks.py:1035-1045 — 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 (11 lines × 2) backend/core/summarization.py:530— backend/core/summarization.py:530-540 | backend/hooks/skill_metrics_hook.py:233-243 — 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 (11 lines × 2) backend/database/sqlite.py:742— backend/database/sqlite.py:742-752 | backend/database/sqlite.py:767-777 — 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 `backend/database/sqlite.py:742` 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) backend/hive/provisioner.py:1032— backend/hive/provisioner.py:1032-1042 | backend/hive/provisioner.py:1075-1085 — 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 (11 lines × 2) backend/hooks/context_health_hook.py:1265— backend/hooks/context_health_hook.py:1265-1275 | backend/hooks/context_health_hook.py:1288-1298 — 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 `backend/hooks/context_health_hook.py:1265` 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 × 2) backend/hooks/distillation_hook.py:691— backend/hooks/distillation_hook.py:691-701 | backend/hooks/distillation_hook.py:733-749 — 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 `backend/hooks/distillation_hook.py:691` 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 × 2) backend/hooks/evolution_maintenance_hook.py:752— backend/hooks/evolution_maintenance_hook.py:752-762 | backend/hooks/evolution_maintenance_hook.py:1060-1070 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/hooks/evolution_maintenance_hook.py:745` calls `min` and `backend/hooks/evolution_maintenance_hook.py:1058` 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 (11 lines × 2) REDACTED:418— REDACTED:418-428 | REDACTED:439-450 — 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:418` 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 × 2) backend/scripts/artifact_cli.py:1294— backend/scripts/artifact_cli.py:1294-1304 | backend/scripts/artifact_cli.py:1348-1358 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/scripts/artifact_cli.py:1307` calls `get` and `backend/scripts/artifact_cli.py:1366` does not — after which the two agree again for 3 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 (11 lines × 2) backend/scripts/artifact_cli.py:1348— backend/scripts/artifact_cli.py:1348-1358 | backend/scripts/pipeline_cleanup.py:56-66 — 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 (11 lines × 2) backend/scripts/scenario_runner.py:85— backend/scripts/scenario_runner.py:85-95 | backend/scripts/scenario_runner.py:135-145 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/scripts/scenario_runner.py:146` calls `get`, `isinstance` and `backend/scripts/scenario_runner.py:96` 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 (11 lines × 2) backend/skills/s_frontend-design/scripts/search.py:31— backend/skills/s_frontend-design/scripts/search.py:31-41 | backend/skills/s_web-design-review/scripts/search.py:31-41 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/search.py` and `backend/skills/s_web-design-review/scripts/search.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 (11 lines × 2) backend/skills/s_pollinate/scripts/cross_format_check.py:137— backend/skills/s_pollinate/scripts/cross_format_check.py:137-147 | backend/skills/s_pollinate/scripts/cross_format_check.py:212-222 — 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:214— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:214-224 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:213-223 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (11 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1025— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1025-1035 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:760-771 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (11 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1602— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1602-1612 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1266-1276 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (11 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3648— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3648-3658 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3279-3289 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/core/daemon_guard.py:478— backend/core/daemon_guard.py:478-488 | desktop/resources/daemon/daemon_guard.py:478-488 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2050— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2050-2060 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3139-3149 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3551— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3551-3561 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3182-3192 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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.
Repeated repair: desktop/src/hooks/useUnifiedTabState.ts desktop/src/hooks/useUnifiedTabState.ts:767— desktop/src/hooks/useUnifiedTabState.ts changed 24 times in last 90 days and 16 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is (anonymous) at line 767), 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: “revert(tabs): chat-tab ceiling 6→4 (3 chat + 1 channel)”; “fix(chat): OT01 render-freeze — stream-event guard uses latestStreamGen not streamGen (run_f9adee1e)”; “fix(ot01): Gate-2 adversarial findings — queued-drain exemption + log-flood guard + docstring (run_251ea3ee)”; “fix(ot01): hard-cap backstop clock — churn-immune force-clear bound (route-A AC1)”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/hooks/useUnifiedTabState.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: desktop/src/components/common/Modal.tsx desktop/src/components/common/Modal.tsx:33— desktop/src/components/common/Modal.tsx changed 18 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 4 (its worst body is Modal at line 33), 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(nav): single-surface overlay/modal mutual exclusion + tint/spout for raw-button overlays”; “fix(canvas): emit file_changed for parent Edit/Write results (UserMessage branch)”; “fix(modal): responsive clamp() fullscreen-overlay widths + de-blur scrim”; “fix(canvas): Make null-rect modal fallback resize-reactive”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/components/common/Modal.tsx`: 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: backend/routers/cultivation.py backend/routers/cultivation.py:130— backend/routers/cultivation.py changed 13 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 12 (its worst body is cultivation.approve_proposal at line 130), 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(ci): repair 4 pre-existing CI failures exposed after the YAML parse fix”; “根治 DDD cultivation + governance 准入逻辑:review/approve 队列堆积噪音的根因是 4 个准入 bug”; “Converge all DDD-doc writers onto utils.file_lock.md_lock — fixes a late”; “Fix 2 verified latent bugs in DDD cultivation subsystem: (1) cultivation”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/routers/cultivation.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.
Repeated repair: desktop/src/components/layout/CommunityOverlay.tsx desktop/src/components/layout/CommunityOverlay.tsx:694— desktop/src/components/layout/CommunityOverlay.tsx changed 13 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 12 (its worst body is OutboundTab at line 694), 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(review-followups): 4 real open items — gate wiring guard, git-fork batch, honest errors”; “fix(adversarial-review): 3 confirmed bugs my own tests missed + de-vacuous 1 test”; “fix(community): wire github-people into the add-feed type picker (was frontend-zero-wired)”; “fix(community-feed): surface the backend's honest truncation flag (was silently dropped)”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/components/layout/CommunityOverlay.tsx`: 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: desktop/src/hooks/useHealthMonitor.ts desktop/src/hooks/useHealthMonitor.ts:222— desktop/src/hooks/useHealthMonitor.ts 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 8 (its worst body is (anonymous) at line 222), 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(paths): unify app-data root off production in tests”; “fix(offline): close the last false-offline path — JS poll respects heartbeat liveness”; “fix(health): watchdog verifies liveness before declaring death + frontend degraded state”; “fix(desktop): distinguish backend restart vs stall in health UI”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/hooks/useHealthMonitor.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: REDACTED REDACTED:256— REDACTED changed 7 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 10 (its worst body is AppConfigManager.set_secret at line 256), 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(model): collapse 5 drifted model tables into one registry + make silent substitution loud”; “auth: add Bedrock API-key (bearer-token) mode + onboarding fixes”; “auth: Gate-2 convergence — fix 2 HIGH (stale env, use_bedrock default) + atomic secret write”; “auth AC3/FIX-A: durable secret store for anthropic_api_key (survives restart, never in config.json/backup)”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08: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.
Repeated repair: desktop/src/pages/chat/components/TSCCModules.tsx desktop/src/pages/chat/components/TSCCModules.tsx:713— desktop/src/pages/chat/components/TSCCModules.tsx changed 7 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 7 (its worst body is (anonymous) at line 713), 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 stale architecture content in the TSCC Flow tab + OWNER map (TSCCMod”; “fix(tscc): classify SELF.md as system-owned in the OWNER map”; “fix(tscc): portal View-Full-Prompt modal to viewport + colored pop-up border”; “fix(tscc): report the real token budget and recall misses”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/pages/chat/components/TSCCModules.tsx`: 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: backend/core/session_state_persistence.py backend/core/session_state_persistence.py:32— backend/core/session_state_persistence.py changed 5 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 10 (its worst body is session_state_persistence.persist_session_state at line 32), 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(session): merge pending_ids into persist to prevent data loss on double-restart”; “fix(session): adversarial fixes — no unlink on read + missing timestamp guard”; “fix(session): lazy-inject persisted sdk_session_ids at unit creation (PE HIGH fix)”; “fix(session): adversarial review fixes — tighter patterns, time cap, test update”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/session_state_persistence.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.
Repeated repair: desktop/src/components/layout/JobsRunsOverlay.tsx desktop/src/components/layout/JobsRunsOverlay.tsx:316— desktop/src/components/layout/JobsRunsOverlay.tsx changed 7 times in last 90 days and 4 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 JobDetailDrawer at line 316), 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: “M4: migrate the 4 workbench overlays to OverlayHost + fix proprioception SENSE/ACT lesion (run_fdeaead8)”; “fix(jobs): script-job dispatch prompt directs command to config.command”; “fix(jobs): Gate-2 adversarial findings — independent-settle fetch, drawer re-derive, gen-guard”; “fix(jobs): REVIEW findings — timestamp-instant sort, Runs-view roster load, drawer/form mutual-exclusion, run-now error feedback”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/components/layout/JobsRunsOverlay.tsx`: 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: backend/scripts/scenario_runner.py backend/scripts/scenario_runner.py:114— backend/scripts/scenario_runner.py changed 7 times in last 90 days and 4 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 scenario_runner.parse_final_text at line 114), 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(eval): utilization gate — polarity guard kills keyword!=behavior false-pass”; “fix(eval): adversarial Gate-2 (DELIVER) — 2 MED on the behavior-eval changeset”; “fix(eval): adversarial Gate-2 — 3 fixes on behavior-trajectory eval”; “fix(eval,evolution): adversarial Gate-2 — 5 findings on the self-evo-loop changeset”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/scripts/scenario_runner.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.
Repeated repair: desktop/src/hooks/useChangeStatus.ts desktop/src/hooks/useChangeStatus.ts:115— desktop/src/hooks/useChangeStatus.ts changed 6 times in last 90 days and 4 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 handler at line 115), 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: “Cycle 6/6 (run_e626e121): Gate-2 adversarial fixes”; “fix(canvas,chat): speed up outputs list + land chat at bottom on tab switch”; “Fix GET /workspace/file/committed: binary/non-UTF-8 files should return”; “fix(radar): 6-fix — English UI, committed-based NEW/UPD (cross-repo), line-clamp, compact, NEW-first, diff fail-soft (run_19e04b0f)”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/hooks/useChangeStatus.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: desktop/src/components/terminal/TerminalTab.tsx desktop/src/components/terminal/TerminalTab.tsx:233— desktop/src/components/terminal/TerminalTab.tsx changed 6 times in last 90 days and 4 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 233), 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(terminal): eliminate mouse-selection drift — preload JetBrains Mono before xterm measures its cell”; “fix(terminal): 4 UX fixes — click-swallow overlay, selection re-measure, dense layout, history-preserving collapse”; “fix(terminal): colors + legible style — inject TERM, ANSI palette, font”; “fix(terminal): typing (focus race), default terminal+cwd, numbered tabs”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/components/terminal/TerminalTab.tsx`: 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: scripts/check_commit_trailers.py scripts/check_commit_trailers.py:137— scripts/check_commit_trailers.py changed 5 times in last 90 days and 4 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 check_commit_trailers.main 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(ci): amnesty trailer-less commit d8c247a3 in trailer gate”; “fix(ci): repair 4 pre-existing CI failures exposed after the YAML parse fix”; “trivial: (A) fix test_admission_rootfix.py:166/186 from-backend.-prefixe”; “fix(ci): enforce the Co-Authored-By identity in CI — the local hook has been dead all along”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- scripts/check_commit_trailers.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.
Repeated repair: scripts/security_scan.py scripts/security_scan.py:332— scripts/security_scan.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is security_scan._cors_fingerprints at line 332), 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: “Close R32 self-enforcement gap: add A4 wildcard-CORS regression check to”; “fix(security-gate): fail CLOSED on scanner tool crash (RP50 fail-open regression)”; “fix(security): exclude private skills from scan + purge leaked paths from baselines”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- scripts/security_scan.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.
Repeated repair: backend/core/recall_metrics.py backend/core/recall_metrics.py:53— backend/core/recall_metrics.py changed 5 times in last 90 days and 3 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 recall_metrics.record_recall_metric at line 53), 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(recall-metrics): requeue a drained window when the flush write fails (no data hole)”; “fix(recall-metrics): stamp timestamp at measurement time, not flush time”; “fix(observability): clear the last 17 lying-result handlers; gate against logs that crash”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/recall_metrics.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.
Repeated repair: backend/core/evolution/governance_miner.py backend/core/evolution/governance_miner.py:202— backend/core/evolution/governance_miner.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is governance_miner.generate_governance_proposals at line 202), 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: “根治 DDD cultivation + governance 准入逻辑:review/approve 队列堆积噪音的根因是 4 个准入 bug”; “fix(evolution): defense-in-depth axis guard on governance_miner loop (run_685db747 Gate-2 MED)”; “fix(evolution-v3): Phase 2 adversarial Gate-2 findings (2 HIGH, 1 MED)”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/evolution/governance_miner.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.
Repeated repair: backend/core/evolution/judgment_classifier.py backend/core/evolution/judgment_classifier.py:235— backend/core/evolution/judgment_classifier.py changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is judgment_classifier._classify_cognitive at line 235), 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(evolution): adversarial Gate-2 — traceback discriminator must precede noise substrings”; “fix(evolution): noise-gate the correction tracker — stop operator-noise polluting OPERATIONAL + fake governance”; “fix(evolution-v3): adversarial Gate-2 findings (1 CRITICAL, 1 HIGH, 2 MED)”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/evolution/judgment_classifier.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.
Repeated repair: backend/core/code_intel/__init__.py backend/core/code_intel/__init__.py:88— backend/core/code_intel/__init__.py changed 4 times in last 90 days and 3 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 code_intel.invalidate_cache at line 88), 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(observability): clear 6 more lying-result handlers; teach the gate that yielding an error event counts”; “fix(code-intel): validate repo_root ownership before index/watch — stop cross-project contamination (run_1950e67e)”; “code-intel: fix reindex repo_path parsing — reuse shared multi-format helper”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/code_intel/__init__.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.
Repeated repair: backend/core/permission_manager.py backend/core/permission_manager.py:217— backend/core/permission_manager.py changed 4 times in last 90 days and 3 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 PermissionManager.is_resolved at line 217), 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(hooks): exempt HITL gates from 5s chain timeout + align approval wait to 4h (run_6e780e00)”; “fix(session): complete approve-into-void deadlock fix — endpoint recovery + Gate-2 comment (run_65f317db)”; “fix(perm): permission-prompt hang — durable re-surface + bounded timeout + narrowed rm gate”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/core/permission_manager.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.
Repeated repair: backend/scripts/refresh_ai_docs.py backend/scripts/refresh_ai_docs.py:142— backend/scripts/refresh_ai_docs.py changed 4 times in last 90 days and 3 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 refresh_ai_docs._load_engines at line 142), 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(docs): core_loc + core_modules → git-tracked tests-OUT caliber”; “fix(docs): point SSE staleness checks at streaming_orchestrator”; “fix(docs): total_backend_loc via git ls-files — reproducible, no timeout”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- backend/scripts/refresh_ai_docs.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.
Repeated repair: desktop/src/stores/TerminalStore.ts desktop/src/stores/TerminalStore.ts:143— desktop/src/stores/TerminalStore.ts changed 4 times in last 90 days and 3 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 openTerminal at line 143), 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(terminal): 4 UX fixes — click-swallow overlay, selection re-measure, dense layout, history-preserving collapse”; “fix(terminal): typing (focus race), default terminal+cwd, numbered tabs”; “fix(terminal): Gate-2 adversarial fixes — platform-aware shell + drain one-shot clear”. 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-06-16..2026-09-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-16 10:48:17 +08:00' --until='2026-09-14 10:48:17 +08:00' --full-history --no-merges -- desktop/src/stores/TerminalStore.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.
Duplicated block (9 lines × 2) backend/channels/gateway.py:513— backend/channels/gateway.py:513-522 | backend/channels/gateway.py:606-614 — 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 (9 lines × 2) backend/core/code_intel/graph_store.py:539— backend/core/code_intel/graph_store.py:539-547 | backend/core/code_intel/graph_store.py:668-676 — 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 (9 lines × 2) backend/core/code_intel/graph_store.py:533— backend/core/code_intel/graph_store.py:533-541 | backend/core/code_intel/graph_store.py:576-584 — 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 `backend/core/code_intel/graph_store.py:533` 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 (9 lines × 2) REDACTED:141— REDACTED:141-149 | REDACTED:196-204 — 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 (9 lines × 2) backend/database/sqlite.py:525— backend/database/sqlite.py:525-533 | backend/database/sqlite.py:1671-1679 — 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 (9 lines × 2) backend/database/sqlite.py:1433— backend/database/sqlite.py:1433-1441 | backend/database/sqlite.py:1465-1473 — 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 (9 lines × 2) backend/hive/provisioner.py:674— backend/hive/provisioner.py:674-685 | backend/hive/provisioner.py:1553-1561 — 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 `backend/hive/provisioner.py:674` 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) backend/hooks/daily_activity_hook.py:349— backend/hooks/daily_activity_hook.py:349-357 | backend/hooks/distillation_hook.py:1472-1480 — 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) REDACTED:313— REDACTED:313-321 | REDACTED:349-357 — 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 (9 lines × 2) REDACTED:387— REDACTED:387-395 | REDACTED:406-414 — 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:387` 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) backend/jobs/handlers/ddd_refresh.py:201— backend/jobs/handlers/ddd_refresh.py:201-209 | backend/jobs/handlers/ddd_refresh.py:212-220 — 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 `backend/jobs/handlers/ddd_refresh.py:201` 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) backend/jobs/scheduler.py:555— backend/jobs/scheduler.py:555-563 | backend/jobs/scheduler.py:573-581 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/jobs/scheduler.py:570` calls `set` and `backend/jobs/scheduler.py:549` 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) backend/routers/pollinate.py:508— backend/routers/pollinate.py:508-516 | backend/routers/pollinate.py:679-687 — 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 (9 lines × 2) backend/scripts/artifact_cli.py:71— backend/scripts/artifact_cli.py:71-79 | backend/scripts/artifact_cli.py:2975-2983 — 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) backend/scripts/pipeline_analytics.py:786— backend/scripts/pipeline_analytics.py:786-794 | backend/scripts/pipeline_analytics.py:894-902 — 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 (9 lines × 2) backend/scripts/scenario_runner.py:95— backend/scripts/scenario_runner.py:95-103 | backend/scripts/scenario_runner.py:148-156 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/scripts/scenario_runner.py:146` calls `get`, `isinstance` and `backend/scripts/scenario_runner.py:94` 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) backend/scripts/verify_build.py:339— backend/scripts/verify_build.py:339-347 | backend/scripts/verify_build.py:351-359 — 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) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2964— backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2964-2972 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2977-2985 — 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) backend/skills/s_docx/ooxml/scripts/validation/base.py:816— backend/skills/s_docx/ooxml/scripts/validation/base.py:816-824 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:819-827 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (9 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:722— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:722-730 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:636-644 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:722` 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 (7 lines × 2) backend/core/conversation_extract.py:122— backend/core/conversation_extract.py:122-128 | backend/core/session_harvest.py:108-114 — 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 (7 lines × 2) backend/core/ddd_entry_lifecycle.py:573— backend/core/ddd_entry_lifecycle.py:573-579 | backend/core/ddd_entry_lifecycle.py:713-719 — 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) backend/jobs/handlers/swarmai_monthly_report.py:500— backend/jobs/handlers/swarmai_monthly_report.py:500-506 | backend/jobs/handlers/swarmai_monthly_report.py:508-514 — 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 `backend/jobs/handlers/swarmai_monthly_report.py:500` 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) backend/routers/hive.py:495— backend/routers/hive.py:495-501 | backend/routers/hive.py:517-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 `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) backend/scripts/artifact_cli.py:2084— backend/scripts/artifact_cli.py:2084-2090 | backend/scripts/artifact_cli.py:2382-2388 — 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) backend/scripts/artifact_cli.py:5821— backend/scripts/artifact_cli.py:5821-5827 | backend/scripts/artifact_cli.py:5947-5953 — 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) backend/scripts/pipeline_validator.py:2902— backend/scripts/pipeline_validator.py:2902-2911 | backend/scripts/pipeline_validator.py:3212-3218 — 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 `backend/scripts/pipeline_validator.py:2902` 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) backend/skills/s_frontend-design/scripts/design_system.py:443— backend/skills/s_frontend-design/scripts/design_system.py:443-449 | backend/skills/s_frontend-design/scripts/design_system.py:838-844 — 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) backend/skills/s_pollinate/scripts/check_rpv.py:19— backend/skills/s_pollinate/scripts/check_rpv.py:19-25 | backend/skills/s_pollinate/scripts/check_rpv.py:93-99 — 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) backend/skills/s_pptx/scripts/style-extract.py:95— backend/skills/s_pptx/scripts/style-extract.py:95-101 | backend/skills/s_pptx/scripts/style-extract.py:109-115 — 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:241— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:241-247 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:240-246 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (7 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1505— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1505-1511 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1216-1222 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (7 lines × 2) backend/core/daemon_guard.py:94— backend/core/daemon_guard.py:94-100 | desktop/resources/daemon/daemon_guard.py:94-100 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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 (7 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:264— backend/skills/s_docx/ooxml/scripts/validation/docx.py:264-270 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:264-270 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 (7 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2224— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2224-2230 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1876-1882 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (7 lines × 2) scripts/smoke_e2e.py:353— scripts/smoke_e2e.py:353-359 | scripts/smoke_e2e.py:362-368 — 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) backend/core/daemon_guard.py:146— backend/core/daemon_guard.py:146-157 | desktop/resources/daemon/daemon_guard.py:146-157 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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 (12 lines × 2) backend/core/mcp_config_loader.py:669— backend/core/mcp_config_loader.py:669-680 | backend/core/mcp_config_loader.py:707-718 — 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 `backend/core/mcp_config_loader.py:669` 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 (12 lines × 2) REDACTED:358— REDACTED:358-369 | REDACTED:400-411 — 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) backend/hive/provisioner.py:167— backend/hive/provisioner.py:167-178 | backend/hive/provisioner.py:181-192 — 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 (12 lines × 2) backend/jobs/bedrock.py:450— backend/jobs/bedrock.py:450-461 | backend/jobs/bedrock.py:471-482 — 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 `backend/jobs/bedrock.py:450` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 2) backend/routers/workspace.py:694— backend/routers/workspace.py:694-705 | backend/routers/workspace.py:775-786 — 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) backend/skills/s_frontend-design/scripts/design_system.py:961— backend/skills/s_frontend-design/scripts/design_system.py:961-972 | backend/skills/s_frontend-design/scripts/design_system.py:974-985 — 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) backend/skills/s_frontend-design/scripts/search.py:42— backend/skills/s_frontend-design/scripts/search.py:42-53 | backend/skills/s_web-design-review/scripts/search.py:42-53 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/search.py` and `backend/skills/s_web-design-review/scripts/search.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.
Duplicated block (12 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:251— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:251-262 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:250-261 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (12 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3625— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3625-3636 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3256-3267 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (12 lines × 2) backend/skills/s_library/scripts/library.py:60— backend/skills/s_library/scripts/library.py:60-71 | backend/skills/s_loops-health/scripts/loops_health_check.py:29-40 — 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.
TooManyMethods: SessionUnit backend/core/session_unit.py:452— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× 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: EvalService backend/core/eval_service.py:37— TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× 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: ContextHealthHook backend/hooks/context_health_hook.py:128— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× 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: SwarmWorkspaceManager backend/core/swarm_workspace_manager.py:873— TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× 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: LifecycleManager backend/core/lifecycle_manager.py:46— TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× 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: SlackChannelAdapter REDACTED:399— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× 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: GraphStore backend/core/code_intel/graph_store.py:271— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× 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: MessageStore desktop/src/stores/MessageStore.ts:64— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× 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: DistillationTriggerHook backend/hooks/distillation_hook.py:275— TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× 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: SessionRouter backend/core/session_router.py:1679— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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 (22 lines × 2) backend/core/context_injector.py:325— backend/core/context_injector.py:325-346 | backend/core/context_injector.py:363-384 — 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 (22 lines × 2) backend/skills/s_docx/ooxml/scripts/pack.py:134— backend/skills/s_docx/ooxml/scripts/pack.py:134-155 | backend/skills/s_pptx/ooxml/scripts/pack.py:134-155 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 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 (22 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:742— backend/skills/s_docx/ooxml/scripts/validation/base.py:742-763 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:745-766 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (22 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:792— backend/skills/s_docx/ooxml/scripts/validation/base.py:792-813 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:795-816 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (22 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:193— backend/skills/s_docx/ooxml/scripts/validation/docx.py:193-214 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:193-214 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 (22 lines × 2) backend/skills/s_frontend-design/scripts/core.py:127— backend/skills/s_frontend-design/scripts/core.py:127-148 | backend/skills/s_web-design-review/scripts/core.py:127-148 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/core.py` and `backend/skills/s_web-design-review/scripts/core.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 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) backend/skills/s_frontend-design/scripts/core.py:159— backend/skills/s_frontend-design/scripts/core.py:159-180 | backend/skills/s_web-design-review/scripts/core.py:159-180 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/core.py` and `backend/skills/s_web-design-review/scripts/core.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 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 (22 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:604— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:604-625 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:518-539 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (22 lines × 2) backend/core/daemon_guard.py:254— backend/core/daemon_guard.py:254-275 | desktop/resources/daemon/daemon_guard.py:254-275 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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) backend/channels/gateway.py:908— backend/channels/gateway.py:908-915 | backend/channels/gateway.py:970-981 — 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 (8 lines × 2) backend/core/proactive_intelligence.py:582— backend/core/proactive_intelligence.py:582-589 | backend/core/proactive_intelligence.py:662-669 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/core/proactive_intelligence.py:590` calls `isinstance` and `backend/core/proactive_intelligence.py:671` 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) backend/jobs/handlers/ddd_weekly_report.py:151— backend/jobs/handlers/ddd_weekly_report.py:151-158 | backend/jobs/handlers/swarmai_monthly_report.py:230-237 — 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) backend/scripts/artifact_cli.py:5874— backend/scripts/artifact_cli.py:5874-5881 | backend/scripts/artifact_cli.py:5941-5948 — 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 (8 lines × 2) backend/scripts/evolution_escalation_probe.py:100— backend/scripts/evolution_escalation_probe.py:100-109 | backend/scripts/evolution_escalation_probe.py:121-128 — 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 `backend/scripts/evolution_escalation_probe.py:100` 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) backend/scripts/pipeline_validator.py:1695— backend/scripts/pipeline_validator.py:1695-1704 | backend/scripts/pipeline_validator.py:3626-3633 — 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) backend/scripts/pipeline_validator.py:1846— backend/scripts/pipeline_validator.py:1846-1853 | backend/scripts/pipeline_validator.py:1860-1867 — 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 `backend/scripts/pipeline_validator.py:1846` 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) backend/core/voice_synthesize.py:254— backend/core/voice_synthesize.py:254-268 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:155-162 — 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) backend/skills/s_frontend-design/scripts/core.py:93— backend/skills/s_frontend-design/scripts/core.py:93-100 | backend/skills/s_web-design-review/scripts/core.py:93-100 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/core.py` and `backend/skills/s_web-design-review/scripts/core.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 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) backend/core/ddd_packager.py:1293— backend/core/ddd_packager.py:1293-1298 | backend/core/ddd_packager.py:1355-1360 — 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 (6 lines × 2) backend/core/proactive_intelligence.py:972— backend/core/proactive_intelligence.py:972-977 | backend/core/proactive_intelligence.py:1089-1099 — 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) backend/core/summarization.py:465— backend/core/summarization.py:465-470 | backend/core/summarization.py:484-489 — 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) backend/database/sqlite.py:501— backend/database/sqlite.py:501-506 | backend/database/sqlite.py:1642-1648 — 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) backend/hooks/distillation_hook.py:1892— backend/hooks/distillation_hook.py:1892-1897 | backend/hooks/distillation_hook.py:1977-1982 — 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) backend/scripts/artifact_cli.py:5937— backend/scripts/artifact_cli.py:5937-5942 | backend/scripts/artifact_cli.py:5974-5979 — 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1614— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1614-1619 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1278-1283 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1614` 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 (6 lines × 2) scripts/security_scan.py:189— scripts/security_scan.py:189-194 | scripts/security_scan.py:286-291 — 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) backend/skills/s_frontend-design/scripts/design_system.py:342— backend/skills/s_frontend-design/scripts/design_system.py:342-347 | backend/skills/s_frontend-design/scripts/design_system.py:380-385 — 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 (19 lines × 2) backend/core/ddd_cultivation.py:2487— backend/core/ddd_cultivation.py:2487-2505 | backend/core/ddd_cultivation.py:2573-2591 — 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 (19 lines × 2) backend/core/memory_extractor.py:208— backend/core/memory_extractor.py:208-226 | backend/core/summarization.py:787-805 — 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 (19 lines × 2) backend/core/proactive_intelligence.py:277— backend/core/proactive_intelligence.py:277-295 | backend/hooks/distillation_hook.py:2071-2089 — 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 (19 lines × 2) backend/skills/s_frontend-design/scripts/core.py:184— backend/skills/s_frontend-design/scripts/core.py:184-202 | backend/skills/s_web-design-review/scripts/core.py:184-202 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/core.py` and `backend/skills/s_web-design-review/scripts/core.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 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) backend/skills/s_frontend-design/scripts/core.py:207— backend/skills/s_frontend-design/scripts/core.py:207-225 | backend/skills/s_web-design-review/scripts/core.py:207-225 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/core.py` and `backend/skills/s_web-design-review/scripts/core.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 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 (19 lines × 2) backend/skills/s_frontend-design/scripts/core.py:229— backend/skills/s_frontend-design/scripts/core.py:229-247 | backend/skills/s_web-design-review/scripts/core.py:229-247 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/core.py` and `backend/skills/s_web-design-review/scripts/core.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 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 (19 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1353— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1353-1371 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1070-1088 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1353` 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 (19 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3679— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3679-3697 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3310-3328 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (13 lines × 2) backend/core/attention_authority.py:339— backend/core/attention_authority.py:339-351 | backend/core/attention_authority.py:356-368 — 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 (13 lines × 2) backend/core/ddd_entry_lifecycle.py:1241— backend/core/ddd_entry_lifecycle.py:1241-1253 | backend/core/ddd_entry_lifecycle.py:1289-1301 — 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 (13 lines × 2) backend/database/sqlite.py:536— backend/database/sqlite.py:536-548 | backend/database/sqlite.py:960-972 — 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) backend/hooks/context_health_hook.py:3307— backend/hooks/context_health_hook.py:3307-3320 | backend/hooks/context_health_hook.py:3322-3334 — 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 (13 lines × 2) backend/routers/channels.py:313— backend/routers/channels.py:313-325 | backend/routers/channels.py:363-375 — 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 `backend/routers/channels.py:313` 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 (13 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:700— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:700-712 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:614-626 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (13 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:758— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:758-770 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:672-684 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (13 lines × 2) backend/skills/s_notify/notify.py:35— backend/skills/s_notify/notify.py:35-47 | backend/skills/s_radar-todo/scripts/todo_db.py:34-49 — 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 (5 lines × 2) backend/routers/todos.py:111— backend/routers/todos.py:111-116 | backend/routers/todos.py:127-131 — 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) backend/skills/s_frontend-design/scripts/design_system.py:485— backend/skills/s_frontend-design/scripts/design_system.py:485-491 | backend/skills/s_frontend-design/scripts/design_system.py:673-677 — 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1622— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1622-1626 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1286-1290 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1622` 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) backend/core/voice_synthesize.py:228— backend/core/voice_synthesize.py:228-232 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:147-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.
Duplicated block (5 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:122— backend/skills/s_docx/ooxml/scripts/validation/pptx.py:122-126 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:122-126 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3640— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3640-3644 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3271-3275 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (5 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3706— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3706-3710 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3337-3341 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/scripts/memory_chain_probe.py:247— backend/scripts/memory_chain_probe.py:247-251 | backend/scripts/recall_chain_probe.py:273-277 — 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.
swarmai::spawn_daemon_health_watchdog (cognitive 88) desktop/src-tauri/src/lib.rs:1856— swarmai::spawn_daemon_health_watchdog has cognitive complexity 88 (threshold 15). Drivers by points: if/else 24 (59 pts), match/switch 8 (21 pts), boolean chains 7, loops 1 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
swarmai::sync_daemon_version (cognitive 33) desktop/src-tauri/src/lib.rs:1130— swarmai::sync_daemon_version has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 2 (6 pts), boolean chains 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.
swarmai::check_python_version (cognitive 27) desktop/src-tauri/src/lib.rs:2564— swarmai::check_python_version has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (26 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.
swarmai::get_fallback_path (cognitive 22) desktop/src-tauri/src/lib.rs:124— swarmai::get_fallback_path has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (8 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.
swarmai::screen_capture::prune_old_screenshots (cognitive 18) desktop/src-tauri/src/screen_capture.rs:70— swarmai::screen_capture::prune_old_screenshots has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (17 pts), 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.
swarmai::probe_daemon_health_adaptive (cognitive 17) desktop/src-tauri/src/lib.rs:962— swarmai::probe_daemon_health_adaptive has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 4 (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.
swarmai::auto_install_daemon (cognitive 17) desktop/src-tauri/src/lib.rs:1448— swarmai::auto_install_daemon has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 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.
Duplicated block (23 lines × 2) backend/core/daemon_guard.py:296— backend/core/daemon_guard.py:296-318 | desktop/resources/daemon/daemon_guard.py:296-318 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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) backend/skills/s_docx/ooxml/scripts/pack.py:20— backend/skills/s_docx/ooxml/scripts/pack.py:20-42 | backend/skills/s_pptx/ooxml/scripts/pack.py:20-42 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 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 (23 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:64— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:64-86 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:64-86 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:734— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:734-756 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:648-670 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:734` 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 (23 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2151— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2151-2173 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1803-1825 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2835— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2835-2857 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2488-2510 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2835` 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 (23 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:115— backend/skills/s_docx/ooxml/scripts/validation/redlining.py:115-137 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:115-137 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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) backend/channels/gateway.py:1575— backend/channels/gateway.py:1575-1584 | backend/core/conversation_extract.py:57-66 — 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) backend/core/plugin_manager.py:272— backend/core/plugin_manager.py:272-281 | backend/core/plugin_manager.py:382-391 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/core/plugin_manager.py:270` calls `get` and `backend/core/plugin_manager.py:380` does not — after which the two agree again for 3 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) backend/schemas/auth.py:28— backend/schemas/auth.py:28-37 | backend/schemas/auth.py:87-96 — 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 (10 lines × 2) backend/scripts/artifact_cli.py:4892— backend/scripts/artifact_cli.py:4892-4901 | backend/scripts/pipeline_analytics.py:188-197 — 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) backend/skills/s_frontend-design/scripts/design_system.py:519— backend/skills/s_frontend-design/scripts/design_system.py:519-528 | backend/skills/s_frontend-design/scripts/design_system.py:874-883 — 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 (10 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3612— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3612-3621 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3243-3252 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (10 lines × 2) backend/core/eval_service.py:75— backend/core/eval_service.py:75-84 | backend/scripts/eval_runner.py:65-77 — 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.
AC3 · Page structure· Page without a main landmark · ×6
Page without a main landmark assets/SwarmAI-Architecture-Design-Doc.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 backend/skills/s_html-artifact/templates/code-review.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 backend/skills/s_html-artifact/templates/comparison.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 backend/skills/s_html-artifact/templates/report.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 backend/skills/s_html-artifact/templates/scorecard.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 desktop/public/brain-hub-demo.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 (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:870— backend/skills/s_docx/ooxml/scripts/validation/base.py:870-904 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:873-907 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:125— backend/skills/s_docx/ooxml/scripts/validation/docx.py:125-159 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:125-159 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py:125` 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 (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:78— backend/skills/s_docx/ooxml/scripts/validation/pptx.py:78-112 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:78-112 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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 (35 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:218— backend/skills/s_docx/ooxml/scripts/validation/redlining.py:218-252 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:218-252 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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 (35 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1088— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1088-1122 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:825-859 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (35 lines × 2) backend/core/daemon_guard.py:211— backend/core/daemon_guard.py:211-245 | desktop/resources/daemon/daemon_guard.py:211-245 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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 (14 lines × 2) backend/core/ddd_cultivation.py:2287— backend/core/ddd_cultivation.py:2287-2300 | backend/hooks/improvement_writeback_hook.py:66-79 — 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 `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. Note first that the copies are not typed on the same thing: the declarations holding them bind `reason` to `str` in one and `str = ""` 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 (14 lines × 2) backend/hooks/context_health_hook.py:1090— backend/hooks/context_health_hook.py:1090-1103 | backend/hooks/context_health_hook.py:1763-1776 — 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 (14 lines × 2) backend/hooks/context_health_hook.py:1866— backend/hooks/context_health_hook.py:1866-1885 | backend/hooks/context_health_hook.py:2004-2017 — 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 `backend/hooks/context_health_hook.py:1866` 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 (14 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:309— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:309-322 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:308-321 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (14 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3662— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3662-3675 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3293-3306 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/core/ddd_cultivation.py:578— backend/core/ddd_cultivation.py:578-592 | backend/core/ingestion_gate.py:145-158 — 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 (18 lines × 2) backend/core/daemon_guard.py:162— backend/core/daemon_guard.py:162-179 | desktop/resources/daemon/daemon_guard.py:162-179 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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 (18 lines × 2) backend/core/evolution/governance_router.py:94— backend/core/evolution/governance_router.py:94-111 | backend/core/evolution/governance_router.py:304-321 — 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 (18 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:187— backend/skills/s_docx/ooxml/scripts/validation/base.py:187-204 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:187-204 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/skills/s_pptx/ooxml/scripts/validation/base.py:207` calls `isinstance` and `backend/skills/s_docx/ooxml/scripts/validation/base.py:206` does not — after which the two agree again for 3 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 (18 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1460— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1460-1477 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1171-1188 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (18 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1804— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1804-1821 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1468-1485 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (17 lines × 2) backend/core/ddd_job_registry.py:214— backend/core/ddd_job_registry.py:214-230 | backend/core/ddd_skill_registry.py:279-295 — 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 (17 lines × 2) backend/database/sqlite.py:2911— backend/database/sqlite.py:2911-2927 | backend/database/sqlite.py:2948-2964 — 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 (17 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:174— backend/skills/s_docx/ooxml/scripts/validation/docx.py:174-190 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:174-190 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 (17 lines × 2) backend/skills/s_frontend-design/scripts/core.py:108— backend/skills/s_frontend-design/scripts/core.py:108-124 | backend/skills/s_web-design-review/scripts/core.py:108-124 — before extracting anything, compare `backend/skills/s_frontend-design/scripts/core.py` and `backend/skills/s_web-design-review/scripts/core.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 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 (17 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:634— backend/skills/s_frontend-design/scripts/design_system.py:634-650 | backend/skills/s_frontend-design/scripts/design_system.py:898-914 — 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) backend/core/code_intel/route_parser.py:165— backend/core/code_intel/route_parser.py:165-179 | backend/core/code_intel/route_parser.py:220-234 — 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 (15 lines × 2) backend/hooks/context_health_hook.py:3507— backend/hooks/context_health_hook.py:3507-3521 | backend/hooks/distillation_hook.py:1932-1949 — 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 (15 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:107— backend/skills/s_docx/ooxml/scripts/validation/base.py:107-121 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:107-121 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (15 lines × 2) backend/routers/artifacts.py:97— backend/routers/artifacts.py:97-111 | backend/routers/workspace_api.py:123-137 — 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 `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 (15 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2234— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2234-2248 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1886-1900 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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.
ClassTooLong: ChatPage desktop/src/pages/ChatPage.tsx:1— ClassTooLong — 1923 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 1523 over it, 4.81× 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: useChatStreamingLifecycle desktop/src/hooks/useChatStreamingLifecycle.ts:1— ClassTooLong — 1648 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 1248 over it, 4.12× 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: MessageStore desktop/src/stores/MessageStore.ts:64— ClassTooLong — 533 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods. The bar is 400 significant lines; this is 133 over it, 1.33× 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: AuthConfigPanel desktop/src/components/settings/AuthConfigPanel.tsx:1— ClassTooLong — 415 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 15 over it, 1.04× 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 (21 lines × 2) backend/core/daemon_guard.py:104— backend/core/daemon_guard.py:104-124 | desktop/resources/daemon/daemon_guard.py:104-124 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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 (21 lines × 2) backend/core/search_manager.py:228— backend/core/search_manager.py:228-248 | backend/core/search_manager.py:307-327 — 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 `backend/core/search_manager.py:228` 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 (21 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:255— backend/skills/s_docx/ooxml/scripts/validation/redlining.py:255-275 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:255-275 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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 (21 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1872— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1872-1892 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1536-1556 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (16 lines × 2) backend/hive/provisioner.py:1260— backend/hive/provisioner.py:1260-1275 | backend/hive/provisioner.py:1436-1451 — 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 `backend/hive/provisioner.py:1260` 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) backend/routers/mcp.py:222— backend/routers/mcp.py:222-237 | backend/routers/mcp.py:259-274 — 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 `backend/routers/mcp.py:222` 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1484— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1484-1499 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1195-1210 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2132— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2132-2147 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1781-1796 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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–11 lines × 2) backend/core/memory_extractor.py:107— backend/core/memory_extractor.py:107-117 | backend/core/summarization.py:691-700 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/core/memory_extractor.py:119` calls `get` and `backend/core/summarization.py:702` 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–11 lines × 2) backend/hooks/distillation_hook.py:2548— backend/hooks/distillation_hook.py:2548-2557 | backend/hooks/distillation_hook.py:2884-2894 — 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 `backend/hooks/distillation_hook.py:2548` 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 (10–11 lines × 2) backend/skills/s_loops-health/scripts/loops_health_check.py:842— backend/skills/s_loops-health/scripts/loops_health_check.py:842-852 | backend/skills/s_loops-health/scripts/loops_health_check.py:868-877 — 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–11 lines × 2) backend/skills/s_pollinate/scripts/tts/backends/azure.py:25— backend/skills/s_pollinate/scripts/tts/backends/azure.py:25-34 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:274-284 — 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, `backend/skills/s_pollinate/scripts/tts/backends/azure.py:22` calls `get` and `backend/skills/s_pollinate/scripts/tts/backends/polly.py:272` does not — after which the two agree again for 3 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 (22 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293— backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:293 · backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx:30 — 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 (22 lines × 2 locations) desktop/src/components/common/AgentFormModal.tsx:256— desktop/src/components/common/AgentFormModal.tsx:256 · desktop/src/components/common/AgentFormModal.tsx:279 — 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 (22 lines × 2 locations) desktop/src/components/layout/JobsRunsOverlay.tsx:189— desktop/src/components/layout/JobsRunsOverlay.tsx:189 · desktop/src/components/layout/ToDoOverlay.tsx:749 — 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 (22 lines × 2 locations) desktop/src/hooks/useHealthMonitor.ts:371— desktop/src/hooks/useHealthMonitor.ts:371 · desktop/src/hooks/useHealthMonitor.ts:479 — 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.
locked_write.locked_field_modify (cyclomatic 16) backend/scripts/locked_write.py:409— locked_write.locked_field_modify 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.
locked_write.locked_field_modify (cyclomatic 16) backend/skills/s_persist/scripts/locked_write.py:409— locked_write.locked_field_modify 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.
locked_write.locked_field_modify (cyclomatic 16) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:409— locked_write.locked_field_modify 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.
locked_write.locked_field_modify (cognitive 28) backend/scripts/locked_write.py:409— locked_write.locked_field_modify has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 5 (10 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.
locked_write.locked_field_modify (cognitive 28) backend/skills/s_persist/scripts/locked_write.py:409— locked_write.locked_field_modify has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 5 (10 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.
locked_write.locked_field_modify (cognitive 28) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:409— locked_write.locked_field_modify has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 5 (10 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.
Change coupling: ThreeColumnLayout.tsx ↔ useExclusiveOverlay.ts desktop/src/components/layout/ThreeColumnLayout.tsx— `desktop/src/components/layout/ThreeColumnLayout.tsx` and `desktop/src/components/layout/useExclusiveOverlay.ts` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `317e077e` Community overlay redesign + nav card moves: (1) Community System→Work z; `5daa1961` Promote Capabilities from a Settings-tab entry to a first-class user-fac; `30de2edf` M5: delete the legacy overlay trio — OverlayHost is now the only full… — run `git show` on any of them.
Change coupling: community_api.py ↔ CommunityOverlay.tsx backend/routers/community_api.py— `backend/routers/community_api.py` and `desktop/src/components/layout/CommunityOverlay.tsx` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `96b057c3` Redesign Community overlay UI (de-box all 3 tabs, one-focus-per-tab per; `49c94be3` Community overlay redesign: rename tabs to Inbound/Watching/Outbound; In; `3acc00ab` 修 GitHub_Community 两个 Feed 可见性缺口:(1) 周报也写一份到 Knowledge/Reports/ 让 Feed t — run `git show` on any of them.
Change coupling: useCanvasAutoSurface.ts ↔ useReferencedFiles.ts desktop/src/hooks/useCanvasAutoSurface.ts— `desktop/src/hooks/useCanvasAutoSurface.ts` and `desktop/src/hooks/useReferencedFiles.ts` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `9f9fb8ae` REFACTOR (systemic, one-shot via strangler-fig): make the Canvas subsyst; `7ebdb1b1` Fix P0 Canvas tab-isolation bleed + close→collapse (run_26aa6caa); `ba9e6842` Canvas OUTPUTS PR-review surface (run_b8ea6d5c): non-coding immediate… — run `git show` on any of them.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (4 members, 50+ identical tokens) backend/core/memory_extractor.py:96— backend/core/memory_extractor.py:96-138 | REDACTED:136-160 | backend/core/summarization.py:684-720 | REDACTED:46-99 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) backend/database/sqlite.py:500— backend/database/sqlite.py:500-522 | backend/database/sqlite.py:1416-1430 | backend/database/sqlite.py:1636-1668 | backend/database/sqlite.py:1699-1715 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) backend/hooks/context_health_hook.py:3507— backend/hooks/context_health_hook.py:3507-3594 | backend/hooks/distillation_hook.py:1932-1961 | backend/hooks/distillation_hook.py:2058-2114 | backend/hooks/evolution_maintenance_hook.py:364-489 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (68 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:244— backend/skills/s_docx/ooxml/scripts/validation/pptx.py:244-311 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:244-311 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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 (68 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1375— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1375-1442 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1092-1159 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (68 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3756— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3756-3823 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3387-3454 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3756` 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 (41 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:827— backend/skills/s_docx/ooxml/scripts/validation/base.py:827-867 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:830-870 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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) backend/skills/s_docx/ooxml/scripts/validation/base.py:907— backend/skills/s_docx/ooxml/scripts/validation/base.py:907-947 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:910-950 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (41 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1982— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1982-2022 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1646-1686 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/core/daemon_guard.py:330— backend/core/daemon_guard.py:330-363 | desktop/resources/daemon/daemon_guard.py:330-363 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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) backend/core/knowledge_store.py:243— backend/core/knowledge_store.py:243-276 | REDACTED:297-330 — 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 (34 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:487— backend/skills/s_docx/ooxml/scripts/validation/base.py:487-520 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:490-523 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (30 lines × 2) backend/core/plugin_manager.py:208— backend/core/plugin_manager.py:208-237 | backend/core/plugin_manager.py:974-1003 — 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 (30 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:31— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:31-60 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:31-60 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (30 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2099— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2099-2128 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1748-1777 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (25 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:392— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:392-416 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:392-416 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (25 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3572— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3572-3596 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3203-3227 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (25 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3827— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3827-3851 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3458-3482 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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–13 lines × 2) backend/core/claude_environment.py:101— backend/core/claude_environment.py:101-113 | backend/core/claude_environment.py:124-135 — 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 (12–13 lines × 2) backend/core/ddd_packager.py:1511— backend/core/ddd_packager.py:1511-1523 | backend/core/ddd_packager.py:1679-1690 — 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 `backend/core/ddd_packager.py:1511` 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–13 lines × 2) backend/routers/workspace_api.py:1089— backend/routers/workspace_api.py:1089-1101 | backend/routers/workspace_api.py:1107-1118 — 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 `backend/routers/workspace_api.py:1089` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 3) backend/core/proactive_intelligence.py:276— backend/core/proactive_intelligence.py:276-287 | backend/hooks/distillation_hook.py:395-406 | backend/hooks/distillation_hook.py:2070-2081 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `backend/core/proactive_intelligence.py:276` 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) backend/core/streaming_orchestrator.py:1459— backend/core/streaming_orchestrator.py:1459-1470 | backend/core/streaming_orchestrator.py:1633-1644 | backend/core/streaming_orchestrator.py:1689-1700 — 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 (12 lines × 3) backend/routers/mcp.py:156— backend/routers/mcp.py:156-167 | backend/routers/mcp.py:227-238 | backend/routers/mcp.py:264-275 — 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. 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 × 3) backend/core/mcp_config_loader.py:668— backend/core/mcp_config_loader.py:668-678 | backend/core/mcp_config_loader.py:706-716 | backend/routers/mcp.py:59-69 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11 lines × 3) backend/core/security_hooks.py:346— backend/core/security_hooks.py:346-356 | backend/core/security_hooks.py:685-695 | backend/core/security_hooks.py:1611-1621 — 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. 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 × 3) backend/skills/s_frontend-design/scripts/design_system.py:715— backend/skills/s_frontend-design/scripts/design_system.py:715-725 | backend/skills/s_frontend-design/scripts/design_system.py:748-758 | backend/skills/s_frontend-design/scripts/design_system.py:808-818 — 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 (6 lines × 3) backend/routers/hive.py:495— backend/routers/hive.py:495-500 | backend/routers/hive.py:517-522 | backend/routers/hive.py:541-547 — 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 (6 lines × 3) backend/scripts/artifact_cli.py:5821— backend/scripts/artifact_cli.py:5821-5826 | backend/scripts/artifact_cli.py:5903-5908 | backend/scripts/artifact_cli.py:5947-5952 — 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 (6 lines × 3) backend/scripts/artifact_cli.py:5931— backend/scripts/artifact_cli.py:5931-5936 | backend/scripts/artifact_cli.py:5952-5957 | backend/scripts/artifact_cli.py:5962-5967 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/scripts/artifact_cli.py:5958` calls `add_argument` and `backend/scripts/artifact_cli.py:5968` 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 (23 lines × 2 locations) desktop/src/hooks/useChatStreamingLifecycle.ts:546— desktop/src/hooks/useChatStreamingLifecycle.ts:546 · desktop/src/hooks/useChatStreamingLifecycle.ts:577 — 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 (23 lines × 2 locations) desktop/src/pages/SkillsPage.tsx:946— desktop/src/pages/SkillsPage.tsx:946 · desktop/src/pages/SkillsPage.tsx:975 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (23 lines × 2 locations) desktop/src/pages/chat/components/TSCCPanel.tsx:125— desktop/src/pages/chat/components/TSCCPanel.tsx:125 · desktop/src/pages/chat/components/TSCCPanel.tsx:202 — 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 (17 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134— backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134 · backend/skills/s_pollinate/templates/remotion/components/animations.tsx: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.
Duplicated block (17 lines × 2 locations) desktop/src/components/common/FileEditorCore.tsx:1644— desktop/src/components/common/FileEditorCore.tsx:1644 · desktop/src/components/common/FileEditorCore.tsx:1674 — 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 (17 lines × 2 locations) desktop/src/components/layout/CMBrainOverlay.tsx:899— desktop/src/components/layout/CMBrainOverlay.tsx:899 · desktop/src/components/layout/CMBrainOverlay.tsx:939 — 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 (16 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/Video.tsx:118— backend/skills/s_pollinate/templates/remotion/Video.tsx:118 · backend/skills/s_pollinate/templates/remotion/Video.tsx:258 — all 2 copies are in the same file, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents.
Duplicated block (16 lines × 2 locations) desktop/src/hooks/streaming-machine.ts:134— desktop/src/hooks/streaming-machine.ts:134 · desktop/src/hooks/streaming-machine.ts:241 — 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 (16 lines × 2 locations) desktop/src/hooks/useUnifiedAttachments.ts:167— desktop/src/hooks/useUnifiedAttachments.ts:167 · desktop/src/hooks/useUnifiedAttachments.ts:301 — 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.
AC3 · Page structure· Data table has no header cells · ×2
Data table has no header cells desktop/src/components/layout/BottomBar.tsx:41— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells desktop/src/pages/EvalDashboard.tsx:624— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
ai_ready_helpers.extract_import_graph (cyclomatic 40) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2388— ai_ready_helpers.extract_import_graph 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.
ai_ready_helpers.extract_import_graph (cyclomatic 40) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2041— ai_ready_helpers.extract_import_graph 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.
swarmai::spawn_daemon_health_watchdog (cyclomatic 37) desktop/src-tauri/src/lib.rs:1856— swarmai::spawn_daemon_health_watchdog 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.
swarmai::sync_daemon_version (cyclomatic 17) desktop/src-tauri/src/lib.rs:1130— swarmai::sync_daemon_version 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.
ai_ready_helpers.validate_code_intel_json (cyclomatic 34) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:113— ai_ready_helpers.validate_code_intel_json 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.
ai_ready_helpers.validate_code_intel_json (cyclomatic 34) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:113— ai_ready_helpers.validate_code_intel_json 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.
locked_write.locked_read_modify_write (cyclomatic 25) backend/scripts/locked_write.py:515— locked_write.locked_read_modify_write 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.
locked_write.locked_read_modify_write (cyclomatic 25) backend/skills/s_persist/scripts/locked_write.py:515— locked_write.locked_read_modify_write 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.
BaseSchemaValidator.validate_content_types (cyclomatic 25) backend/skills/s_docx/ooxml/scripts/validation/base.py:522— BaseSchemaValidator.validate_content_types 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.
BaseSchemaValidator.validate_content_types (cyclomatic 25) backend/skills/s_pptx/ooxml/scripts/validation/base.py:525— BaseSchemaValidator.validate_content_types 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.
BaseSchemaValidator.validate_file_references (cyclomatic 23) backend/skills/s_docx/ooxml/scripts/validation/base.py:277— BaseSchemaValidator.validate_file_references 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.
BaseSchemaValidator.validate_file_references (cyclomatic 23) backend/skills/s_pptx/ooxml/scripts/validation/base.py:280— BaseSchemaValidator.validate_file_references 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.
BaseSchemaValidator.validate_all_relationship_ids (cyclomatic 20) backend/skills/s_docx/ooxml/scripts/validation/base.py:388— BaseSchemaValidator.validate_all_relationship_ids 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.
BaseSchemaValidator.validate_all_relationship_ids (cyclomatic 20) backend/skills/s_pptx/ooxml/scripts/validation/base.py:391— BaseSchemaValidator.validate_all_relationship_ids 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.
ai_ready_helpers.check_domain_referential_integrity (cyclomatic 20) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:250— ai_ready_helpers.check_domain_referential_integrity 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.
ai_ready_helpers.check_domain_referential_integrity (cyclomatic 20) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:249— ai_ready_helpers.check_domain_referential_integrity 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.
daemon_guard._main (cyclomatic 19) backend/core/daemon_guard.py:413— daemon_guard._main 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.
daemon_guard._main (cyclomatic 19) desktop/resources/daemon/daemon_guard.py:413— daemon_guard._main 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.
ai_ready_helpers._validate_v3_domain_layer (cyclomatic 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:213— ai_ready_helpers._validate_v3_domain_layer 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.
ai_ready_helpers._validate_v3_domain_layer (cyclomatic 19) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:212— ai_ready_helpers._validate_v3_domain_layer 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.
ai_ready_helpers.incremental_update (cyclomatic 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2746— ai_ready_helpers.incremental_update 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.
ai_ready_helpers.incremental_update (cyclomatic 19) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2399— ai_ready_helpers.incremental_update 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.
ai_ready_helpers.prioritized_file_list (cyclomatic 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3173— ai_ready_helpers.prioritized_file_list 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.
ai_ready_helpers.prioritized_file_list (cyclomatic 19) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2826— ai_ready_helpers.prioritized_file_list 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.
ai_ready_helpers.eval_spec_details (cyclomatic 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1374— ai_ready_helpers.eval_spec_details 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.
ai_ready_helpers.eval_spec_details (cyclomatic 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1091— ai_ready_helpers.eval_spec_details 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.
ai_ready_helpers.score_equivalence (cyclomatic 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1803— ai_ready_helpers.score_equivalence 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.
ai_ready_helpers.score_equivalence (cyclomatic 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1467— ai_ready_helpers.score_equivalence 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.
ai_ready_helpers.generate_learning_tour (cyclomatic 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2862— ai_ready_helpers.generate_learning_tour 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.
ai_ready_helpers.generate_learning_tour (cyclomatic 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2515— ai_ready_helpers.generate_learning_tour 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.
ai_ready_helpers.run_multi_package (cyclomatic 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2948— ai_ready_helpers.run_multi_package 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.
ai_ready_helpers.run_multi_package (cyclomatic 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2601— ai_ready_helpers.run_multi_package 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.
ai_ready_helpers.check_anchor_accounting (cyclomatic 17) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:773— ai_ready_helpers.check_anchor_accounting 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.
ai_ready_helpers.check_anchor_accounting (cyclomatic 17) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:687— ai_ready_helpers.check_anchor_accounting 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.
BaseSchemaValidator.validate_against_xsd (cyclomatic 16) backend/skills/s_docx/ooxml/scripts/validation/base.py:688— BaseSchemaValidator.validate_against_xsd 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.
BaseSchemaValidator.validate_against_xsd (cyclomatic 16) backend/skills/s_pptx/ooxml/scripts/validation/base.py:691— BaseSchemaValidator.validate_against_xsd 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.
PPTXSchemaValidator.validate_notes_slide_references (cyclomatic 16) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:243— PPTXSchemaValidator.validate_notes_slide_references 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.
PPTXSchemaValidator.validate_notes_slide_references (cyclomatic 16) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:243— PPTXSchemaValidator.validate_notes_slide_references 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.
ai_ready_helpers._collect_doc_file_anchors (cyclomatic 16) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:391— ai_ready_helpers._collect_doc_file_anchors 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.
ai_ready_helpers._collect_doc_file_anchors (cyclomatic 16) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:391— ai_ready_helpers._collect_doc_file_anchors 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.
ai_ready_helpers.render_agents_md (cyclomatic 16) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2270— ai_ready_helpers.render_agents_md 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.
ai_ready_helpers.render_agents_md (cyclomatic 16) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1922— ai_ready_helpers.render_agents_md 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.
ai_ready_helpers.extract_import_graph (cognitive 86) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2388— ai_ready_helpers.extract_import_graph has cognitive complexity 86 (threshold 15). Drivers by points: if/else 22 (54 pts), ternaries 5 (14 pts), loops 9 (13 pts), boolean chains 3, error handling 1 (2 pts) (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.
ai_ready_helpers.extract_import_graph (cognitive 86) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2041— ai_ready_helpers.extract_import_graph has cognitive complexity 86 (threshold 15). Drivers by points: if/else 22 (54 pts), ternaries 5 (14 pts), loops 9 (13 pts), boolean chains 3, error handling 1 (2 pts) (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.
BaseSchemaValidator.validate_all_relationship_ids (cognitive 55) backend/skills/s_docx/ooxml/scripts/validation/base.py:388— BaseSchemaValidator.validate_all_relationship_ids has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (33 pts), ternaries 3 (13 pts), loops 4 (7 pts), error handling 1 (2 pts) (nesting depth added 36). 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.
BaseSchemaValidator.validate_all_relationship_ids (cognitive 55) backend/skills/s_pptx/ooxml/scripts/validation/base.py:391— BaseSchemaValidator.validate_all_relationship_ids has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (33 pts), ternaries 3 (13 pts), loops 4 (7 pts), error handling 1 (2 pts) (nesting depth added 36). 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.
compressDOM::(anonymous)::compress (cognitive 54) backend/skills/s_browser-agent/browser-agent.mjs:199— compressDOM::(anonymous)::compress has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 8, ternaries 2 (4 pts), loops 2 (3 pts), error handling 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.
compressDOM::(anonymous)::buildSelector (cognitive 17) backend/skills/s_browser-agent/browser-agent.mjs:164— compressDOM::(anonymous)::buildSelector has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, 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.
ai_ready_helpers.validate_code_intel_json (cognitive 50) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:113— ai_ready_helpers.validate_code_intel_json has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 7 (13 pts), boolean chains 8 (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.
ai_ready_helpers.validate_code_intel_json (cognitive 50) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:113— ai_ready_helpers.validate_code_intel_json has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 7 (13 pts), boolean chains 8 (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.
BaseSchemaValidator.validate_file_references (cognitive 46) backend/skills/s_docx/ooxml/scripts/validation/base.py:277— BaseSchemaValidator.validate_file_references has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 6 (11 pts), error handling 2 (6 pts), boolean chains 3 (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.
BaseSchemaValidator.validate_file_references (cognitive 46) backend/skills/s_pptx/ooxml/scripts/validation/base.py:280— BaseSchemaValidator.validate_file_references has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 6 (11 pts), error handling 2 (6 pts), boolean chains 3 (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.
locked_write.locked_read_modify_write (cognitive 45) backend/scripts/locked_write.py:515— locked_write.locked_read_modify_write has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (27 pts), error handling 7 (12 pts), ternaries 1 (3 pts), boolean chains 2, 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.
locked_write.locked_read_modify_write (cognitive 45) backend/skills/s_persist/scripts/locked_write.py:515— locked_write.locked_read_modify_write has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (27 pts), error handling 7 (12 pts), ternaries 1 (3 pts), boolean chains 2, 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.
BaseSchemaValidator.validate_content_types (cognitive 39) backend/skills/s_docx/ooxml/scripts/validation/base.py:522— BaseSchemaValidator.validate_content_types has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 5 (6 pts), boolean chains 3, error handling 2 (3 pts), 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.
BaseSchemaValidator.validate_content_types (cognitive 39) backend/skills/s_pptx/ooxml/scripts/validation/base.py:525— BaseSchemaValidator.validate_content_types has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 5 (6 pts), boolean chains 3, error handling 2 (3 pts), 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.
PPTXSchemaValidator.validate_notes_slide_references (cognitive 34) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:243— PPTXSchemaValidator.validate_notes_slide_references has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 5 (9 pts), 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.
PPTXSchemaValidator.validate_notes_slide_references (cognitive 34) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:243— PPTXSchemaValidator.validate_notes_slide_references has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 5 (9 pts), 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.
DOCXSchemaValidator.validate_whitespace_preservation (cognitive 33) backend/skills/s_docx/ooxml/scripts/validation/docx.py:72— DOCXSchemaValidator.validate_whitespace_preservation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (18 pts), ternaries 1 (6 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (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.
DOCXSchemaValidator.validate_whitespace_preservation (cognitive 33) backend/skills/s_pptx/ooxml/scripts/validation/docx.py:72— DOCXSchemaValidator.validate_whitespace_preservation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (18 pts), ternaries 1 (6 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (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.
ai_ready_helpers.generate_learning_tour (cognitive 32) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2862— ai_ready_helpers.generate_learning_tour has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 7 (9 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.
ai_ready_helpers.generate_learning_tour (cognitive 32) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2515— ai_ready_helpers.generate_learning_tour has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 7 (9 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.
ai_ready_helpers._validate_v3_domain_layer (cognitive 31) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:213— ai_ready_helpers._validate_v3_domain_layer has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 7 (10 pts), ternaries 3, 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.
ai_ready_helpers._validate_v3_domain_layer (cognitive 31) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:212— ai_ready_helpers._validate_v3_domain_layer has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 7 (10 pts), ternaries 3, 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.
PPTXSchemaValidator.validate_uuid_ids (cognitive 30) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:77— PPTXSchemaValidator.validate_uuid_ids has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (8 pts), error handling 1 (2 pts), boolean chains 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.
PPTXSchemaValidator.validate_uuid_ids (cognitive 30) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:77— PPTXSchemaValidator.validate_uuid_ids has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (8 pts), error handling 1 (2 pts), boolean chains 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.
ai_ready_helpers.run_multi_package (cognitive 30) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2948— ai_ready_helpers.run_multi_package has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 6 (11 pts), boolean chains 2, error handling 1 (2 pts), 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.
ai_ready_helpers.run_multi_package (cognitive 30) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2601— ai_ready_helpers.run_multi_package has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 6 (11 pts), boolean chains 2, error handling 1 (2 pts), 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.
ai_ready_helpers.render_agents_md (cognitive 29) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2270— ai_ready_helpers.render_agents_md has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (9 pts), ternaries 1 (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.
ai_ready_helpers.render_agents_md (cognitive 29) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1922— ai_ready_helpers.render_agents_md has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (9 pts), ternaries 1 (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.
daemon_guard._main (cognitive 28) backend/core/daemon_guard.py:413— daemon_guard._main has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 10 (13 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.
daemon_guard._main (cognitive 28) desktop/resources/daemon/daemon_guard.py:413— daemon_guard._main has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 10 (13 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.
RedliningValidator._remove_claude_tracked_changes (cognitive 28) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:217— RedliningValidator._remove_claude_tracked_changes has cognitive complexity 28 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 3 (10 pts), boolean chains 2 (nesting depth added 15). 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.
RedliningValidator._remove_claude_tracked_changes (cognitive 28) backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:217— RedliningValidator._remove_claude_tracked_changes has cognitive complexity 28 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 3 (10 pts), boolean chains 2 (nesting depth added 15). 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.
ai_ready_helpers.check_domain_referential_integrity (cognitive 28) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:250— ai_ready_helpers.check_domain_referential_integrity has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, loops 4 (5 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.
ai_ready_helpers.check_domain_referential_integrity (cognitive 28) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:249— ai_ready_helpers.check_domain_referential_integrity has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, loops 4 (5 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.
ai_ready_helpers.extract_human_spec_blocks (cognitive 26) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1652— ai_ready_helpers.extract_human_spec_blocks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (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.
ai_ready_helpers.extract_human_spec_blocks (cognitive 26) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1316— ai_ready_helpers.extract_human_spec_blocks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (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.
PPTXSchemaValidator.validate_slide_layout_ids (cognitive 25) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:128— PPTXSchemaValidator.validate_slide_layout_ids has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (7 pts), error handling 1 (2 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.
PPTXSchemaValidator.validate_slide_layout_ids (cognitive 25) backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:128— PPTXSchemaValidator.validate_slide_layout_ids has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (7 pts), error handling 1 (2 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.
RedliningValidator._get_git_word_diff (cognitive 23) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:139— RedliningValidator._get_git_word_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 2, error handling 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.
RedliningValidator._get_git_word_diff (cognitive 23) backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:139— RedliningValidator._get_git_word_diff has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 2, error handling 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.
ai_ready_helpers.score_equivalence (cognitive 23) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1803— ai_ready_helpers.score_equivalence has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 3, 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.
ai_ready_helpers.score_equivalence (cognitive 23) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1467— ai_ready_helpers.score_equivalence has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 3, 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.
BaseSchemaValidator.validate_against_xsd (cognitive 22) backend/skills/s_docx/ooxml/scripts/validation/base.py:688— BaseSchemaValidator.validate_against_xsd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (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.
BaseSchemaValidator.validate_against_xsd (cognitive 22) backend/skills/s_pptx/ooxml/scripts/validation/base.py:691— BaseSchemaValidator.validate_against_xsd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (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.
ai_ready_helpers._parse_git_log (cognitive 22) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1981— ai_ready_helpers._parse_git_log has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 1 (nesting depth added 12). 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.
ai_ready_helpers._parse_git_log (cognitive 22) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1645— ai_ready_helpers._parse_git_log has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 1 (nesting depth added 12). 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.
ai_ready_helpers.prioritized_file_list (cognitive 22) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3173— ai_ready_helpers.prioritized_file_list has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, error handling 2, loops 1 (2 pts), ternaries 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.
ai_ready_helpers.prioritized_file_list (cognitive 22) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2826— ai_ready_helpers.prioritized_file_list has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, error handling 2, loops 1 (2 pts), ternaries 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.
ai_ready_helpers._collect_doc_file_anchors (cognitive 21) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:391— ai_ready_helpers._collect_doc_file_anchors has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 5 (7 pts), boolean chains 6 (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.
ai_ready_helpers._collect_doc_file_anchors (cognitive 21) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:391— ai_ready_helpers._collect_doc_file_anchors has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 5 (7 pts), boolean chains 6 (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.
ai_ready_helpers._iter_domain_assertions (cognitive 21) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1352— ai_ready_helpers._iter_domain_assertions has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (13 pts), boolean chains 4, if/else 2 (4 pts) (nesting depth added 8). 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.
ai_ready_helpers._iter_domain_assertions (cognitive 21) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1069— ai_ready_helpers._iter_domain_assertions has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (13 pts), boolean chains 4, if/else 2 (4 pts) (nesting depth added 8). 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.
DOCXSchemaValidator.validate_deletions (cognitive 20) backend/skills/s_docx/ooxml/scripts/validation/docx.py:124— DOCXSchemaValidator.validate_deletions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (5 pts), ternaries 1 (4 pts), 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.
DOCXSchemaValidator.validate_deletions (cognitive 20) backend/skills/s_pptx/ooxml/scripts/validation/docx.py:124— DOCXSchemaValidator.validate_deletions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (5 pts), ternaries 1 (4 pts), 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.
ai_ready_helpers.check_anchor_accounting (cognitive 20) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:773— ai_ready_helpers.check_anchor_accounting has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 3, 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.
ai_ready_helpers.check_anchor_accounting (cognitive 20) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:687— ai_ready_helpers.check_anchor_accounting has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 3, 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.
ai_ready_helpers.eval_spec_details (cognitive 20) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1374— ai_ready_helpers.eval_spec_details has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), ternaries 4, loops 2 (3 pts) (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.
ai_ready_helpers.eval_spec_details (cognitive 20) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1091— ai_ready_helpers.eval_spec_details has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), ternaries 4, loops 2 (3 pts) (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.
DOCXSchemaValidator.validate_insertions (cognitive 19) backend/skills/s_docx/ooxml/scripts/validation/docx.py:216— DOCXSchemaValidator.validate_insertions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (3 pts), 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.
DOCXSchemaValidator.validate_insertions (cognitive 19) backend/skills/s_pptx/ooxml/scripts/validation/docx.py:216— DOCXSchemaValidator.validate_insertions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 3 (5 pts), boolean chains 3, ternaries 1 (3 pts), 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.
ai_ready_helpers._render_step_spec_table (cognitive 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1483— ai_ready_helpers._render_step_spec_table has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 2 (4 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.
ai_ready_helpers._render_step_spec_table (cognitive 19) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1194— ai_ready_helpers._render_step_spec_table has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 2 (4 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.
ai_ready_helpers._build_file_tree (cognitive 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2098— ai_ready_helpers._build_file_tree has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (2 pts), boolean chains 1, 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.
ai_ready_helpers._build_file_tree (cognitive 19) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1747— ai_ready_helpers._build_file_tree has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (2 pts), boolean chains 1, 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.
ai_ready_helpers._language_mix (cognitive 19) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3723— ai_ready_helpers._language_mix has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 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.
ai_ready_helpers._language_mix (cognitive 19) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3354— ai_ready_helpers._language_mix has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (3 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.
ai_ready_helpers.parse_git_gotchas (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1903— ai_ready_helpers.parse_git_gotchas has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 5 (6 pts), ternaries 1 (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.
ai_ready_helpers.parse_git_gotchas (cognitive 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1567— ai_ready_helpers.parse_git_gotchas has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 5 (6 pts), ternaries 1 (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.
ai_ready_helpers.incremental_update (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2746— ai_ready_helpers.incremental_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 4, error handling 4, ternaries 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.
ai_ready_helpers.incremental_update (cognitive 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2399— ai_ready_helpers.incremental_update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 4, error handling 4, ternaries 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.
ai_ready_helpers._expand_globs (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3571— ai_ready_helpers._expand_globs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 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.
ai_ready_helpers._expand_globs (cognitive 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3202— ai_ready_helpers._expand_globs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 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.
ai_ready_helpers.detect_package_roots (cognitive 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3755— ai_ready_helpers.detect_package_roots has cognitive complexity 18 (threshold 15). Drivers by points: error handling 2 (5 pts), if/else 3 (5 pts), loops 3 (4 pts), ternaries 2 (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.
ai_ready_helpers.detect_package_roots (cognitive 18) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3386— ai_ready_helpers.detect_package_roots has cognitive complexity 18 (threshold 15). Drivers by points: error handling 2 (5 pts), if/else 3 (5 pts), loops 3 (4 pts), ternaries 2 (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.
ai_ready_helpers.merge_code_intel (cognitive 16) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1042— ai_ready_helpers.merge_code_intel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 2, 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.
ai_ready_helpers.merge_code_intel (cognitive 16) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:778— ai_ready_helpers.merge_code_intel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 2, 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.
Duplicated block (81 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2625— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2625-2705 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2278-2358 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (81 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2863— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2863-2943 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2516-2596 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (75 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1904— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1904-1978 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1568-1642 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (75 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2747— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2747-2821 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2400-2474 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (73 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:129— backend/skills/s_docx/ooxml/scripts/validation/pptx.py:129-201 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:129-201 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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 (73 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:420— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:420-492 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:420-492 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (50 lines × 2) backend/scripts/locked_write.py:621— backend/scripts/locked_write.py:621-670 | backend/skills/s_persist/scripts/locked_write.py:621-670 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3370— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3370-3419 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3020-3069 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:29— backend/skills/s_docx/ooxml/scripts/validation/pptx.py:29-75 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:29-75 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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 (47 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1822— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1822-1868 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1486-1532 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (46 lines × 2) backend/core/knowledge_store.py:290— backend/core/knowledge_store.py:290-335 | REDACTED:344-389 — 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 (46 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:25— backend/skills/s_docx/ooxml/scripts/validation/docx.py:25-70 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:25-70 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 (44 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1712— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1712-1755 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1376-1419 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (44 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2177— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2177-2220 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1829-1872 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (43 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1128— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1128-1170 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:865-907 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1242— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1242-1284 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:979-1021 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (40 lines × 2) backend/routers/chat.py:768— backend/routers/chat.py:768-807 | backend/routers/chat.py:1478-1517 — 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 `backend/routers/chat.py:768` 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 (40 lines × 2) backend/skills/s_docx/ooxml/scripts/pack.py:91— backend/skills/s_docx/ooxml/scripts/pack.py:91-130 | backend/skills/s_pptx/ooxml/scripts/pack.py:91-130 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 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 (38 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:73— backend/skills/s_docx/ooxml/scripts/validation/docx.py:73-110 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:73-110 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py:73` 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 (38 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/pptx.py:204— backend/skills/s_docx/ooxml/scripts/validation/pptx.py:204-241 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:204-241 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/pptx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/pptx.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 298 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 (33–37 lines × 2) backend/core/knowledge_store.py:338— backend/core/knowledge_store.py:338-374 | REDACTED:392-424 — 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 `backend/core/knowledge_store.py:338` 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 (33–37 lines × 2) backend/core/knowledge_store.py:535— backend/core/knowledge_store.py:535-571 | REDACTED:596-628 — 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 (32 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:264— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:264-295 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:263-294 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (32 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2559— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2559-2590 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2212-2243 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (31 lines × 2) backend/core/chat_thread_manager.py:475— backend/core/chat_thread_manager.py:475-505 | backend/core/chat_thread_manager.py:549-581 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `data` to `ChatMessageCreate` in one and `ThreadSummaryCreate` 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 (31 lines × 2) backend/core/retry_manager.py:128— backend/core/retry_manager.py:128-158 | backend/core/retry_manager.py:233-263 — 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 `backend/core/retry_manager.py:128` 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 (29 lines × 2) backend/core/session_hooks.py:522— backend/core/session_hooks.py:522-550 | backend/core/session_hooks.py:577-605 — 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 (29 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3724— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3724-3752 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3355-3383 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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) backend/skills/s_docx/ooxml/scripts/validation/base.py:157— backend/skills/s_docx/ooxml/scripts/validation/base.py:157-184 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:157-184 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1773— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1773-1800 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1437-1464 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (26 lines × 2) backend/jobs/adapters/eastmoney_market.py:99— backend/jobs/adapters/eastmoney_market.py:99-124 | backend/jobs/adapters/eastmoney_market.py:156-181 — 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 (26 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3143— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3143-3168 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2796-2821 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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–23 lines × 2) backend/channels/gateway.py:1954— backend/channels/gateway.py:1954-1976 | backend/channels/gateway.py:2058-2077 — 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 (20–23 lines × 2) REDACTED:271— REDACTED:271-293 | REDACTED:358-377 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:266` calls `get`, `update` and `REDACTED:357` 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 (19–23 lines × 2) backend/core/proactive_intelligence.py:991— backend/core/proactive_intelligence.py:991-1009 | backend/core/proactive_intelligence.py:1114-1136 — 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 (19–23 lines × 2) scripts/smoke_e2e.py:163— scripts/smoke_e2e.py:163-185 | scripts/smoke_e2e.py:488-506 — 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 (18–20 lines × 2) backend/core/ddd_entry_lifecycle.py:1827— backend/core/ddd_entry_lifecycle.py:1827-1846 | backend/core/ddd_entry_lifecycle.py:1879-1896 — 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 (18–20 lines × 2) backend/core/session_unit.py:2456— backend/core/session_unit.py:2456-2475 | backend/core/session_unit.py:4774-4791 — 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 `backend/core/session_unit.py:2456` 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 (14–16 lines × 3) backend/core/context_injector.py:331— backend/core/context_injector.py:331-346 | backend/core/context_injector.py:369-384 | backend/core/context_injector.py:405-418 — 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. 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/core/context_injector.py:404` calls `set` and `backend/core/context_injector.py:330` does not — after which the two agree again for 3 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 (14–16 lines × 3) backend/jobs/handlers/ddd_refresh.py:248— backend/jobs/handlers/ddd_refresh.py:248-261 | backend/jobs/handlers/memory_health.py:473-486 | backend/jobs/handlers/skill_proposer.py:291-306 — 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 `backend/jobs/handlers/ddd_refresh.py:248` 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–15 lines × 3) backend/database/sqlite.py:2907— backend/database/sqlite.py:2907-2921 | backend/database/sqlite.py:2993-3005 | backend/database/sqlite.py:3024-3036 — 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 (13–15 lines × 3) backend/hive/provisioner.py:1008— backend/hive/provisioner.py:1008-1020 | backend/hive/provisioner.py:1050-1062 | backend/hive/provisioner.py:1106-1120 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–14 lines × 2) backend/channels/streaming.py:312— backend/channels/streaming.py:312-325 | backend/channels/streaming.py:365-376 — 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–14 lines × 2) backend/core/artifact_registry.py:446— backend/core/artifact_registry.py:446-459 | backend/jobs/config_io.py:120-131 — 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 `backend/jobs/config_io.py:120` 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–14 lines × 2) backend/core/evolution/correction_tracker.py:134— backend/core/evolution/correction_tracker.py:134-147 | backend/core/evolution/correction_tracker.py:150-162 — 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 (13–14 lines × 2) backend/skills/s_docx/scripts/document.py:404— backend/skills/s_docx/scripts/document.py:404-416 | backend/skills/s_docx/scripts/document.py:507-520 — 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–12 lines × 2) backend/core/session_router.py:3694— backend/core/session_router.py:3694-3705 | backend/core/session_router.py:3724-3733 — 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–12 lines × 2) backend/routers/eval.py:195— backend/routers/eval.py:195-206 | backend/routers/eval.py:229-238 — 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 × 3) backend/core/summarization.py:532— backend/core/summarization.py:532-538 | backend/hooks/skill_metrics_hook.py:184-190 | backend/hooks/skill_metrics_hook.py:235-241 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 3) backend/jobs/scheduler.py:524— backend/jobs/scheduler.py:524-530 | backend/jobs/scheduler.py:554-560 | backend/jobs/scheduler.py:572-578 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/jobs/scheduler.py:570` calls `set` and `backend/jobs/scheduler.py:549` does not — after which the two agree again for 3 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 × 4) backend/core/memory_extractor.py:113— backend/core/memory_extractor.py:113-118 | REDACTED:151-156 | backend/core/summarization.py:696-701 | REDACTED:79-84 — 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 4 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/core/memory_extractor.py:119` calls `get` and `REDACTED:157` 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 (6 lines × 4) backend/skills/s_pollinate/scripts/check_rpv.py:25— backend/skills/s_pollinate/scripts/check_rpv.py:25-30 | backend/skills/s_pollinate/scripts/check_rpv.py:67-72 | backend/skills/s_pollinate/scripts/check_rpv.py:143-148 | backend/skills/s_pollinate/scripts/check_rpv.py:171-178 — all 4 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. 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, `backend/skills/s_pollinate/scripts/check_rpv.py:31` calls `get` and `backend/skills/s_pollinate/scripts/check_rpv.py:149` 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.
R10 · Code Duplication· Duplicated block with local edits (37 matched lines × 2 locations) · ×2
Duplicated block with local edits (37 matched lines × 2 locations) desktop/src/components/common/CommentPopover.tsx:107— desktop/src/components/common/CommentPopover.tsx:107 · desktop/src/components/common/FileEditorCore.tsx:270 — the two spans are one implementation copied and then locally edited — 198 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 with local edits (37 matched lines × 2 locations) desktop/src/services/tasks.ts:18— desktop/src/services/tasks.ts:18 · desktop/src/services/todos.ts:31 — the two spans are one implementation copied and then locally edited — 345 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 (19 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135— backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:135 · backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:166 — 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) desktop/src/components/common/FileEditorCore.tsx:1380— desktop/src/components/common/FileEditorCore.tsx:1380 · desktop/src/components/common/FileEditorCore.tsx:1399 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (18 lines × 2 locations) desktop/src/hooks/useChatStreamingLifecycle.ts:483— desktop/src/hooks/useChatStreamingLifecycle.ts:483 · desktop/src/hooks/useChatStreamingLifecycle.ts:504 — 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 (18 lines × 2 locations) desktop/src/services/tscc.ts:133— desktop/src/services/tscc.ts:133 · desktop/src/services/tscc.ts:169 — 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) backend/skills/s_pollinate/templates/remotion/Video.tsx:152— backend/skills/s_pollinate/templates/remotion/Video.tsx:152 · backend/skills/s_pollinate/templates/remotion/Video.tsx:202 — 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) desktop/src/components/layout/CMBrainOverlay.tsx:328— desktop/src/components/layout/CMBrainOverlay.tsx:328 · desktop/src/components/layout/CMBrainOverlay.tsx:1004 — 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.
Dead file (~12 LoC) desktop/src/components/settings/MCPServersTab.tsx— no import path from any entry point (60 application, 13 tooling, 253 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 (~12 LoC) desktop/src/stores/index.ts— no import path from any entry point (60 application, 13 tooling, 253 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
AC1 · Text alternatives· <video> without a captions track · ×1
<video> without a captions track desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:58— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
AC3 · Page structure· Heading level jumps from h2 to h4 · ×1
Heading level jumps from h2 to h4 assets/SwarmAI-Architecture-Design-Doc.html:2896— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 186 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.
useChatStreamingLifecycle.useChatStreamingLifecycle (cyclomatic 587) desktop/src/hooks/useChatStreamingLifecycle.ts:1030— useChatStreamingLifecycle.useChatStreamingLifecycle has cyclomatic complexity 587 (threshold 15). Most of this is not in the body itself: 8 of the 587 points are its own statements and the rest belongs to 60 function literals inside it that branch (lines 2302, 1235, 3756, …). 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.
ChatPage.ChatPage (cyclomatic 470) desktop/src/pages/ChatPage.tsx:129— ChatPage.ChatPage has cyclomatic complexity 470 (threshold 15). Of this number, 20 points are the body's own statements and 450 belong to 87 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.
FileEditorCore.FileEditorCore (cyclomatic 220) desktop/src/components/common/FileEditorCore.tsx:606— FileEditorCore.FileEditorCore has cyclomatic complexity 220 (threshold 15). Of this number, 94 points are the body's own statements and 126 belong to 47 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.
pipeline_validator.validate (cyclomatic 214) backend/scripts/pipeline_validator.py:2603— pipeline_validator.validate has cyclomatic complexity 214 (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.
StreamingOrchestrator._read_formatted_response (cyclomatic 190) backend/core/streaming_orchestrator.py:525— StreamingOrchestrator._read_formatted_response has cyclomatic complexity 190 (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.
artifact_cli.cmd_run_report (cyclomatic 177) backend/scripts/artifact_cli.py:3992— artifact_cli.cmd_run_report has cyclomatic complexity 177 (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.
ChatInput.ChatInput (cyclomatic 161) desktop/src/pages/chat/components/ChatInput.tsx:164— ChatInput.ChatInput has cyclomatic complexity 161 (threshold 15). Of this number, 54 points are the body's own statements and 107 belong to 38 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.
ChannelGateway._handle_conversation (cyclomatic 158) backend/channels/gateway.py:1619— ChannelGateway._handle_conversation has cyclomatic complexity 158 (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.
html2pptx.extractSlideData (cyclomatic 157) backend/skills/s_pptx/scripts/html2pptx.js:244— html2pptx.extractSlideData has cyclomatic complexity 157 (threshold 15). Most of this is not in the body itself: 1 of the 157 points is its own statement and the rest belongs to 15 function literals inside it that branch (lines 534, 422, 365, …). 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.
artifact_cli.cmd_run_update (cyclomatic 148) backend/scripts/artifact_cli.py:1797— artifact_cli.cmd_run_update has cyclomatic complexity 148 (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.
SkillsPage.GenerateSkillForm (cyclomatic 108) desktop/src/pages/SkillsPage.tsx:327— SkillsPage.GenerateSkillForm has cyclomatic complexity 108 (threshold 15). Of this number, 27 points are the body's own statements and 81 belong to 20 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.
FileViewer.FileViewerImpl (cyclomatic 105) desktop/src/components/file-viewer/FileViewer.tsx:126— FileViewer.FileViewerImpl has cyclomatic complexity 105 (threshold 15). Of this number, 34 points are the body's own statements and 71 belong to 14 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.
evolution_optimizer._run_evolution_cycle_locked (cyclomatic 97) backend/core/evolution_optimizer.py:1148— evolution_optimizer._run_evolution_cycle_locked has cyclomatic complexity 97 (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.
D1 · Cyclomatic Complexity· main (cyclomatic 96) · ×1
main (cyclomatic 96) backend/skills/s_browser-agent/browser-agent.mjs:304— main has cyclomatic complexity 96 (threshold 15). Of this number, 93 points are the body's own statements and 3 belong to 8 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.
SessionRouter.run_conversation (cyclomatic 90) backend/core/session_router.py:2782— SessionRouter.run_conversation has cyclomatic complexity 90 (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.
eval_runner.generate_html_report (cyclomatic 86) backend/scripts/eval_runner.py:2163— eval_runner.generate_html_report has cyclomatic complexity 86 (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.
TabView.TabViewImpl (cyclomatic 81) desktop/src/pages/chat/components/TabView.tsx:208— TabView.TabViewImpl has cyclomatic complexity 81 (threshold 15). Of this number, 22 points are the body's own statements and 59 belong to 10 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.
AuthConfigPanel.AuthConfigPanel (cyclomatic 75) desktop/src/components/settings/AuthConfigPanel.tsx:29— AuthConfigPanel.AuthConfigPanel has cyclomatic complexity 75 (threshold 15). Of this number, 32 points are the body's own statements and 43 belong to 8 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.
proactive_intelligence.build_session_briefing_data (cyclomatic 69) backend/core/proactive_intelligence.py:1884— proactive_intelligence.build_session_briefing_data has cyclomatic complexity 69 (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.
DistillationTriggerHook._distill_files (cyclomatic 69) backend/hooks/distillation_hook.py:451— DistillationTriggerHook._distill_files has cyclomatic complexity 69 (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.
AssistantMessageView.AssistantMessageView (cyclomatic 68) desktop/src/pages/chat/components/AssistantMessageView.tsx:77— AssistantMessageView.AssistantMessageView has cyclomatic complexity 68 (threshold 15). Of this number, 47 points are the body's own statements and 21 belong to 6 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.
confidence_score.calculate_score (cyclomatic 66) backend/skills/s_autonomous-pipeline/scripts/confidence_score.py:71— confidence_score.calculate_score has cyclomatic complexity 66 (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.
SessionUnit.send (cyclomatic 65) backend/core/session_unit.py:1867— SessionUnit.send has cyclomatic complexity 65 (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.
executor.execute_job (cyclomatic 64) REDACTED:154— executor.execute_job has cyclomatic complexity 64 (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.
proactive_intelligence._advance_pipeline_recovery_state (cyclomatic 63) backend/core/proactive_intelligence.py:816— proactive_intelligence._advance_pipeline_recovery_state 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.
PromptBuilder.build_system_prompt (cyclomatic 61) REDACTED:825— PromptBuilder.build_system_prompt has cyclomatic complexity 61 (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.
pipeline_validator._check_depth (cyclomatic 59) backend/scripts/pipeline_validator.py:1995— pipeline_validator._check_depth 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.
BackendStartupOverlay.BackendStartupOverlay (cyclomatic 59) desktop/src/components/common/BackendStartupOverlay.tsx:241— BackendStartupOverlay.BackendStartupOverlay has cyclomatic complexity 59 (threshold 15). Most of this is not in the body itself: 14 of the 59 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 438, 403, 358, …). 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.
security_hooks._segment_is_irreversible (cyclomatic 58) backend/core/security_hooks.py:284— security_hooks._segment_is_irreversible has cyclomatic complexity 58 (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.
browser-agent.compressDOM (cyclomatic 58) backend/skills/s_browser-agent/browser-agent.mjs:127— browser-agent.compressDOM has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 1 of the 58 points is its own statement and the rest belongs to one function literal inside it that branches (line 128). 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.
useVoiceRecorder.useVoiceRecorder (cyclomatic 57) desktop/src/hooks/useVoiceRecorder.ts:48— useVoiceRecorder.useVoiceRecorder has cyclomatic complexity 57 (threshold 15). Most of this is not in the body itself: 3 of the 57 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 245, 99, 78, …). 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.
swarmai_monthly_report._generate_monthly_report (cyclomatic 56) backend/jobs/handlers/swarmai_monthly_report.py:589— swarmai_monthly_report._generate_monthly_report 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.
AgentFormModal.AgentFormModal (cyclomatic 55) desktop/src/components/common/AgentFormModal.tsx:36— AgentFormModal.AgentFormModal has cyclomatic complexity 55 (threshold 15). Of this number, 26 points are the body's own statements and 29 belong to 7 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.
streaming-machine.streamingReducer (cyclomatic 53) desktop/src/hooks/streaming-machine.ts:110— streaming-machine.streamingReducer has cyclomatic complexity 53 (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.
CsvRenderer.CsvRenderer (cyclomatic 53) desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:48— CsvRenderer.CsvRenderer has cyclomatic complexity 53 (threshold 15). Of this number, 19 points are the body's own statements and 34 belong to 13 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.
tool_summarizer.summarize_tool_use (cyclomatic 52) backend/core/tool_summarizer.py:150— tool_summarizer.summarize_tool_use has cyclomatic complexity 52 (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.
artifact_cli._extract_run_metrics (cyclomatic 51) backend/scripts/artifact_cli.py:4783— artifact_cli._extract_run_metrics 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.
useUnifiedTabState.useUnifiedTabState (cyclomatic 48) desktop/src/hooks/useUnifiedTabState.ts:419— useUnifiedTabState.useUnifiedTabState has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 2 of the 48 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 767, 559, 477, …). 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.
FileViewerPanel.FileViewerPanelImpl (cyclomatic 48) desktop/src/components/file-viewer/FileViewerPanel.tsx:139— FileViewerPanel.FileViewerPanelImpl has cyclomatic complexity 48 (threshold 15). Of this number, 37 points are the body's own statements and 11 belong to 7 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.
AIModelsTab.AIModelsTab (cyclomatic 46) desktop/src/components/settings/AIModelsTab.tsx:15— AIModelsTab.AIModelsTab has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 9 of the 46 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 83, 46, 56, …). 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.lifespan (cyclomatic 45) backend/main.py:938— main.lifespan has cyclomatic complexity 45 (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.
pipeline_validator.validate_artifact_data (cyclomatic 45) backend/scripts/pipeline_validator.py:1270— pipeline_validator.validate_artifact_data 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.
CapabilitiesOverlay.CapabilitiesContent (cyclomatic 45) desktop/src/components/layout/CapabilitiesOverlay.tsx:173— CapabilitiesOverlay.CapabilitiesContent has cyclomatic complexity 45 (threshold 15). Of this number, 23 points are the body's own statements and 22 belong to 14 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.
security_hooks._pending_commit_paths (cyclomatic 44) backend/core/security_hooks.py:1729— security_hooks._pending_commit_paths 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.
scheduler.run_scheduler (cyclomatic 44) backend/jobs/scheduler.py:472— scheduler.run_scheduler 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.
useVoiceConversation.useVoiceConversation (cyclomatic 44) desktop/src/hooks/useVoiceConversation.ts:75— useVoiceConversation.useVoiceConversation has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 1 of the 44 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 179, 264, 149, …). 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.
memory_health._compress_evolution_entries (cyclomatic 43) backend/jobs/handlers/memory_health.py:614— memory_health._compress_evolution_entries has cyclomatic complexity 43 (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.
code_intel_reindex.reindex_projects (cyclomatic 40) backend/jobs/handlers/code_intel_reindex.py:20— code_intel_reindex.reindex_projects 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.
workspace_api.resolve_path_to_physical (cyclomatic 40) backend/routers/workspace_api.py:992— workspace_api.resolve_path_to_physical 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.
AskUserQuestion.AskUserQuestion (cyclomatic 40) desktop/src/components/common/AskUserQuestion.tsx:19— AskUserQuestion.AskUserQuestion has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 7 of the 40 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 176, 163, 113, …). 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.
useChatStreamingLifecycle.updateMessages (cyclomatic 40) desktop/src/hooks/useChatStreamingLifecycle.ts:366— useChatStreamingLifecycle.updateMessages has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 1 of the 40 points is its own statement and the rest belongs to one function literal inside it that branches (line 372). 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.
compressDOM::(anonymous)::compress (cyclomatic 40) backend/skills/s_browser-agent/browser-agent.mjs:199— compressDOM::(anonymous)::compress 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.
json_exporter.export_code_intel_json (cyclomatic 39) REDACTED:36— json_exporter.export_code_intel_json 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.
VirtualizedTree.flattenTree (cyclomatic 39) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:255— VirtualizedTree.flattenTree has cyclomatic complexity 39 (threshold 15). Of this number, 38 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.
PromptBuilder.build_options (cyclomatic 38) REDACTED:1775— PromptBuilder.build_options 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.
eval_scheduled.run_eval_scheduled (cyclomatic 38) backend/jobs/handlers/eval_scheduled.py:138— eval_scheduled.run_eval_scheduled has cyclomatic complexity 38 (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.
artifact_cli.cmd_run_observe (cyclomatic 38) backend/scripts/artifact_cli.py:5539— artifact_cli.cmd_run_observe 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.
useUnifiedAttachments.useUnifiedAttachments (cyclomatic 38) desktop/src/hooks/useUnifiedAttachments.ts:117— useUnifiedAttachments.useUnifiedAttachments has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 1 of the 38 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 173, 307, 146, …). 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.
skill_metrics_hook._detect_skill_invocations (cyclomatic 37) backend/hooks/skill_metrics_hook.py:112— skill_metrics_hook._detect_skill_invocations 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.
ai_ready_helpers.select_verification_tasks (cyclomatic 37) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2905— ai_ready_helpers.select_verification_tasks 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.
ToDoOverlay.TodoForm (cyclomatic 37) desktop/src/components/layout/ToDoOverlay.tsx:993— ToDoOverlay.TodoForm has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 11 of the 37 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1057, 1022, 1014, …). 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.
pollinate_validator.validate_delivery (cyclomatic 36) backend/skills/s_pollinate/scripts/pollinate_validator.py:182— pollinate_validator.validate_delivery has cyclomatic complexity 36 (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.
TreeNodeRow.TreeNodeRow (cyclomatic 36) desktop/src/components/workspace-explorer/TreeNodeRow.tsx:188— TreeNodeRow.TreeNodeRow has cyclomatic complexity 36 (threshold 15). Of this number, 30 points are the body's own statements and 6 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.
PollinateOverlay.AssetDrawer (cyclomatic 36) desktop/src/components/layout/PollinateOverlay.tsx:494— PollinateOverlay.AssetDrawer has cyclomatic complexity 36 (threshold 15). Of this number, 28 points are the body's own statements and 8 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.
ProjectionLayer.project_skills (cyclomatic 35) backend/core/projection_layer.py:227— ProjectionLayer.project_skills 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.
ContextHealthHook._auto_cultivate_session_signals (cyclomatic 35) backend/hooks/context_health_hook.py:1163— ContextHealthHook._auto_cultivate_session_signals 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.
pipelines.pipeline_analytics (cyclomatic 35) backend/routers/pipelines.py:444— pipelines.pipeline_analytics 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.
SelfLoopsHealthEngine.to_markdown (cyclomatic 35) backend/skills/s_loops-health/scripts/loops_health_check.py:1228— SelfLoopsHealthEngine.to_markdown 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.
VirtualizedTree.VirtualizedTree (cyclomatic 35) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:688— VirtualizedTree.VirtualizedTree has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 3 of the 35 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 881, 813, 925, …). 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.
MergedToolBlock.MergedToolBlock (cyclomatic 35) desktop/src/pages/chat/components/MergedToolBlock.tsx:122— MergedToolBlock.MergedToolBlock has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 belong to 4 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.
PollinateOverlay.PollinateContent (cyclomatic 35) desktop/src/components/layout/PollinateOverlay.tsx:108— PollinateOverlay.PollinateContent has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 13 of the 35 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 168, 148, 213, …). 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.
ChannelGateway.handle_inbound_message (cyclomatic 34) backend/channels/gateway.py:1248— ChannelGateway.handle_inbound_message 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.
ui_actions.build_surface_events (cyclomatic 34) backend/core/ui_actions.py:287— ui_actions.build_surface_events 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.
ddd_weekly_report._generate_report (cyclomatic 34) backend/jobs/handlers/ddd_weekly_report.py:207— ddd_weekly_report._generate_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.
artifact_cli.cmd_publish (cyclomatic 34) backend/scripts/artifact_cli.py:337— artifact_cli.cmd_publish 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.
pipeline_validator._check_semantic_depth (cyclomatic 34) backend/scripts/pipeline_validator.py:2242— pipeline_validator._check_semantic_depth 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.
FileContextMenu.FileContextMenu (cyclomatic 34) desktop/src/components/workspace-explorer/FileContextMenu.tsx:58— FileContextMenu.FileContextMenu has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 10 of the 34 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 101, 423, 141, …). 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.
EngineMetricsTab.EngineMetricsTab (cyclomatic 34) desktop/src/components/settings/EngineMetricsTab.tsx:54— EngineMetricsTab.EngineMetricsTab has cyclomatic complexity 34 (threshold 15). Of this number, 18 points are the body's own statements and 16 belong to 6 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.
EvalDashboard.GoldenSetTab (cyclomatic 34) desktop/src/pages/EvalDashboard.tsx:495— EvalDashboard.GoldenSetTab has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 12 of the 34 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 519, 607, 531, …). 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.
ReviewModeGutter.ReviewModeGutter (cyclomatic 34) desktop/src/components/common/ReviewModeGutter.tsx:42— ReviewModeGutter.ReviewModeGutter has cyclomatic complexity 34 (threshold 15). Of this number, 17 points are the body's own statements and 17 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.
useHealthMonitor.useHealthMonitor (cyclomatic 33) desktop/src/hooks/useHealthMonitor.ts:134— useHealthMonitor.useHealthMonitor has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 222, 293, 176, …). 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.
MultiSelect.MultiSelect (cyclomatic 33) desktop/src/components/common/MultiSelect.tsx:25— MultiSelect.MultiSelect has cyclomatic complexity 33 (threshold 15). Of this number, 19 points are the body's own statements and 14 belong to 7 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.
ContentBlockRenderer.ContentBlockRenderer (cyclomatic 33) desktop/src/pages/chat/components/ContentBlockRenderer.tsx:122— ContentBlockRenderer.ContentBlockRenderer has cyclomatic complexity 33 (threshold 15). Of this number, 32 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.
adversarial_meta.check_adversarial_health (cyclomatic 32) backend/core/adversarial_meta.py:21— adversarial_meta.check_adversarial_health 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.
parser.parse_repo_with_coverage (cyclomatic 32) backend/core/code_intel/parser.py:1952— parser.parse_repo_with_coverage 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.
SummarizationPipeline._extract_files_modified (cyclomatic 32) backend/core/summarization.py:422— SummarizationPipeline._extract_files_modified 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.
executor._format_briefing_slack_message (cyclomatic 32) REDACTED:1357— executor._format_briefing_slack_message 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.
artifact_cli.cmd_run_commit (cyclomatic 32) backend/scripts/artifact_cli.py:2920— artifact_cli.cmd_run_commit 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.
backfill_cjk_escapes.backfill (cyclomatic 32) backend/scripts/backfill_cjk_escapes.py:576— backfill_cjk_escapes.backfill 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.
style-extract.extract_shapes_summary (cyclomatic 32) backend/skills/s_pptx/scripts/style-extract.py:81— style-extract.extract_shapes_summary 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.
ai_ready_helpers.compute_subsystem_coverage (cyclomatic 32) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:845— ai_ready_helpers.compute_subsystem_coverage 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.
ExplorerContext.ExplorerProvider (cyclomatic 32) desktop/src/contexts/ExplorerContext.tsx:369— ExplorerContext.ExplorerProvider has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 616, 489, 531, …). 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.
ExplorerToolbar.ExplorerToolbar (cyclomatic 32) desktop/src/components/workspace-explorer/ExplorerToolbar.tsx:34— ExplorerToolbar.ExplorerToolbar has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 11 of the 32 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 89, 146, 127, …). 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.
MessageStore._applyMerge (cyclomatic 32) desktop/src/stores/MessageStore.ts:892— MessageStore._applyMerge has cyclomatic complexity 32 (threshold 15). Of this number, 30 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.
BackupTab.BackupTab (cyclomatic 32) desktop/src/components/settings/BackupTab.tsx:15— BackupTab.BackupTab has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 15 of the 32 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 176, 55, 206, …). 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.
OnboardingPage.OnboardingPage (cyclomatic 32) desktop/src/pages/OnboardingPage.tsx:40— OnboardingPage.OnboardingPage has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 11 of the 32 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 59, 144, 58, …). 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.
security_hooks._targets_irreplaceable_store (cyclomatic 31) backend/core/security_hooks.py:430— security_hooks._targets_irreplaceable_store 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.
ChannelsTab.ChannelsTab (cyclomatic 31) desktop/src/components/settings/ChannelsTab.tsx:13— ChannelsTab.ChannelsTab has cyclomatic complexity 31 (threshold 15). Of this number, 26 points are the body's own statements and 5 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.
clustering.compute_graph_clusters (cyclomatic 30) backend/core/code_intel/clustering.py:75— clustering.compute_graph_clusters 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.
ContextDirectoryLoader.ensure_directory (cyclomatic 30) backend/core/context_directory_loader.py:543— ContextDirectoryLoader.ensure_directory 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.
daily_activity_writer._format_session_entry (cyclomatic 30) backend/core/daily_activity_writer.py:134— daily_activity_writer._format_session_entry 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.
PluginManager.install_plugin (cyclomatic 30) backend/core/plugin_manager.py:696— PluginManager.install_plugin 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.
recall_multi._recall_ddd (cyclomatic 30) backend/core/recall_multi.py:701— recall_multi._recall_ddd 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.
session_router._maybe_inject_recall_inner (cyclomatic 30) backend/core/session_router.py:969— session_router._maybe_inject_recall_inner 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.
ContextHealthHook._track_memory_usage_locked (cyclomatic 30) backend/hooks/context_health_hook.py:1593— ContextHealthHook._track_memory_usage_locked 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.
Video.SectionComponent (cyclomatic 30) backend/skills/s_pollinate/templates/remotion/Video.tsx:43— Video.SectionComponent has cyclomatic complexity 30 (threshold 15). Of this number, 28 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.
LibraryTree.LibraryTree (cyclomatic 30) desktop/src/components/layout/LibraryTree.tsx:218— LibraryTree.LibraryTree has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 12 of the 30 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 236, 278, 297, …). 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.
InlinePermissionRequest.InlinePermissionRequest (cyclomatic 30) desktop/src/pages/chat/components/InlinePermissionRequest.tsx:40— InlinePermissionRequest.InlinePermissionRequest has cyclomatic complexity 30 (threshold 15). Of this number, 16 points are the body's own statements and 14 belong to 6 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.
FilePreviewModal.FilePreviewModal (cyclomatic 30) desktop/src/components/workspace/FilePreviewModal.tsx:48— FilePreviewModal.FilePreviewModal has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 12 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 102, 79). 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.
FileEditorCore.DiffView (cyclomatic 30) desktop/src/components/common/FileEditorCore.tsx:380— FileEditorCore.DiffView has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 10 of the 30 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 415, 399, 480). 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.
ChatErrorMessage.ChatErrorMessage (cyclomatic 30) desktop/src/components/chat/ChatErrorMessage.tsx:35— ChatErrorMessage.ChatErrorMessage has cyclomatic complexity 30 (threshold 15). Of this number, 29 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.
DddCultivationOrchestrator._auto_apply_ddd_proposals (cyclomatic 29) backend/core/ddd_orchestrator.py:582— DddCultivationOrchestrator._auto_apply_ddd_proposals 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.
ingestion_gate.ingestion_gate (cyclomatic 29) backend/core/ingestion_gate.py:633— ingestion_gate.ingestion_gate 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.
memory_extractor.extract_and_save (cyclomatic 29) backend/core/memory_extractor.py:367— memory_extractor.extract_and_save 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.
persist_routing.classify_content (cyclomatic 29) backend/core/persist_routing.py:248— persist_routing.classify_content has cyclomatic complexity 29 (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.
PluginManager._install_from_marketplace_json (cyclomatic 29) backend/core/plugin_manager.py:522— PluginManager._install_from_marketplace_json 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.
SQLiteDatabase._run_versioned_migrations (cyclomatic 29) backend/database/sqlite.py:2386— SQLiteDatabase._run_versioned_migrations 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.
SQLiteDatabase._run_legacy_migrations (cyclomatic 29) backend/database/sqlite.py:2885— SQLiteDatabase._run_legacy_migrations has cyclomatic complexity 29 (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.
memory_health.run_memory_health (cyclomatic 29) backend/jobs/handlers/memory_health.py:150— memory_health.run_memory_health 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.
memory_health._apply_report (cyclomatic 29) backend/jobs/handlers/memory_health.py:493— memory_health._apply_report 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.
recalc.recalc (cyclomatic 29) backend/skills/s_xlsx/recalc.py:53— recalc.recalc 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.
UpdateNotification.UpdateNotification (cyclomatic 29) desktop/src/components/common/UpdateNotification.tsx:16— UpdateNotification.UpdateNotification has cyclomatic complexity 29 (threshold 15). Of this number, 22 points are the body's own statements and 7 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.
CodeGraph.CodeGraph (cyclomatic 29) desktop/src/components/code-intel/CodeGraph.tsx:76— CodeGraph.CodeGraph has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 168, 156, 100, …). 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.
EvalDashboard.OverviewTab (cyclomatic 29) desktop/src/pages/EvalDashboard.tsx:289— EvalDashboard.OverviewTab has cyclomatic complexity 29 (threshold 15). 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: 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.
ddd_cultivation.apply_to_ddd (cyclomatic 28) backend/core/ddd_cultivation.py:984— ddd_cultivation.apply_to_ddd has cyclomatic complexity 28 (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.
SessionMiner._extract_skill_invocations (cyclomatic 28) REDACTED:287— SessionMiner._extract_skill_invocations has cyclomatic complexity 28 (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.
ContextHealthHook._auto_cultivate_pipeline_lessons (cyclomatic 28) backend/hooks/context_health_hook.py:788— ContextHealthHook._auto_cultivate_pipeline_lessons has cyclomatic complexity 28 (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.
DistillationTriggerHook._enforce_size_valve (cyclomatic 28) backend/hooks/distillation_hook.py:2571— DistillationTriggerHook._enforce_size_valve has cyclomatic complexity 28 (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.
channels.update_channel (cyclomatic 28) backend/routers/channels.py:180— channels.update_channel 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.
design_system.format_ascii_box (cyclomatic 28) backend/skills/s_frontend-design/scripts/design_system.py:282— design_system.format_ascii_box has cyclomatic complexity 28 (threshold 15). 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.
ParagraphData.__init__ (cyclomatic 28) backend/skills/s_pptx/scripts/inventory.py:140— ParagraphData.__init__ has cyclomatic complexity 28 (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.
PipelineOverlay.PipelineContent (cyclomatic 28) desktop/src/components/layout/PipelineOverlay.tsx:89— PipelineOverlay.PipelineContent has cyclomatic complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 belong to 8 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.
TSCCModules.SystemPromptModule (cyclomatic 28) desktop/src/pages/chat/components/TSCCModules.tsx:655— TSCCModules.SystemPromptModule has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 713, 663, 726, …). 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.
ddd_entry_lifecycle.parse_entries (cyclomatic 27) backend/core/ddd_entry_lifecycle.py:521— ddd_entry_lifecycle.parse_entries 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.
ddd_entry_lifecycle.inject_entry_metadata (cyclomatic 27) backend/core/ddd_entry_lifecycle.py:642— ddd_entry_lifecycle.inject_entry_metadata 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.
ddd_packager.package_ddd (cyclomatic 27) backend/core/ddd_packager.py:1838— ddd_packager.package_ddd 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.
engine_metrics.collect_ddd_change_suggestions (cyclomatic 27) backend/core/engine_metrics.py:154— engine_metrics.collect_ddd_change_suggestions 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.
executor._handle_agent_task (cyclomatic 27) REDACTED:739— executor._handle_agent_task 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.
chat.sse_with_heartbeat (cyclomatic 27) backend/routers/chat.py:336— chat.sse_with_heartbeat 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.
SelfLoopsHealthEngine._check_memory (cyclomatic 27) backend/skills/s_loops-health/scripts/loops_health_check.py:269— SelfLoopsHealthEngine._check_memory 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.
EvalDashboard.CaseDetailDrawer (cyclomatic 27) desktop/src/pages/EvalDashboard.tsx:2191— EvalDashboard.CaseDetailDrawer has cyclomatic complexity 27 (threshold 15). 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, 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.
useCanvasHost.useCanvasHost (cyclomatic 27) desktop/src/hooks/useCanvasHost.ts:148— useCanvasHost.useCanvasHost has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 311, 233, 251, …). 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.
FolderPickerModal.FolderPickerModal (cyclomatic 27) desktop/src/components/workspace/FolderPickerModal.tsx:21— FolderPickerModal.FolderPickerModal has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 12 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 97, 34, 120, …). 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.
context_injector._extract_key_tool_results (cyclomatic 26) backend/core/context_injector.py:654— context_injector._extract_key_tool_results 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.
file_change_classifier.parse_bash_delete_targets (cyclomatic 26) backend/core/file_change_classifier.py:122— file_change_classifier.parse_bash_delete_targets 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.
SessionUnit._emit_post_stream_metadata (cyclomatic 26) backend/core/session_unit.py:2976— SessionUnit._emit_post_stream_metadata 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.
artifact_cli.cmd_run_analytics (cyclomatic 26) backend/scripts/artifact_cli.py:5272— artifact_cli.cmd_run_analytics 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.
polly.synthesize (cyclomatic 26) backend/skills/s_pollinate/scripts/tts/backends/polly.py:246— polly.synthesize 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.
NewBrainOverlay.NewBrainContent (cyclomatic 26) desktop/src/components/layout/NewBrainOverlay.tsx:92— NewBrainOverlay.NewBrainContent has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 215, 142, 185, …). 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.
ActivityFeed.extractActivities (cyclomatic 26) desktop/src/pages/chat/components/ActivityFeed.tsx:24— ActivityFeed.extractActivities 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.
EvalDashboard.GuideTab (cyclomatic 26) desktop/src/pages/EvalDashboard.tsx:1698— EvalDashboard.GuideTab has cyclomatic complexity 26 (threshold 15). Of this number, 21 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.
PdfRenderer.PdfRenderer (cyclomatic 26) desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:44— PdfRenderer.PdfRenderer has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 167, 59, 92, …). 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.
OverlayHost.OverlayHost (cyclomatic 26) desktop/src/components/layout/OverlayHost.tsx:58— OverlayHost.OverlayHost has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 77, 153, 106, …). 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.
blast_radius.analyze_diff (cyclomatic 25) backend/core/code_intel/blast_radius.py:180— blast_radius.analyze_diff 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.
ddd_cultivation.detect_contradiction (cyclomatic 25) backend/core/ddd_cultivation.py:1446— ddd_cultivation.detect_contradiction 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.
RetryManager._retry_with_resume (cyclomatic 25) backend/core/retry_manager.py:265— RetryManager._retry_with_resume 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.
SessionUnit._check_mcp_health (cyclomatic 25) backend/core/session_unit.py:3111— SessionUnit._check_mcp_health 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.
EvolutionMaintenanceHook.execute (cyclomatic 25) backend/hooks/evolution_maintenance_hook.py:196— EvolutionMaintenanceHook.execute 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.
settings.update_app_configuration (cyclomatic 25) backend/routers/settings.py:263— settings.update_app_configuration 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.
pipeline_validator.check_ddd_consistency (cyclomatic 25) backend/scripts/pipeline_validator.py:1787— pipeline_validator.check_ddd_consistency 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.
pptx_to_deck.extract (cyclomatic 25) backend/skills/s_pollinate/scripts/pptx_to_deck.py:36— pptx_to_deck.extract 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.
sections.match_section_times (cyclomatic 25) backend/skills/s_pollinate/scripts/tts/sections.py:86— sections.match_section_times 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.
ai_ready_helpers._render_domain_skeleton_body (cyclomatic 25) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1568— ai_ready_helpers._render_domain_skeleton_body 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.
ai_ready_helpers.project_domain_skeleton (cyclomatic 25) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1225— ai_ready_helpers.project_domain_skeleton 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.
BrainHub.DistributeView (cyclomatic 25) desktop/src/components/layout/BrainHub.tsx:1173— BrainHub.DistributeView has cyclomatic complexity 25 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_ClaudeClientWrapper._extract_pid (cyclomatic 24) backend/core/claude_environment.py:81— _ClaudeClientWrapper._extract_pid 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.
codebase_map._format_briefing (cyclomatic 24) backend/core/code_intel/codebase_map.py:43— codebase_map._format_briefing 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.
parser._build_file_scope_regex (cyclomatic 24) backend/core/code_intel/parser.py:784— parser._build_file_scope_regex has cyclomatic complexity 24 (threshold 15). 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.
DddCultivationOrchestrator._ch_ddd_staleness (cyclomatic 24) backend/core/ddd_orchestrator.py:444— DddCultivationOrchestrator._ch_ddd_staleness 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.
DddCultivationOrchestrator._ch_entry_lifecycle (cyclomatic 24) backend/core/ddd_orchestrator.py:815— DddCultivationOrchestrator._ch_entry_lifecycle 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.
SummarizationPipeline._parse_enrichment (cyclomatic 24) backend/core/summarization.py:823— SummarizationPipeline._parse_enrichment 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.
ContextHealthHook._deep_check (cyclomatic 24) backend/hooks/context_health_hook.py:2492— ContextHealthHook._deep_check 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.
tscc.get_security_scan (cyclomatic 24) backend/routers/tscc.py:159— tscc.get_security_scan 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.
workspace_api._build_tree (cyclomatic 24) backend/routers/workspace_api.py:349— workspace_api._build_tree 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.
pipeline_validator._verify_findings_on_disk (cyclomatic 24) backend/scripts/pipeline_validator.py:155— pipeline_validator._verify_findings_on_disk 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.
replace.apply_replacements (cyclomatic 24) backend/skills/s_pptx/scripts/replace.py:214— replace.apply_replacements 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.
ai_ready_helpers.compute_business_rules_dimension (cyclomatic 24) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3973— ai_ready_helpers.compute_business_rules_dimension 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.
html2pptx.addElements (cyclomatic 24) backend/skills/s_pptx/scripts/html2pptx.js:133— html2pptx.addElements 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.
BrainHub.ReviewView (cyclomatic 24) desktop/src/components/layout/BrainHub.tsx:840— BrainHub.ReviewView has cyclomatic complexity 24 (threshold 15). Of this number, 18 points are the body's own statements and 6 belong to 4 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.
useCanvasAutoSurface.useCanvasAutoSurface (cyclomatic 24) desktop/src/hooks/useCanvasAutoSurface.ts:75— useCanvasAutoSurface.useCanvasAutoSurface has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 133, 189, 103, …). 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.
SlackChannelAdapter._text_to_blocks (cyclomatic 23) REDACTED:1923— SlackChannelAdapter._text_to_blocks 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.
code_intel_feed.detect_tech_drift (cyclomatic 23) backend/core/code_intel_feed.py:59— code_intel_feed.detect_tech_drift 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.
context_injector._extract_tool_summary (cyclomatic 23) backend/core/context_injector.py:215— context_injector._extract_tool_summary 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.
context_injector.build_resume_context (cyclomatic 23) backend/core/context_injector.py:1139— context_injector.build_resume_context 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.
prompt_builder._render_ui_context_section (cyclomatic 23) REDACTED:202— prompt_builder._render_ui_context_section 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.
ContextHealthHook._extract_lessons_to_memory (cyclomatic 23) backend/hooks/context_health_hook.py:969— ContextHealthHook._extract_lessons_to_memory 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.
memory_health._resolve_open_thread (cyclomatic 23) backend/jobs/handlers/memory_health.py:887— memory_health._resolve_open_thread 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.
artifact_cli.cmd_release_gate (cyclomatic 23) backend/scripts/artifact_cli.py:3258— artifact_cli.cmd_release_gate 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.
DocxXMLEditor.suggest_deletion (cyclomatic 23) backend/skills/s_docx/scripts/document.py:482— DocxXMLEditor.suggest_deletion 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.
SelfLoopsHealthEngine._auto_remediate (cyclomatic 23) backend/skills/s_loops-health/scripts/loops_health_check.py:692— SelfLoopsHealthEngine._auto_remediate 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.
ai_ready_helpers.select_verification_tasks (cyclomatic 23) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3252— ai_ready_helpers.select_verification_tasks 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.
BottomBar.BottomBar (cyclomatic 23) desktop/src/components/layout/BottomBar.tsx:89— BottomBar.BottomBar has cyclomatic complexity 23 (threshold 15). Of this number, 13 points are the body's own statements and 10 belong to 8 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.
CMBrainOverlay.CMBrainContent (cyclomatic 23) desktop/src/components/layout/CMBrainOverlay.tsx:167— CMBrainOverlay.CMBrainContent 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.
ToDoOverlay.ToDoContent (cyclomatic 23) desktop/src/components/layout/ToDoOverlay.tsx:195— ToDoOverlay.ToDoContent has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 299, 249, 214, …). 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.
TSCCPopoverButton.TSCCPopoverButton (cyclomatic 23) desktop/src/pages/chat/components/TSCCPopoverButton.tsx:62— TSCCPopoverButton.TSCCPopoverButton has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 105, 80, 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.
code_intel_hook._build_context (cyclomatic 22) backend/core/code_intel/code_intel_hook.py:235— code_intel_hook._build_context 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.
correction_tracker._merge_drift (cyclomatic 22) backend/core/evolution/correction_tracker.py:69— correction_tracker._merge_drift 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.
library_health.scan_library_health (cyclomatic 22) backend/core/library_health.py:103— library_health.scan_library_health 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.
proactive_learning.update_learning_from_activity (cyclomatic 22) backend/core/proactive_learning.py:431— proactive_learning.update_learning_from_activity 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.
session_health_probe.session_health_probe (cyclomatic 22) backend/core/session_health_probe.py:190— session_health_probe.session_health_probe 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.
skill_migration.migrate_skill_ids_to_allowed_skills (cyclomatic 22) backend/core/skill_migration.py:25— skill_migration.migrate_skill_ids_to_allowed_skills 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.
ContextHealthHook._set_verified_from_pipeline_runs (cyclomatic 22) backend/hooks/context_health_hook.py:1433— ContextHealthHook._set_verified_from_pipeline_runs 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.
DistillationTriggerHook._enforce_section_caps (cyclomatic 22) backend/hooks/distillation_hook.py:2372— DistillationTriggerHook._enforce_section_caps 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.
ddd_self_audit.run_ddd_self_audit (cyclomatic 22) backend/jobs/handlers/ddd_self_audit.py:221— ddd_self_audit.run_ddd_self_audit 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.
workspace_api._get_git_status (cyclomatic 22) backend/routers/workspace_api.py:261— workspace_api._get_git_status 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.
artifact_cli.cmd_run_status (cyclomatic 22) backend/scripts/artifact_cli.py:3828— artifact_cli.cmd_run_status 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.
backfill_cjk_escapes._populate_seg_columns (cyclomatic 22) backend/scripts/backfill_cjk_escapes.py:444— backfill_cjk_escapes._populate_seg_columns 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.
eval_runner.evaluate_case (cyclomatic 22) backend/scripts/eval_runner.py:1606— eval_runner.evaluate_case 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.
evolution_escalation_probe.main (cyclomatic 22) backend/scripts/evolution_escalation_probe.py:73— evolution_escalation_probe.main 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.
pipeline_analytics._load_all_metrics (cyclomatic 22) backend/scripts/pipeline_analytics.py:64— pipeline_analytics._load_all_metrics 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.
pipeline_analytics.analyze_stage_efficiency (cyclomatic 22) backend/scripts/pipeline_analytics.py:503— pipeline_analytics.analyze_stage_efficiency 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.
pipeline_validator._check_security_boundaries (cyclomatic 22) backend/scripts/pipeline_validator.py:1124— pipeline_validator._check_security_boundaries 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.
SelfLoopsHealthEngine._check_infrastructure (cyclomatic 22) backend/skills/s_loops-health/scripts/loops_health_check.py:609— SelfLoopsHealthEngine._check_infrastructure 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.
publish_dashboard.scan_deliver (cyclomatic 22) backend/skills/s_pollinate/scripts/publish_dashboard.py:44— publish_dashboard.scan_deliver 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.
todo_db._build_linked_context (cyclomatic 22) backend/skills/s_radar-todo/scripts/todo_db.py:78— todo_db._build_linked_context 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.
DiagramReveal.autoLayout (cyclomatic 22) backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:65— DiagramReveal.autoLayout 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.
hiveComponents.InstanceCard (cyclomatic 22) desktop/src/components/settings/hiveComponents.tsx:114— hiveComponents.InstanceCard has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 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.
hiveComponents.AuthDisplay (cyclomatic 22) desktop/src/components/settings/hiveComponents.tsx:256— hiveComponents.AuthDisplay has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 belong to 5 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.
SystemTab.SystemTab (cyclomatic 22) desktop/src/components/settings/SystemTab.tsx:26— SystemTab.SystemTab has cyclomatic complexity 22 (threshold 15). Of this number, 13 points are the body's own statements and 9 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.
AboutTab.AboutTab (cyclomatic 22) desktop/src/components/settings/AboutTab.tsx:26— AboutTab.AboutTab has cyclomatic complexity 22 (threshold 15). Of this number, 13 points are the body's own statements and 9 belong to 4 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.
OnboardingPage.StepRestore (cyclomatic 22) desktop/src/pages/OnboardingPage.tsx:354— OnboardingPage.StepRestore has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 386, 462, 372). 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.
community_data.parse_hot_topics (cyclomatic 21) backend/core/community_data.py:732— community_data.parse_hot_topics 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.
mcp_config_loader.merge_catalog_template (cyclomatic 21) backend/core/mcp_config_loader.py:149— mcp_config_loader.merge_catalog_template 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.
mcp_migration.migrate_if_needed (cyclomatic 21) backend/core/mcp_migration.py:28— mcp_migration.migrate_if_needed 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.
SessionUnit._spawn (cyclomatic 21) backend/core/session_unit.py:3278— SessionUnit._spawn 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.
SwarmWorkspaceManager._cleanup_legacy_content (cyclomatic 21) backend/core/swarm_workspace_manager.py:2092— SwarmWorkspaceManager._cleanup_legacy_content 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.
DistillationTriggerHook._apply_open_thread_updates (cyclomatic 21) backend/hooks/distillation_hook.py:1964— DistillationTriggerHook._apply_open_thread_updates 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.
pollinate._walk_assets (cyclomatic 21) backend/routers/pollinate.py:327— pollinate._walk_assets 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.
generate_shorts.main (cyclomatic 21) backend/skills/s_pollinate/scripts/generate_shorts.py:522— generate_shorts.main 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.
ShapeData._estimate_frame_overflow (cyclomatic 21) backend/skills/s_pptx/scripts/inventory.py:562— ShapeData._estimate_frame_overflow 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.
rearrange.rearrange_presentation (cyclomatic 21) backend/skills/s_pptx/scripts/rearrange.py:149— rearrange.rearrange_presentation 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.
mcp_validation.validate_config_entry (cyclomatic 21) backend/utils/mcp_validation.py:105— mcp_validation.validate_config_entry 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.
DeckStage._onKey (cyclomatic 21) REDACTED:559— DeckStage._onKey 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.
Dropdown.Dropdown (cyclomatic 21) desktop/src/components/common/Dropdown.tsx:22— Dropdown.Dropdown has cyclomatic complexity 21 (threshold 15). Of this number, 17 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.
HistoryView.HistoryView (cyclomatic 21) desktop/src/pages/chat/components/RightSidebar/HistoryView.tsx:34— HistoryView.HistoryView has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 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.
TerminalTab.TerminalTab (cyclomatic 21) desktop/src/components/terminal/TerminalTab.tsx:61— TerminalTab.TerminalTab has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 233, 154, 107, …). 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.
(anonymous)::_onKey (cyclomatic 21) REDACTED:559— (anonymous)::_onKey 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.
canvas_surface.is_canvas_surfaceable (cyclomatic 20) backend/core/canvas_surface.py:90— canvas_surface.is_canvas_surfaceable 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.
knowledge_store.sync_knowledge_index (cyclomatic 20) backend/core/knowledge_store.py:737— knowledge_store.sync_knowledge_index 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.
proactive_intelligence._parse_continue_hints (cyclomatic 20) backend/core/proactive_intelligence.py:176— proactive_intelligence._parse_continue_hints 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.
proactive_intelligence._get_job_result_highlights (cyclomatic 20) backend/core/proactive_intelligence.py:627— proactive_intelligence._get_job_result_highlights 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.
skill_manager.parse_skill_md (cyclomatic 20) backend/core/skill_manager.py:215— skill_manager.parse_skill_md 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.
ContextHealthHook._light_refresh (cyclomatic 20) backend/hooks/context_health_hook.py:175— ContextHealthHook._light_refresh has cyclomatic complexity 20 (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.
ContextHealthHook._run_eval_canary (cyclomatic 20) backend/hooks/context_health_hook.py:346— ContextHealthHook._run_eval_canary 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.
ImprovementWritebackHook._detect_project (cyclomatic 20) backend/hooks/improvement_writeback_hook.py:151— ImprovementWritebackHook._detect_project 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.
model_resolve.resolve_job_model (cyclomatic 20) backend/jobs/model_resolve.py:36— model_resolve.resolve_job_model 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.
agents.update_agent (cyclomatic 20) backend/routers/agents.py:168— agents.update_agent 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.
eval._build_learning_dashboard (cyclomatic 20) backend/routers/eval.py:429— eval._build_learning_dashboard 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.
tasks.create_task (cyclomatic 20) backend/routers/tasks.py:66— tasks.create_task 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.
artifact_cli._auto_validate_before_advance (cyclomatic 20) backend/scripts/artifact_cli.py:827— artifact_cli._auto_validate_before_advance 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.
artifact_cli._stage_publish_times (cyclomatic 20) backend/scripts/artifact_cli.py:5027— artifact_cli._stage_publish_times 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.
eval_runner.eval_trajectory_capture (cyclomatic 20) backend/scripts/eval_runner.py:1388— eval_runner.eval_trajectory_capture 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.
pipeline_analytics.generate_report (cyclomatic 20) backend/scripts/pipeline_analytics.py:761— pipeline_analytics.generate_report 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.
XMLEditor.get_node (cyclomatic 20) backend/skills/s_docx/scripts/utilities.py:76— XMLEditor.get_node 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.
generate_tts.main (cyclomatic 20) backend/skills/s_pollinate/scripts/generate_tts.py:109— generate_tts.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.
publish_dashboard.generate_markdown (cyclomatic 20) backend/skills/s_pollinate/scripts/publish_dashboard.py:114— publish_dashboard.generate_markdown 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.
BaseSchemaValidator.validate_unique_ids (cyclomatic 20) backend/skills/s_pptx/ooxml/scripts/validation/base.py:186— BaseSchemaValidator.validate_unique_ids 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.
locked_write.locked_read_modify_write (cyclomatic 20) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:515— locked_write.locked_read_modify_write 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.
PipelineOverlay.RunDetailDrawer (cyclomatic 20) desktop/src/components/layout/PipelineOverlay.tsx:447— PipelineOverlay.RunDetailDrawer has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 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.
DddCard.FullBody (cyclomatic 20) desktop/src/components/layout/DddCard.tsx:291— DddCard.FullBody 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.
parser._extract_from_tree (cyclomatic 19) backend/core/code_intel/parser.py:997— parser._extract_from_tree 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.
ddd_bindings.describe_project_ddd_line (cyclomatic 19) backend/core/ddd_bindings.py:545— ddd_bindings.describe_project_ddd_line 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.
closed_loop.audit_recurrence (cyclomatic 19) backend/core/evolution/closed_loop.py:37— closed_loop.audit_recurrence 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.
library_mounts.index_docs_mount (cyclomatic 19) backend/core/library_mounts.py:579— library_mounts.index_docs_mount 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.
mcp_config_loader.add_mcp_server_to_dict (cyclomatic 19) backend/core/mcp_config_loader.py:303— mcp_config_loader.add_mcp_server_to_dict 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.
proactive_intelligence._detect_temporal_signals (cyclomatic 19) backend/core/proactive_intelligence.py:461— proactive_intelligence._detect_temporal_signals 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.
proactive_intelligence._extract_working_items (cyclomatic 19) backend/core/proactive_intelligence.py:1788— proactive_intelligence._extract_working_items 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.
security_hooks._segment_is_history_rewrite (cyclomatic 19) backend/core/security_hooks.py:669— security_hooks._segment_is_history_rewrite 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.
SummarizationPipeline._extract_topics (cyclomatic 19) backend/core/summarization.py:292— SummarizationPipeline._extract_topics 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.
SQLiteDatabase._migrate_existing_task_data (cyclomatic 19) backend/database/sqlite.py:3328— SQLiteDatabase._migrate_existing_task_data 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.
ContextHealthHook._refresh_code_intel (cyclomatic 19) backend/hooks/context_health_hook.py:577— ContextHealthHook._refresh_code_intel 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.
EvolutionMaintenanceHook._check_promotion_threshold (cyclomatic 19) backend/hooks/evolution_maintenance_hook.py:961— EvolutionMaintenanceHook._check_promotion_threshold 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.
migrate_skills.generate_manifest (cyclomatic 19) backend/scripts/migrate_skills.py:235— migrate_skills.generate_manifest 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.
pipeline_cleanup.reclassify_stale_runs (cyclomatic 19) backend/scripts/pipeline_cleanup.py:31— pipeline_cleanup.reclassify_stale_runs 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.
pipeline_pr.create_pr (cyclomatic 19) backend/skills/s_autonomous-pipeline/scripts/pipeline_pr.py:240— pipeline_pr.create_pr 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.
BaseSchemaValidator.validate_unique_ids (cyclomatic 19) backend/skills/s_docx/ooxml/scripts/validation/base.py:186— BaseSchemaValidator.validate_unique_ids 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.
design_system.format_markdown (cyclomatic 19) backend/skills/s_frontend-design/scripts/design_system.py:422— design_system.format_markdown 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.
font_link_backfill.main (cyclomatic 19) backend/skills/s_pollinate/scripts/font_link_backfill.py:94— font_link_backfill.main 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.
todo_db._print_work_packet (cyclomatic 19) backend/skills/s_radar-todo/scripts/todo_db.py:149— todo_db._print_work_packet 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.
steeringify.group_and_propose (cyclomatic 19) backend/skills/s_steeringify/steeringify.py:198— steeringify.group_and_propose 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.
SectionLayouts.StepCard (cyclomatic 19) backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:579— SectionLayouts.StepCard 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.
api.parseApiError (cyclomatic 19) desktop/src/services/api.ts:49— api.parseApiError 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.
streaming-guards.forceClearStreamVerdict (cyclomatic 19) desktop/src/hooks/streaming-guards.ts:412— streaming-guards.forceClearStreamVerdict 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.
CommunityOverlay.SourcesTab (cyclomatic 19) desktop/src/components/layout/CommunityOverlay.tsx:374— CommunityOverlay.SourcesTab 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 4 function literals inside it that branch (lines 423, 386, 391, …). 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.
ThreeColumnLayout.LeftSidebar (cyclomatic 19) desktop/src/components/layout/ThreeColumnLayout.tsx:177— ThreeColumnLayout.LeftSidebar 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 15 function literals inside it that branch (lines 224, 256, 257, …). 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. This is NOT this file's highest cyclomatic complexity: ThreeColumnLayout.NavSvgIcon (cyclomatic 24) 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.
useAudioPlayer.useAudioPlayer (cyclomatic 19) desktop/src/hooks/useAudioPlayer.ts:31— useAudioPlayer.useAudioPlayer has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 91, 173, 43, …). 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.
SkillsPage.SkillsPage (cyclomatic 19) desktop/src/pages/SkillsPage.tsx:77— SkillsPage.SkillsPage has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 205, 110, 122, …). 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.
ChannelGateway._should_reply (cyclomatic 18) backend/channels/gateway.py:1164— ChannelGateway._should_reply 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.
domain_rules.compute_domain_rules (cyclomatic 18) backend/core/code_intel/domain_rules.py:136— domain_rules.compute_domain_rules 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.
ddd_entry_lifecycle.assess_decay (cyclomatic 18) backend/core/ddd_entry_lifecycle.py:855— ddd_entry_lifecycle.assess_decay 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.
ddd_entry_lifecycle._strip_entries (cyclomatic 18) backend/core/ddd_entry_lifecycle.py:1789— ddd_entry_lifecycle._strip_entries 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.
LifecycleManager._check_streaming_timeout (cyclomatic 18) backend/core/lifecycle_manager.py:653— LifecycleManager._check_streaming_timeout 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.
PluginManager.sync_git_marketplace (cyclomatic 18) backend/core/plugin_manager.py:118— PluginManager.sync_git_marketplace 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.
security_hooks._is_dangerous_rm (cyclomatic 18) backend/core/security_hooks.py:99— security_hooks._is_dangerous_rm 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.
SessionRouter._evict_idle (cyclomatic 18) backend/core/session_router.py:2431— SessionRouter._evict_idle 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.
SkillManager._scan_tier (cyclomatic 18) backend/core/skill_manager.py:576— SkillManager._scan_tier 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.
ContextHealthHook._detect_stale_memory_claims (cyclomatic 18) backend/hooks/context_health_hook.py:2941— ContextHealthHook._detect_stale_memory_claims 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.
data_point_folding._fold_one_family (cyclomatic 18) backend/hooks/data_point_folding.py:201— data_point_folding._fold_one_family 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.
DistillationTriggerHook._extract_lessons (cyclomatic 18) backend/hooks/distillation_hook.py:1161— DistillationTriggerHook._extract_lessons 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.
swarmai_monthly_report._collect_pipeline_metrics (cyclomatic 18) backend/jobs/handlers/swarmai_monthly_report.py:153— swarmai_monthly_report._collect_pipeline_metrics 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.
pipelines.pipeline_run_detail (cyclomatic 18) backend/routers/pipelines.py:645— pipelines.pipeline_run_detail 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.
artifact_cli.purge_garbage_runs (cyclomatic 18) backend/scripts/artifact_cli.py:1469— artifact_cli.purge_garbage_runs 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.
completion_gate.completion_surface_verdict (cyclomatic 18) backend/scripts/completion_gate.py:59— completion_gate.completion_surface_verdict 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.
context_recall_cli.main (cyclomatic 18) backend/scripts/context_recall_cli.py:52— context_recall_cli.main 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.
publish_dashboard.generate_html (cyclomatic 18) backend/skills/s_pollinate/scripts/publish_dashboard.py:194— publish_dashboard.generate_html 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.
ai_ready_helpers.blind_spot_scan (cyclomatic 18) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:947— ai_ready_helpers.blind_spot_scan 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.
MarkdownRenderer.MermaidDiagram (cyclomatic 18) REDACTED:238— MarkdownRenderer.MermaidDiagram has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 316, 284, 247, …). 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.
ErrorBoundary.ApiError (cyclomatic 18) desktop/src/components/common/ErrorBoundary.tsx:154— ErrorBoundary.ApiError has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 155, 165). 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.
chat.consumeSSEStream (cyclomatic 18) desktop/src/services/chat.ts:267— chat.consumeSSEStream 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.
uiCommands.dispatchUiCommand (cyclomatic 18) desktop/src/utils/uiCommands.ts:99— uiCommands.dispatchUiCommand 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.
HistoryOverlay.HistoryContent (cyclomatic 18) desktop/src/components/layout/HistoryOverlay.tsx:59— HistoryOverlay.HistoryContent has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 91, 117, 138, …). 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.
JobsRunsOverlay.JobsRunsContent (cyclomatic 18) desktop/src/components/layout/JobsRunsOverlay.tsx:59— JobsRunsOverlay.JobsRunsContent has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 74, 93, 145, …). 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.
JobsRunsOverlay.JobDetailDrawer (cyclomatic 18) desktop/src/components/layout/JobsRunsOverlay.tsx:316— JobsRunsOverlay.JobDetailDrawer has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 4 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.
TerminalPanel.TerminalPanel (cyclomatic 18) desktop/src/components/terminal/TerminalPanel.tsx:23— TerminalPanel.TerminalPanel has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 57, 70, 123, …). 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.
useReviewMode.useReviewMode (cyclomatic 18) desktop/src/hooks/useReviewMode.ts:75— useReviewMode.useReviewMode 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 8 function literals inside it that branch (lines 170, 163, 83, …). 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.
CommentPopover.CommentPopover (cyclomatic 18) desktop/src/components/common/CommentPopover.tsx:34— CommentPopover.CommentPopover has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 96, 52, 77, …). 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.
CanvasOutputRail.OutputRow (cyclomatic 18) desktop/src/components/file-viewer/CanvasOutputRail.tsx:109— CanvasOutputRail.OutputRow has cyclomatic complexity 18 (threshold 15). Of this number, 16 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.
sentenceSplitter.extractSentences (cyclomatic 18) desktop/src/utils/sentenceSplitter.ts:127— sentenceSplitter.extractSentences 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.
SessionTabBar.SessionTabBar (cyclomatic 18) desktop/src/pages/chat/components/SessionTabBar.tsx:27— SessionTabBar.SessionTabBar has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 69, 40, 48, …). 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.
AttachedFileChips.AttachedFileChips (cyclomatic 18) desktop/src/components/chat/AttachedFileChips.tsx:174— AttachedFileChips.AttachedFileChips has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 184, 197, 220, …). 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.
SlackChannelAdapter._normalize_event (cyclomatic 17) REDACTED:586— SlackChannelAdapter._normalize_event 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.
dead_code._is_entry_point (cyclomatic 17) backend/core/code_intel/dead_code.py:59— dead_code._is_entry_point 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.
freshness.detect_spec_details_staleness (cyclomatic 17) backend/core/code_intel/freshness.py:224— freshness.detect_spec_details_staleness 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.
ddd_cultivation.backfill_proposals (cyclomatic 17) backend/core/ddd_cultivation.py:2196— ddd_cultivation.backfill_proposals 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.
escalation_ladder.decide_escalation (cyclomatic 17) backend/core/evolution/escalation_ladder.py:75— escalation_ladder.decide_escalation 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.
file_change_classifier.parse_bash_write_targets (cyclomatic 17) backend/core/file_change_classifier.py:73— file_change_classifier.parse_bash_write_targets 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.
needs_human_review.needs_human_review_batch (cyclomatic 17) backend/core/needs_human_review.py:369— needs_human_review.needs_human_review_batch 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.
proactive_intelligence._get_signal_highlights (cyclomatic 17) backend/core/proactive_intelligence.py:556— proactive_intelligence._get_signal_highlights 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.
ProposalFeedbackTracker.compute_channel_stats (cyclomatic 17) backend/core/proposal_feedback.py:158— ProposalFeedbackTracker.compute_channel_stats 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_registry.kill_all_claude_processes (cyclomatic 17) backend/core/session_registry.py:175— session_registry.kill_all_claude_processes 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.
SessionRouter.drain_pending (cyclomatic 17) backend/core/session_router.py:2678— SessionRouter.drain_pending 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.
SessionUnit._pid_watchdog_loop (cyclomatic 17) backend/core/session_unit.py:1288— SessionUnit._pid_watchdog_loop 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.
SwarmWorkspaceManager._seed_hive_from_package (cyclomatic 17) backend/core/swarm_workspace_manager.py:1243— SwarmWorkspaceManager._seed_hive_from_package 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.
DistillationTriggerHook._verify_claim_against_git (cyclomatic 17) backend/hooks/distillation_hook.py:1493— DistillationTriggerHook._verify_claim_against_git 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.
DistillationTriggerHook._apply_deliverable_reconciliation (cyclomatic 17) backend/hooks/distillation_hook.py:2117— DistillationTriggerHook._apply_deliverable_reconciliation 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.
EvolutionMaintenanceHook._size_evict_locked (cyclomatic 17) backend/hooks/evolution_maintenance_hook.py:793— EvolutionMaintenanceHook._size_evict_locked 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.
github_trending.fetch_github_trending (cyclomatic 17) backend/jobs/adapters/github_trending.py:47— github_trending.fetch_github_trending 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._resolve_credentials (cyclomatic 17) backend/jobs/bedrock.py:62— bedrock._resolve_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.
swarmai_monthly_report._collect_prior_month_metrics (cyclomatic 17) backend/jobs/handlers/swarmai_monthly_report.py:480— swarmai_monthly_report._collect_prior_month_metrics 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.
pollinate._build_card (cyclomatic 17) backend/routers/pollinate.py:490— pollinate._build_card 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.
system._probe_ada_details (cyclomatic 17) backend/routers/system.py:751— system._probe_ada_details 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.
artifact_cli._next_stage_continuation (cyclomatic 17) backend/scripts/artifact_cli.py:617— artifact_cli._next_stage_continuation 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.
artifact_cli._lookup_already_committed (cyclomatic 17) backend/scripts/artifact_cli.py:2852— artifact_cli._lookup_already_committed 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.
migrate_memory_lifecycle.migrate_file (cyclomatic 17) backend/scripts/migrate_memory_lifecycle.py:95— migrate_memory_lifecycle.migrate_file 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.
migrate_skills.migrate_skill (cyclomatic 17) backend/scripts/migrate_skills.py:400— migrate_skills.migrate_skill 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.
scan.main (cyclomatic 17) backend/skills/s_context-hygiene/scripts/scan.py:201— scan.main 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.
distribute.main (cyclomatic 17) backend/skills/s_ddd-distribute/scripts/distribute.py:57— distribute.main 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.
format_recommend.recommend (cyclomatic 17) backend/skills/s_pollinate/scripts/format_recommend.py:158— format_recommend.recommend 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.
publish_meta.generate_publish_info (cyclomatic 17) backend/skills/s_pollinate/scripts/publish_meta.py:143— publish_meta.generate_publish_info 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.
style-extract.extract_fonts (cyclomatic 17) backend/skills/s_pptx/scripts/style-extract.py:53— style-extract.extract_fonts 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.
SettingsTabs.SettingsTabs (cyclomatic 17) desktop/src/components/settings/SettingsTabs.tsx:58— SettingsTabs.SettingsTabs 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 103, 63, 72, …). 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.
EvalDashboard.ContextHealthTab (cyclomatic 17) desktop/src/pages/EvalDashboard.tsx:1084— EvalDashboard.ContextHealthTab 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, 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.
EvolutionMessage.EvolutionMessage (cyclomatic 17) desktop/src/components/chat/EvolutionMessage.tsx:82— EvolutionMessage.EvolutionMessage 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.
attention_authority._collect_governance (cyclomatic 16) backend/core/attention_authority.py:195— attention_authority._collect_governance 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.
BackupManager._restore_impl (cyclomatic 16) backend/core/backup_manager.py:471— BackupManager._restore_impl 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.
claude_environment._configure_claude_environment (cyclomatic 16) backend/core/claude_environment.py:184— claude_environment._configure_claude_environment 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.
community_data.build_feed (cyclomatic 16) backend/core/community_data.py:564— community_data.build_feed 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.
CompactionGuard.check (cyclomatic 16) backend/core/compaction_guard.py:609— CompactionGuard.check 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.
ContextDirectoryLoader._assemble_from_sources (cyclomatic 16) backend/core/context_directory_loader.py:869— ContextDirectoryLoader._assemble_from_sources 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.
ddd_cultivation._locate_target_entry (cyclomatic 16) backend/core/ddd_cultivation.py:1546— ddd_cultivation._locate_target_entry 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.
ddd_cultivation.apply_retire_proposal (cyclomatic 16) backend/core/ddd_cultivation.py:1678— ddd_cultivation.apply_retire_proposal 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.
ddd_entry_lifecycle.reclaim_duplicate_entries (cyclomatic 16) backend/core/ddd_entry_lifecycle.py:1509— ddd_entry_lifecycle.reclaim_duplicate_entries 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.
ddd_packager.emit_target_aim (cyclomatic 16) backend/core/ddd_packager.py:1500— ddd_packager.emit_target_aim 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.
EvolutionOptimizer._is_quality_correction (cyclomatic 16) backend/core/evolution_optimizer.py:687— EvolutionOptimizer._is_quality_correction 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.
knowledge_store.chunk_markdown (cyclomatic 16) backend/core/knowledge_store.py:67— knowledge_store.chunk_markdown 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.
LifecycleManager._scan_unprocessed_sessions (cyclomatic 16) backend/core/lifecycle_manager.py:1642— LifecycleManager._scan_unprocessed_sessions 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.
LifecycleManager._get_mcp_server_patterns (cyclomatic 16) backend/core/lifecycle_manager.py:1901— LifecycleManager._get_mcp_server_patterns 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.
ManifestLoader.ensure_dependencies (cyclomatic 16) backend/core/manifest_loader.py:161— ManifestLoader.ensure_dependencies 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.
proactive_intelligence._extract_jobs_summary (cyclomatic 16) backend/core/proactive_intelligence.py:1703— proactive_intelligence._extract_jobs_summary 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.
recall_multi._render_domain_hits (cyclomatic 16) backend/core/recall_multi.py:625— recall_multi._render_domain_hits 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.
session_harvest._parse_draft (cyclomatic 16) backend/core/session_harvest.py:104— session_harvest._parse_draft 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.
ui_actions.format_attention_for_agent (cyclomatic 16) backend/core/ui_actions.py:773— ui_actions.format_attention_for_agent 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.
SQLiteDatabase._run_data_cleanups (cyclomatic 16) backend/database/sqlite.py:3248— SQLiteDatabase._run_data_cleanups 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.
ContextHealthHook._check_governance_budgets (cyclomatic 16) backend/hooks/context_health_hook.py:3291— ContextHealthHook._check_governance_budgets 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.
DistillationTriggerHook._extract_decisions (cyclomatic 16) backend/hooks/distillation_hook.py:1126— DistillationTriggerHook._extract_decisions 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.
DistillationTriggerHook._supersede_by_topic (cyclomatic 16) backend/hooks/distillation_hook.py:1276— DistillationTriggerHook._supersede_by_topic 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.
DistillationTriggerHook._reconcile_open_threads_from_deliverables (cyclomatic 16) backend/hooks/distillation_hook.py:2053— DistillationTriggerHook._reconcile_open_threads_from_deliverables 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.
executor._handle_maintenance (cyclomatic 16) REDACTED:1075— executor._handle_maintenance 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.
session_health_probe.run_session_health_probe (cyclomatic 16) REDACTED:172— session_health_probe.run_session_health_probe 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.
swarmai_monthly_report._collect_cultivation_metrics (cyclomatic 16) backend/jobs/handlers/swarmai_monthly_report.py:213— swarmai_monthly_report._collect_cultivation_metrics 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.
swarmai_monthly_report._collect_eval_metrics (cyclomatic 16) backend/jobs/handlers/swarmai_monthly_report.py:297— swarmai_monthly_report._collect_eval_metrics 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.
scheduler.load_user_context (cyclomatic 16) backend/jobs/scheduler.py:242— scheduler.load_user_context 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.
self_tune.track_signal_usage (cyclomatic 16) backend/jobs/self_tune.py:176— self_tune.track_signal_usage 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.
self_tune.suggest_new_feeds (cyclomatic 16) backend/jobs/self_tune.py:349— self_tune.suggest_new_feeds 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.
system.get_system_status (cyclomatic 16) backend/routers/system.py:150— system.get_system_status 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.
check_migration_class.check_migration_class (cyclomatic 16) backend/scripts/check_migration_class.py:197— check_migration_class.check_migration_class 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.
eval_runner.eval_trajectory (cyclomatic 16) backend/scripts/eval_runner.py:440— eval_runner.eval_trajectory 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.
eval_runner._load_rules_context (cyclomatic 16) backend/scripts/eval_runner.py:803— eval_runner._load_rules_context 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.
judge_telemetry_report.render (cyclomatic 16) backend/scripts/judge_telemetry_report.py:101— judge_telemetry_report.render 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.
pipeline_analytics.analyze_estimation_accuracy (cyclomatic 16) backend/scripts/pipeline_analytics.py:629— pipeline_analytics.analyze_estimation_accuracy 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.
DocxXMLEditor._inject_attributes_to_nodes (cyclomatic 16) backend/skills/s_docx/scripts/document.py:116— DocxXMLEditor._inject_attributes_to_nodes has cyclomatic complexity 16 (threshold 15). 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.
SelfLoopsHealthEngine._check_knowledge (cyclomatic 16) backend/skills/s_loops-health/scripts/loops_health_check.py:378— SelfLoopsHealthEngine._check_knowledge 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.
ShapeData.__init__ (cyclomatic 16) backend/skills/s_pptx/scripts/inventory.py:388— ShapeData.__init__ 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.
steeringify.extract_corrections (cyclomatic 16) backend/skills/s_steeringify/steeringify.py:94— steeringify.extract_corrections 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.
lint_doc_frontmatter.check_file (cyclomatic 16) scripts/lint_doc_frontmatter.py:47— lint_doc_frontmatter.check_file 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.
CMBrainOverlay.ProposalCard (cyclomatic 16) desktop/src/components/layout/CMBrainOverlay.tsx:392— CMBrainOverlay.ProposalCard 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.
CMBrainOverlay.ContextTab (cyclomatic 16) desktop/src/components/layout/CMBrainOverlay.tsx:520— CMBrainOverlay.ContextTab has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 556). 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.
CMBrainOverlay.KnowledgeGraph (cyclomatic 16) desktop/src/components/layout/CMBrainOverlay.tsx:669— CMBrainOverlay.KnowledgeGraph has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 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.
agents.toSnakeCase (cyclomatic 16) desktop/src/services/agents.ts:5— agents.toSnakeCase 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.
todos.toSnakeCase (cyclomatic 16) desktop/src/services/todos.ts:53— todos.toSnakeCase 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.
HtmlRenderer.HtmlRenderer (cyclomatic 16) REDACTED:94— HtmlRenderer.HtmlRenderer has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 4 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.
useReferencedFiles.useReferencedFiles (cyclomatic 16) desktop/src/hooks/useReferencedFiles.ts:263— useReferencedFiles.useReferencedFiles 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 6 function literals inside it that branch (lines 286, 276, 283, …). 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.
TSCCModules.RecallTab (cyclomatic 16) desktop/src/pages/chat/components/TSCCModules.tsx:369— TSCCModules.RecallTab has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 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.
FileBrowser.FileBrowser (cyclomatic 16) desktop/src/components/workspace/FileBrowser.tsx:99— FileBrowser.FileBrowser has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 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. This is NOT this file's highest cyclomatic complexity: FileBrowser.getFileIcon (cyclomatic 22) 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.
HackComment desktop/src/components/layout/__tests__/NewBrainOverlay.interaction.test.tsx:184— // hack existed because the legacy overlay stayed mounted and `open` didn't observably — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
useChatStreamingLifecycle.useChatStreamingLifecycle (cognitive 1088) desktop/src/hooks/useChatStreamingLifecycle.ts:1030— useChatStreamingLifecycle.useChatStreamingLifecycle has cognitive complexity 1088 (threshold 15). Drivers by points: if/else 383 (810 pts), ternaries 62 (147 pts), boolean chains 106, error handling 8 (21 pts), loops 3 (4 pts) (nesting depth added 526). Most of this is not in the body itself: 6 of the 1088 points are its own statements and the rest belongs to 60 function literals inside it that branch (lines 2302, 1235, 3756, …). 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.
ChatPage.ChatPage (cognitive 710) desktop/src/pages/ChatPage.tsx:129— ChatPage.ChatPage has cognitive complexity 710 (threshold 15). Drivers by points: if/else 277 (443 pts), ternaries 56 (121 pts), boolean chains 101, error handling 14 (23 pts), loops 8 (17 pts), match/switch 3 (5 pts) (nesting depth added 251). Of this number, 19 points are the body's own statements and 691 belong to 87 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.
pipeline_validator.validate (cognitive 620) backend/scripts/pipeline_validator.py:2603— pipeline_validator.validate has cognitive complexity 620 (threshold 15). Drivers by points: if/else 150 (459 pts), loops 11 (53 pts), boolean chains 51, ternaries 9 (46 pts), error handling 3 (11 pts) (nesting depth added 396). 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.
StreamingOrchestrator._read_formatted_response (cognitive 594) backend/core/streaming_orchestrator.py:525— StreamingOrchestrator._read_formatted_response has cognitive complexity 594 (threshold 15). Drivers by points: if/else 85 (355 pts), error handling 18 (69 pts), loops 13 (61 pts), boolean chains 55, ternaries 16 (54 pts) (nesting depth added 407). 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.
artifact_cli.cmd_run_update (cognitive 410) backend/scripts/artifact_cli.py:1797— artifact_cli.cmd_run_update has cognitive complexity 410 (threshold 15). Drivers by points: if/else 85 (274 pts), boolean chains 39, ternaries 8 (35 pts), loops 8 (32 pts), error handling 9 (30 pts) (nesting depth added 261). 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.
ChannelGateway._handle_conversation (cognitive 328) backend/channels/gateway.py:1619— ChannelGateway._handle_conversation has cognitive complexity 328 (threshold 15). Drivers by points: if/else 72 (203 pts), error handling 18 (45 pts), boolean chains 44, loops 6 (18 pts), ternaries 11 (18 pts) (nesting depth added 177). 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.
artifact_cli.cmd_run_report (cognitive 280) backend/scripts/artifact_cli.py:3992— artifact_cli.cmd_run_report has cognitive complexity 280 (threshold 15). Drivers by points: if/else 83 (147 pts), loops 26 (52 pts), boolean chains 45, ternaries 17 (29 pts), error handling 3 (7 pts) (nesting depth added 106). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
html2pptx.extractSlideData (cognitive 246) backend/skills/s_pptx/scripts/html2pptx.js:244— html2pptx.extractSlideData has cognitive complexity 246 (threshold 15). Drivers by points: if/else 82 (160 pts), boolean chains 56, ternaries 11 (28 pts), loops 1 (2 pts) (nesting depth added 96). Most of this is not in the body itself: 0 of the 246 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 534, 422, 365, …). 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.
FileEditorCore.FileEditorCore (cognitive 208) desktop/src/components/common/FileEditorCore.tsx:606— FileEditorCore.FileEditorCore has cognitive complexity 208 (threshold 15). Drivers by points: if/else 71 (88 pts), boolean chains 69, ternaries 19 (36 pts), error handling 7 (8 pts), loops 4 (7 pts) (nesting depth added 38). Of this number, 75 points are the body's own statements and 133 belong to 47 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.
evolution_optimizer._run_evolution_cycle_locked (cognitive 202) backend/core/evolution_optimizer.py:1148— evolution_optimizer._run_evolution_cycle_locked has cognitive complexity 202 (threshold 15). Drivers by points: if/else 53 (137 pts), loops 15 (31 pts), boolean chains 16, error handling 10 (16 pts), ternaries 1 (2 pts) (nesting depth added 107). 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.
proactive_intelligence.build_session_briefing_data (cognitive 172) backend/core/proactive_intelligence.py:1884— proactive_intelligence.build_session_briefing_data has cognitive complexity 172 (threshold 15). Drivers by points: if/else 37 (101 pts), error handling 13 (34 pts), loops 11 (21 pts), ternaries 3 (10 pts), boolean chains 6 (nesting depth added 102). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
proactive_intelligence._advance_pipeline_recovery_state (cognitive 171) backend/core/proactive_intelligence.py:816— proactive_intelligence._advance_pipeline_recovery_state has cognitive complexity 171 (threshold 15). Drivers by points: if/else 27 (91 pts), error handling 12 (49 pts), boolean chains 20, ternaries 2 (8 pts), loops 2 (3 pts) (nesting depth added 108). 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.
DistillationTriggerHook._distill_files (cognitive 170) backend/hooks/distillation_hook.py:451— DistillationTriggerHook._distill_files has cognitive complexity 170 (threshold 15). Drivers by points: if/else 34 (79 pts), loops 17 (45 pts), ternaries 6 (29 pts), boolean chains 10, error handling 3 (7 pts) (nesting depth added 100). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatInput.ChatInput (cognitive 154) desktop/src/pages/chat/components/ChatInput.tsx:164— ChatInput.ChatInput has cognitive complexity 154 (threshold 15). Drivers by points: if/else 62 (76 pts), boolean chains 53, ternaries 16 (23 pts), error handling 1, loops 1 (nesting depth added 21). Of this number, 41 points are the body's own statements and 113 belong to 38 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.
security_hooks._segment_is_irreversible (cognitive 135) backend/core/security_hooks.py:284— security_hooks._segment_is_irreversible has cognitive complexity 135 (threshold 15). Drivers by points: if/else 36 (109 pts), boolean chains 13, loops 6 (13 pts) (nesting depth added 80). 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.
SessionUnit.send (cognitive 134) backend/core/session_unit.py:1867— SessionUnit.send has cognitive complexity 134 (threshold 15). Drivers by points: if/else 43 (94 pts), loops 7 (21 pts), boolean chains 10, error handling 3 (6 pts), ternaries 2 (3 pts) (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionRouter.run_conversation (cognitive 133) backend/core/session_router.py:2782— SessionRouter.run_conversation has cognitive complexity 133 (threshold 15). Drivers by points: if/else 45 (69 pts), boolean chains 26, error handling 8 (20 pts), ternaries 12 (17 pts), loops 1 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
eval_runner.generate_html_report (cognitive 133) backend/scripts/eval_runner.py:2163— eval_runner.generate_html_report has cognitive complexity 133 (threshold 15). Drivers by points: ternaries 34 (55 pts), if/else 33 (54 pts), loops 14 (21 pts), boolean chains 3 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileViewer.FileViewerImpl (cognitive 130) desktop/src/components/file-viewer/FileViewer.tsx:126— FileViewer.FileViewerImpl has cognitive complexity 130 (threshold 15). Drivers by points: if/else 50 (74 pts), boolean chains 32, ternaries 6 (13 pts), error handling 4 (8 pts), loops 2 (3 pts) (nesting depth added 36). Of this number, 23 points are the body's own statements and 107 belong to 14 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.
SkillsPage.GenerateSkillForm (cognitive 126) desktop/src/pages/SkillsPage.tsx:327— SkillsPage.GenerateSkillForm has cognitive complexity 126 (threshold 15). Drivers by points: ternaries 28 (49 pts), if/else 36 (44 pts), boolean chains 31, error handling 2 (nesting depth added 29). Of this number, 37 points are the body's own statements and 89 belong to 20 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.
D2 · Cognitive Complexity· main (cognitive 122) · ×1
main (cognitive 122) backend/skills/s_browser-agent/browser-agent.mjs:304— main has cognitive complexity 122 (threshold 15). Drivers by points: if/else 34 (63 pts), ternaries 11 (25 pts), error handling 7 (17 pts), boolean chains 16, match/switch 1 (nesting depth added 53). Of this number, 115 points are the body's own statements and 7 belong to 8 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.
style-extract.extract_shapes_summary (cognitive 114) backend/skills/s_pptx/scripts/style-extract.py:81— style-extract.extract_shapes_summary has cognitive complexity 114 (threshold 15). Drivers by points: if/else 13 (53 pts), ternaries 8 (32 pts), loops 9 (29 pts) (nesting depth added 84). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SessionMiner._extract_skill_invocations (cognitive 110) REDACTED:287— SessionMiner._extract_skill_invocations has cognitive complexity 110 (threshold 15). Drivers by points: if/else 14 (70 pts), loops 6 (22 pts), ternaries 3 (14 pts), boolean chains 4 (nesting depth added 83). 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.
code_intel_reindex.reindex_projects (cognitive 108) backend/jobs/handlers/code_intel_reindex.py:20— code_intel_reindex.reindex_projects has cognitive complexity 108 (threshold 15). Drivers by points: if/else 19 (54 pts), ternaries 5 (21 pts), error handling 4 (18 pts), loops 3 (8 pts), boolean chains 7 (nesting depth added 70). 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.
skill_metrics_hook._detect_skill_invocations (cognitive 102) backend/hooks/skill_metrics_hook.py:112— skill_metrics_hook._detect_skill_invocations has cognitive complexity 102 (threshold 15). Drivers by points: if/else 19 (67 pts), loops 8 (19 pts), ternaries 3 (12 pts), boolean chains 4 (nesting depth added 68). 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.
adversarial_meta.check_adversarial_health (cognitive 101) backend/core/adversarial_meta.py:21— adversarial_meta.check_adversarial_health has cognitive complexity 101 (threshold 15). Drivers by points: if/else 15 (40 pts), ternaries 4 (26 pts), error handling 4 (16 pts), loops 6 (16 pts), boolean chains 3 (nesting depth added 69). 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.
pipeline_validator._check_depth (cognitive 99) backend/scripts/pipeline_validator.py:1995— pipeline_validator._check_depth has cognitive complexity 99 (threshold 15). Drivers by points: if/else 27 (76 pts), boolean chains 19, loops 1 (4 pts) (nesting depth added 52). 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.
workspace_api.resolve_path_to_physical (cognitive 97) backend/routers/workspace_api.py:992— workspace_api.resolve_path_to_physical has cognitive complexity 97 (threshold 15). Drivers by points: if/else 23 (62 pts), loops 6 (16 pts), error handling 3 (12 pts), boolean chains 7 (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.
artifact_cli._extract_run_metrics (cognitive 97) backend/scripts/artifact_cli.py:4783— artifact_cli._extract_run_metrics has cognitive complexity 97 (threshold 15). Drivers by points: if/else 25 (55 pts), ternaries 10 (29 pts), boolean chains 7, loops 3 (4 pts), error handling 1 (2 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
polly.synthesize (cognitive 94) backend/skills/s_pollinate/scripts/tts/backends/polly.py:246— polly.synthesize has cognitive complexity 94 (threshold 15). Drivers by points: if/else 19 (66 pts), loops 6 (21 pts), error handling 1 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 66). 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.
SummarizationPipeline._extract_files_modified (cognitive 93) backend/core/summarization.py:422— SummarizationPipeline._extract_files_modified has cognitive complexity 93 (threshold 15). Drivers by points: if/else 15 (66 pts), loops 5 (17 pts), boolean chains 10 (nesting depth added 63). 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.
PromptBuilder.build_system_prompt (cognitive 89) REDACTED:825— PromptBuilder.build_system_prompt has cognitive complexity 89 (threshold 15). Drivers by points: if/else 35 (50 pts), boolean chains 16, ternaries 5 (12 pts), error handling 7 (10 pts), loops 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.
useChatStreamingLifecycle.updateMessages (cognitive 89) desktop/src/hooks/useChatStreamingLifecycle.ts:366— useChatStreamingLifecycle.updateMessages has cognitive complexity 89 (threshold 15). Drivers by points: if/else 24 (59 pts), ternaries 4 (12 pts), boolean chains 10, loops 4 (8 pts) (nesting depth added 47). Most of this is not in the body itself: 0 of the 89 points are its own statements and the rest belongs to one function literal inside it that branches (line 372). 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.
executor.execute_job (cognitive 88) REDACTED:154— executor.execute_job has cognitive complexity 88 (threshold 15). Drivers by points: ternaries 22 (48 pts), if/else 14 (26 pts), boolean chains 9, error handling 3 (5 pts) (nesting depth added 40). 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.
TabView.TabViewImpl (cognitive 87) desktop/src/pages/chat/components/TabView.tsx:208— TabView.TabViewImpl has cognitive complexity 87 (threshold 15). Drivers by points: ternaries 17 (40 pts), boolean chains 24, if/else 17 (23 pts) (nesting depth added 29). Most of this is not in the body itself: 15 of the 87 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 486, 290, 381, …). 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.
pipeline_validator.validate_artifact_data (cognitive 82) backend/scripts/pipeline_validator.py:1270— pipeline_validator.validate_artifact_data has cognitive complexity 82 (threshold 15). Drivers by points: if/else 28 (67 pts), boolean chains 10, loops 3 (5 pts) (nesting depth added 41). 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.
ddd_entry_lifecycle.parse_entries (cognitive 81) backend/core/ddd_entry_lifecycle.py:521— ddd_entry_lifecycle.parse_entries has cognitive complexity 81 (threshold 15). Drivers by points: if/else 14 (48 pts), error handling 2 (12 pts), loops 3 (9 pts), boolean chains 7, ternaries 1 (5 pts) (nesting depth added 54). 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.
swarmai_monthly_report._generate_monthly_report (cognitive 81) backend/jobs/handlers/swarmai_monthly_report.py:589— swarmai_monthly_report._generate_monthly_report has cognitive complexity 81 (threshold 15). Drivers by points: if/else 36 (47 pts), ternaries 14 (26 pts), loops 3 (6 pts), boolean chains 2 (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.
scheduler.run_scheduler (cognitive 81) backend/jobs/scheduler.py:472— scheduler.run_scheduler has cognitive complexity 81 (threshold 15). Drivers by points: if/else 26 (52 pts), loops 10 (17 pts), boolean chains 7, ternaries 1 (5 pts) (nesting depth added 37). 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.
pipeline_validator._check_semantic_depth (cognitive 81) backend/scripts/pipeline_validator.py:2242— pipeline_validator._check_semantic_depth has cognitive complexity 81 (threshold 15). Drivers by points: if/else 20 (65 pts), boolean chains 9, loops 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 49). 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.
ContextHealthHook._auto_cultivate_session_signals (cognitive 78) backend/hooks/context_health_hook.py:1163— ContextHealthHook._auto_cultivate_session_signals has cognitive complexity 78 (threshold 15). Drivers by points: if/else 19 (44 pts), error handling 5 (15 pts), loops 6 (15 pts), boolean chains 3, ternaries 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.
security_hooks._pending_commit_paths (cognitive 77) backend/core/security_hooks.py:1729— security_hooks._pending_commit_paths has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (55 pts), boolean chains 8, loops 5 (7 pts), ternaries 2 (4 pts), error handling 3 (nesting depth added 39). 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.
tool_summarizer.summarize_tool_use (cognitive 76) backend/core/tool_summarizer.py:150— tool_summarizer.summarize_tool_use has cognitive complexity 76 (threshold 15). Drivers by points: if/else 20 (35 pts), ternaries 13 (27 pts), boolean chains 14 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
browser-agent.compressDOM (cognitive 75) backend/skills/s_browser-agent/browser-agent.mjs:127— browser-agent.compressDOM has cognitive complexity 75 (threshold 15). Drivers by points: if/else 30 (54 pts), boolean chains 12, loops 3 (4 pts), ternaries 2 (4 pts), error handling 1 (nesting depth added 27). Most of this is not in the body itself: 0 of the 75 points are its own statements and the rest belongs to one function literal inside it that branches (line 128). 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.
BackendStartupOverlay.BackendStartupOverlay (cognitive 74) desktop/src/components/common/BackendStartupOverlay.tsx:241— BackendStartupOverlay.BackendStartupOverlay has cognitive complexity 74 (threshold 15). Drivers by points: if/else 42 (52 pts), boolean chains 13, ternaries 4 (6 pts), error handling 3 (nesting depth added 12). Most of this is not in the body itself: 9 of the 74 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 438, 403, 528, …). 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.
DddCultivationOrchestrator._auto_apply_ddd_proposals (cognitive 72) backend/core/ddd_orchestrator.py:582— DddCultivationOrchestrator._auto_apply_ddd_proposals has cognitive complexity 72 (threshold 15). Drivers by points: if/else 15 (44 pts), loops 6 (16 pts), error handling 3 (8 pts), boolean chains 4 (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.
confidence_score.calculate_score (cognitive 72) backend/skills/s_autonomous-pipeline/scripts/confidence_score.py:71— confidence_score.calculate_score has cognitive complexity 72 (threshold 15). Drivers by points: if/else 33 (42 pts), boolean chains 23, ternaries 6 (7 pts) (nesting depth added 10). 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.
chat.sse_with_heartbeat (cognitive 70) backend/routers/chat.py:336— chat.sse_with_heartbeat has cognitive complexity 70 (threshold 15). Drivers by points: if/else 12 (38 pts), error handling 7 (22 pts), loops 2 (5 pts), ternaries 1 (3 pts), boolean chains 2 (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.
executor._format_briefing_slack_message (cognitive 69) REDACTED:1357— executor._format_briefing_slack_message has cognitive complexity 69 (threshold 15). Drivers by points: if/else 16 (27 pts), ternaries 6 (22 pts), loops 7 (18 pts), boolean chains 1, error handling 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_health._apply_report (cognitive 69) backend/jobs/handlers/memory_health.py:493— memory_health._apply_report has cognitive complexity 69 (threshold 15). Drivers by points: if/else 21 (49 pts), loops 7 (13 pts), error handling 1 (4 pts), boolean chains 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.
pollinate_validator.validate_delivery (cognitive 69) backend/skills/s_pollinate/scripts/pollinate_validator.py:182— pollinate_validator.validate_delivery has cognitive complexity 69 (threshold 15). Drivers by points: if/else 32 (50 pts), loops 5 (9 pts), boolean chains 5, error handling 2 (5 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.
ContextHealthHook._auto_cultivate_pipeline_lessons (cognitive 68) backend/hooks/context_health_hook.py:788— ContextHealthHook._auto_cultivate_pipeline_lessons has cognitive complexity 68 (threshold 15). Drivers by points: if/else 18 (45 pts), error handling 3 (10 pts), loops 4 (9 pts), ternaries 2 (4 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ContextHealthHook._track_memory_usage_locked (cognitive 68) backend/hooks/context_health_hook.py:1593— ContextHealthHook._track_memory_usage_locked has cognitive complexity 68 (threshold 15). Drivers by points: if/else 15 (31 pts), error handling 8 (23 pts), loops 5 (13 pts), boolean chains 1 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
artifact_cli.cmd_publish (cognitive 68) backend/scripts/artifact_cli.py:337— artifact_cli.cmd_publish has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (45 pts), error handling 8 (17 pts), boolean chains 6 (nesting depth added 31). To reduce it, split the body into named stages: move each independent 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_ready_helpers.select_verification_tasks (cognitive 68) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2905— ai_ready_helpers.select_verification_tasks has cognitive complexity 68 (threshold 15). Drivers by points: if/else 21 (52 pts), boolean chains 9, loops 5 (6 pts), error handling 1 (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.
ddd_entry_lifecycle.inject_entry_metadata (cognitive 66) backend/core/ddd_entry_lifecycle.py:642— ddd_entry_lifecycle.inject_entry_metadata has cognitive complexity 66 (threshold 15). Drivers by points: if/else 15 (45 pts), loops 5 (13 pts), boolean chains 8 (nesting depth added 38). 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.
MessageStore._applyMerge (cognitive 66) desktop/src/stores/MessageStore.ts:892— MessageStore._applyMerge has cognitive complexity 66 (threshold 15). Drivers by points: if/else 16 (45 pts), loops 5 (10 pts), boolean chains 9, ternaries 1 (2 pts) (nesting depth added 35). 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, 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.
BaseSchemaValidator.validate_unique_ids (cognitive 65) backend/skills/s_pptx/ooxml/scripts/validation/base.py:186— BaseSchemaValidator.validate_unique_ids has cognitive complexity 65 (threshold 15). Drivers by points: if/else 13 (44 pts), loops 5 (11 pts), ternaries 2 (8 pts), error handling 1 (2 pts) (nesting depth added 44). 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.
DddCultivationOrchestrator._ch_entry_lifecycle (cognitive 64) backend/core/ddd_orchestrator.py:815— DddCultivationOrchestrator._ch_entry_lifecycle has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (43 pts), loops 3 (9 pts), error handling 2 (5 pts), ternaries 1 (5 pts), boolean chains 2 (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.
chat.consumeSSEStream (cognitive 63) desktop/src/services/chat.ts:267— chat.consumeSSEStream has cognitive complexity 63 (threshold 15). Drivers by points: if/else 10 (34 pts), error handling 4 (21 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 45). 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.
AuthConfigPanel.AuthConfigPanel (cognitive 63) desktop/src/components/settings/AuthConfigPanel.tsx:29— AuthConfigPanel.AuthConfigPanel has cognitive complexity 63 (threshold 15). Drivers by points: boolean chains 29, if/else 19 (27 pts), ternaries 6, error handling 1 (nesting depth added 8). Of this number, 22 points are the body's own statements and 41 belong to 8 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.
BaseSchemaValidator.validate_unique_ids (cognitive 62) backend/skills/s_docx/ooxml/scripts/validation/base.py:186— BaseSchemaValidator.validate_unique_ids has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (41 pts), loops 5 (11 pts), ternaries 2 (8 pts), error handling 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.
json_exporter.export_code_intel_json (cognitive 61) REDACTED:36— json_exporter.export_code_intel_json has cognitive complexity 61 (threshold 15). Drivers by points: if/else 18 (30 pts), error handling 8 (12 pts), loops 3 (9 pts), ternaries 5 (6 pts), boolean chains 4 (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.
main.lifespan (cognitive 61) backend/main.py:938— main.lifespan has cognitive complexity 61 (threshold 15). Drivers by points: if/else 27 (32 pts), error handling 17 (23 pts), boolean chains 5, loops 1 (nesting depth added 11). 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.
pipeline_analytics._load_all_metrics (cognitive 61) backend/scripts/pipeline_analytics.py:64— pipeline_analytics._load_all_metrics has cognitive complexity 61 (threshold 15). Drivers by points: if/else 12 (35 pts), error handling 4 (17 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 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.
sections.match_section_times (cognitive 61) backend/skills/s_pollinate/scripts/tts/sections.py:86— sections.match_section_times has cognitive complexity 61 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 8 (20 pts), boolean chains 4 (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.
ContextDirectoryLoader.ensure_directory (cognitive 60) backend/core/context_directory_loader.py:543— ContextDirectoryLoader.ensure_directory has cognitive complexity 60 (threshold 15). Drivers by points: if/else 16 (34 pts), error handling 7 (19 pts), boolean chains 4, loops 3 (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.
ProjectionLayer.project_skills (cognitive 60) backend/core/projection_layer.py:227— ProjectionLayer.project_skills has cognitive complexity 60 (threshold 15). Drivers by points: if/else 20 (38 pts), error handling 5 (12 pts), boolean chains 4, loops 3 (4 pts), ternaries 2 (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.
AgentFormModal.AgentFormModal (cognitive 59) desktop/src/components/common/AgentFormModal.tsx:36— AgentFormModal.AgentFormModal has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 20 (25 pts), boolean chains 23, if/else 9 (10 pts), error handling 1 (nesting depth added 6). Of this number, 27 points are the body's own statements and 32 belong to 7 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.
artifact_cli.cmd_run_commit (cognitive 58) backend/scripts/artifact_cli.py:2920— artifact_cli.cmd_run_commit has cognitive complexity 58 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 5 (9 pts), boolean chains 5, error handling 2 (4 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.
useUnifiedAttachments.useUnifiedAttachments (cognitive 58) desktop/src/hooks/useUnifiedAttachments.ts:117— useUnifiedAttachments.useUnifiedAttachments has cognitive complexity 58 (threshold 15). Drivers by points: if/else 26 (36 pts), error handling 3 (9 pts), ternaries 3 (7 pts), boolean chains 4, loops 2 (nesting depth added 20). Most of this is not in the body itself: 0 of the 58 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 173, 307, 146, …). 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.
memory_health._compress_evolution_entries (cognitive 57) backend/jobs/handlers/memory_health.py:614— memory_health._compress_evolution_entries has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 10, loops 5 (6 pts), error handling 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.
recalc.recalc (cognitive 57) backend/skills/s_xlsx/recalc.py:53— recalc.recalc has cognitive complexity 57 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 8 (18 pts), boolean chains 5, error handling 2 (4 pts), ternaries 2 (3 pts) (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.
context_injector._extract_key_tool_results (cognitive 56) backend/core/context_injector.py:654— context_injector._extract_key_tool_results has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (45 pts), boolean chains 7, loops 2 (3 pts), error handling 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DistillationTriggerHook._apply_open_thread_updates (cognitive 56) backend/hooks/distillation_hook.py:1964— DistillationTriggerHook._apply_open_thread_updates has cognitive complexity 56 (threshold 15). Drivers by points: if/else 13 (42 pts), loops 5 (11 pts), boolean chains 3 (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.
ParagraphData.__init__ (cognitive 56) backend/skills/s_pptx/scripts/inventory.py:140— ParagraphData.__init__ has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (40 pts), error handling 2 (7 pts), boolean chains 6, ternaries 1 (3 pts) (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.
html2pptx.addElements (cognitive 56) backend/skills/s_pptx/scripts/html2pptx.js:133— html2pptx.addElements has cognitive complexity 56 (threshold 15). Drivers by points: if/else 19 (46 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
file_change_classifier.parse_bash_delete_targets (cognitive 55) backend/core/file_change_classifier.py:122— file_change_classifier.parse_bash_delete_targets has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (44 pts), boolean chains 5, loops 3 (5 pts), error handling 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.
PluginManager.install_plugin (cognitive 55) backend/core/plugin_manager.py:696— PluginManager.install_plugin has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (36 pts), loops 7 (12 pts), ternaries 2 (4 pts), error handling 2 (3 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.
ui_actions.build_surface_events (cognitive 55) backend/core/ui_actions.py:287— ui_actions.build_surface_events has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 4 (10 pts), boolean chains 9, error handling 3 (6 pts), loops 4 (6 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.
pipelines.pipeline_analytics (cognitive 55) backend/routers/pipelines.py:444— pipelines.pipeline_analytics has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 12, ternaries 5 (10 pts), loops 3 (4 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.
artifact_cli.cmd_run_observe (cognitive 55) backend/scripts/artifact_cli.py:5539— artifact_cli.cmd_run_observe has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 19 (38 pts), if/else 5 (7 pts), boolean chains 5, error handling 2 (5 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.
CsvRenderer.CsvRenderer (cognitive 55) desktop/src/components/file-viewer/renderers/CsvRenderer.tsx:48— CsvRenderer.CsvRenderer has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 16 (23 pts), if/else 18, boolean chains 12, error handling 1, loops 1 (nesting depth added 7). Most of this is not in the body itself: 15 of the 55 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 91, 114, 60, …). 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.
DistillationTriggerHook._enforce_size_valve (cognitive 54) backend/hooks/distillation_hook.py:2571— DistillationTriggerHook._enforce_size_valve has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 6 (12 pts), error handling 2 (6 pts), ternaries 1 (5 pts), boolean chains 4 (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.
useVoiceRecorder.useVoiceRecorder (cognitive 54) desktop/src/hooks/useVoiceRecorder.ts:48— useVoiceRecorder.useVoiceRecorder has cognitive complexity 54 (threshold 15). Drivers by points: if/else 26 (29 pts), boolean chains 10, ternaries 4 (8 pts), error handling 5 (7 pts) (nesting depth added 9). Most of this is not in the body itself: 1 of the 54 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 245, 99, 78, …). 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.
clustering.compute_graph_clusters (cognitive 53) backend/core/code_intel/clustering.py:75— clustering.compute_graph_clusters has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 9 (15 pts), ternaries 3 (4 pts), boolean chains 2, error handling 1 (2 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.
style-extract.extract_fonts (cognitive 53) backend/skills/s_pptx/scripts/style-extract.py:53— style-extract.extract_fonts has cognitive complexity 53 (threshold 15). Drivers by points: if/else 8 (30 pts), ternaries 3 (12 pts), loops 3 (9 pts), boolean chains 2 (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.
parser.parse_repo_with_coverage (cognitive 52) backend/core/code_intel/parser.py:1952— parser.parse_repo_with_coverage has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (34 pts), loops 6 (11 pts), boolean chains 3, error handling 1 (3 pts), ternaries 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.
PromptBuilder.build_options (cognitive 52) REDACTED:1775— PromptBuilder.build_options has cognitive complexity 52 (threshold 15). Drivers by points: if/else 23 (34 pts), boolean chains 10, error handling 2 (4 pts), ternaries 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.
recall_multi._recall_ddd (cognitive 52) backend/core/recall_multi.py:701— recall_multi._recall_ddd has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 7 (13 pts), error handling 3 (8 pts), boolean chains 4, ternaries 1 (3 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.
pollinate._walk_assets (cognitive 52) backend/routers/pollinate.py:327— pollinate._walk_assets has cognitive complexity 52 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 6 (18 pts), ternaries 2 (10 pts), boolean chains 1 (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.
SelfLoopsHealthEngine.to_markdown (cognitive 52) backend/skills/s_loops-health/scripts/loops_health_check.py:1228— SelfLoopsHealthEngine.to_markdown has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 12 (19 pts), loops 4 (8 pts), boolean chains 2, error handling 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.
replace.apply_replacements (cognitive 52) backend/skills/s_pptx/scripts/replace.py:214— replace.apply_replacements has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 11 (24 pts), boolean chains 1 (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.
ToDoOverlay.TodoForm (cognitive 52) desktop/src/components/layout/ToDoOverlay.tsx:993— ToDoOverlay.TodoForm has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 11 (13 pts), boolean chains 9, error handling 4 (7 pts), loops 2 (4 pts) (nesting depth added 15). Most of this is not in the body itself: 11 of the 52 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1057, 1022, 1014, …). 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.
PluginManager._install_from_marketplace_json (cognitive 51) backend/core/plugin_manager.py:522— PluginManager._install_from_marketplace_json has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 6, loops 3 (6 pts), error handling 2 (4 pts), ternaries 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.
DddCultivationOrchestrator._ch_ddd_staleness (cognitive 50) backend/core/ddd_orchestrator.py:444— DddCultivationOrchestrator._ch_ddd_staleness has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (27 pts), ternaries 3 (9 pts), loops 3 (6 pts), boolean chains 4, error handling 2 (4 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.
Video.SectionComponent (cognitive 50) backend/skills/s_pollinate/templates/remotion/Video.tsx:43— Video.SectionComponent has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 25 (49 pts), match/switch 1 (nesting depth added 24). Of this number, 46 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.
useUnifiedTabState.useUnifiedTabState (cognitive 50) desktop/src/hooks/useUnifiedTabState.ts:419— useUnifiedTabState.useUnifiedTabState has cognitive complexity 50 (threshold 15). Drivers by points: if/else 31 (33 pts), boolean chains 5, error handling 3 (5 pts), loops 4, ternaries 3 (nesting depth added 4). Most of this is not in the body itself: 1 of the 50 points is its own statement and the rest belongs to 19 function literals inside it that branch (lines 767, 559, 683, …). 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.
ChannelGateway.handle_inbound_message (cognitive 49) backend/channels/gateway.py:1248— ChannelGateway.handle_inbound_message has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (29 pts), error handling 4 (10 pts), boolean chains 8, ternaries 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.
SQLiteDatabase._run_versioned_migrations (cognitive 49) backend/database/sqlite.py:2386— SQLiteDatabase._run_versioned_migrations has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (27 pts), error handling 8 (17 pts), ternaries 1 (3 pts), loops 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.
pptx_to_deck.extract (cognitive 49) backend/skills/s_pollinate/scripts/pptx_to_deck.py:36— pptx_to_deck.extract has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 5 (12 pts), boolean chains 6, ternaries 2 (3 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.
AskUserQuestion.AskUserQuestion (cognitive 49) desktop/src/components/common/AskUserQuestion.tsx:19— AskUserQuestion.AskUserQuestion has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 14 (21 pts), boolean chains 14, if/else 13 (14 pts) (nesting depth added 8). Most of this is not in the body itself: 6 of the 49 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 176, 163, 37, …). 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.
_ClaudeClientWrapper._extract_pid (cognitive 48) backend/core/claude_environment.py:81— _ClaudeClientWrapper._extract_pid has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (41 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 25). 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.
RetryManager._retry_with_resume (cognitive 48) backend/core/retry_manager.py:265— RetryManager._retry_with_resume has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (32 pts), error handling 4 (8 pts), boolean chains 5, loops 2 (3 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.
security_hooks._targets_irreplaceable_store (cognitive 48) backend/core/security_hooks.py:430— security_hooks._targets_irreplaceable_store has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (37 pts), boolean chains 6, loops 3 (4 pts), error handling 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.
ddd_weekly_report._generate_report (cognitive 48) backend/jobs/handlers/ddd_weekly_report.py:207— ddd_weekly_report._generate_report has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (28 pts), loops 8 (13 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 12). 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.
backfill_cjk_escapes.backfill (cognitive 48) backend/scripts/backfill_cjk_escapes.py:576— backfill_cjk_escapes.backfill has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 6 (9 pts), boolean chains 7, error handling 3 (6 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.
VirtualizedTree.flattenTree (cognitive 48) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:255— VirtualizedTree.flattenTree has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 10 (14 pts), boolean chains 10 (nesting depth added 17). Of this number, 47 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.
proactive_learning.update_learning_from_activity (cognitive 47) backend/core/proactive_learning.py:431— proactive_learning.update_learning_from_activity has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (35 pts), loops 2 (6 pts), error handling 1 (3 pts), ternaries 2, boolean chains 1 (nesting depth added 25). 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.
SessionUnit._pid_watchdog_loop (cognitive 47) backend/core/session_unit.py:1288— SessionUnit._pid_watchdog_loop has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (38 pts), error handling 3 (5 pts), boolean chains 3, loops 1 (nesting depth added 31). 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.
ai_ready_helpers.compute_subsystem_coverage (cognitive 47) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:845— ai_ready_helpers.compute_subsystem_coverage has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 11, loops 6 (10 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.
ddd_packager.package_ddd (cognitive 46) backend/core/ddd_packager.py:1838— ddd_packager.package_ddd has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 4 (6 pts), boolean chains 5, ternaries 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.
AssistantMessageView.AssistantMessageView (cognitive 46) desktop/src/pages/chat/components/AssistantMessageView.tsx:77— AssistantMessageView.AssistantMessageView has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 23, ternaries 9 (11 pts), if/else 7 (9 pts), loops 2, error handling 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 24 belong to 6 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.
eval._build_learning_dashboard (cognitive 45) backend/routers/eval.py:429— eval._build_learning_dashboard has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 4 (11 pts), error handling 2 (6 pts), boolean chains 1 (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.
workspace_api._build_tree (cognitive 45) backend/routers/workspace_api.py:349— workspace_api._build_tree has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 5 (9 pts), ternaries 3 (8 pts), boolean chains 4, error handling 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.
pipeline_cleanup.reclassify_stale_runs (cognitive 45) backend/scripts/pipeline_cleanup.py:31— pipeline_cleanup.reclassify_stale_runs has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (31 pts), error handling 2 (8 pts), boolean chains 3, loops 2 (3 pts) (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.
pipeline_validator.check_ddd_consistency (cognitive 45) backend/scripts/pipeline_validator.py:1787— pipeline_validator.check_ddd_consistency has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 5 (11 pts), boolean chains 4, error handling 1 (3 pts), ternaries 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.
DiagramReveal.autoLayout (cognitive 45) backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:65— DiagramReveal.autoLayout has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 7 (19 pts), loops 10 (17 pts), if/else 5 (9 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.
parser._build_file_scope_regex (cognitive 44) backend/core/code_intel/parser.py:784— parser._build_file_scope_regex has cognitive complexity 44 (threshold 15). Drivers by points: loops 14 (30 pts), if/else 3 (9 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 24). 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.
correction_tracker._merge_drift (cognitive 44) backend/core/evolution/correction_tracker.py:69— correction_tracker._merge_drift has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 5 (9 pts), boolean chains 4, ternaries 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.
eval_scheduled.run_eval_scheduled (cognitive 44) backend/jobs/handlers/eval_scheduled.py:138— eval_scheduled.run_eval_scheduled has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 17, error handling 3 (7 pts), ternaries 1 (nesting depth added 6). 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.
DocxXMLEditor.suggest_deletion (cognitive 44) backend/skills/s_docx/scripts/document.py:482— DocxXMLEditor.suggest_deletion has cognitive complexity 44 (threshold 15). Drivers by points: loops 8 (20 pts), if/else 10 (19 pts), ternaries 1 (3 pts), boolean chains 2 (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.
memory_extractor.extract_and_save (cognitive 43) backend/core/memory_extractor.py:367— memory_extractor.extract_and_save has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 8 (15 pts), boolean chains 4, loops 3 (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.
backfill_cjk_escapes._populate_seg_columns (cognitive 43) backend/scripts/backfill_cjk_escapes.py:444— backfill_cjk_escapes._populate_seg_columns has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 5 (11 pts), boolean chains 5 (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.
PollinateOverlay.AssetDrawer (cognitive 43) desktop/src/components/layout/PollinateOverlay.tsx:494— PollinateOverlay.AssetDrawer has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 14 (25 pts), if/else 7 (9 pts), boolean chains 8, error handling 1 (nesting depth added 13). Of this number, 32 points are the body's own statements and 11 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.
ingestion_gate.ingestion_gate (cognitive 42) backend/core/ingestion_gate.py:633— ingestion_gate.ingestion_gate has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 2, error handling 1, loops 1, ternaries 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.
mcp_config_loader.merge_catalog_template (cognitive 42) backend/core/mcp_config_loader.py:149— mcp_config_loader.merge_catalog_template has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (29 pts), error handling 4 (6 pts), ternaries 1 (4 pts), loops 2, boolean chains 1 (nesting depth added 21). 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.
SummarizationPipeline._extract_topics (cognitive 42) backend/core/summarization.py:292— SummarizationPipeline._extract_topics has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 3, 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.
artifact_cli.cmd_run_status (cognitive 42) backend/scripts/artifact_cli.py:3828— artifact_cli.cmd_run_status has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (26 pts), error handling 2 (8 pts), loops 4 (8 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.
pipeline_validator._verify_findings_on_disk (cognitive 42) backend/scripts/pipeline_validator.py:155— pipeline_validator._verify_findings_on_disk has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (29 pts), error handling 3 (8 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.
SelfLoopsHealthEngine._check_memory (cognitive 42) backend/skills/s_loops-health/scripts/loops_health_check.py:269— SelfLoopsHealthEngine._check_memory has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 12 (13 pts), loops 4 (6 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.
AIModelsTab.AIModelsTab (cognitive 42) desktop/src/components/settings/AIModelsTab.tsx:15— AIModelsTab.AIModelsTab has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 20, ternaries 8 (9 pts), if/else 7, error handling 6 (nesting depth added 1). Most of this is not in the body itself: 6 of the 42 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 83, 46, 56, …). 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.
community_data.build_feed (cognitive 41) backend/core/community_data.py:564— community_data.build_feed has cognitive complexity 41 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 3 (11 pts), error handling 3 (10 pts), loops 2 (3 pts), boolean chains 1 (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.
proactive_intelligence._detect_temporal_signals (cognitive 41) backend/core/proactive_intelligence.py:461— proactive_intelligence._detect_temporal_signals has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (29 pts), error handling 2 (6 pts), boolean chains 3, loops 2 (3 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.
session_router._maybe_inject_recall_inner (cognitive 41) backend/core/session_router.py:969— session_router._maybe_inject_recall_inner has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (16 pts), error handling 10 (14 pts), ternaries 5 (7 pts), boolean chains 4 (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, 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.
DistillationTriggerHook._enforce_section_caps (cognitive 41) backend/hooks/distillation_hook.py:2372— DistillationTriggerHook._enforce_section_caps has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (31 pts), loops 4 (8 pts), boolean chains 1, error handling 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.
memory_health.run_memory_health (cognitive 41) backend/jobs/handlers/memory_health.py:150— memory_health.run_memory_health has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 6, loops 3 (6 pts), error handling 2 (5 pts), ternaries 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.
swarmai_monthly_report._collect_cultivation_metrics (cognitive 41) backend/jobs/handlers/swarmai_monthly_report.py:213— swarmai_monthly_report._collect_cultivation_metrics has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 2 (8 pts), loops 3 (7 pts), boolean chains 1 (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.
artifact_cli.purge_garbage_runs (cognitive 41) backend/scripts/artifact_cli.py:1469— artifact_cli.purge_garbage_runs has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (26 pts), error handling 3 (10 pts), loops 2 (3 pts), boolean chains 2 (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.
LifecycleManager._check_streaming_timeout (cognitive 40) backend/core/lifecycle_manager.py:653— LifecycleManager._check_streaming_timeout has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (29 pts), ternaries 2 (6 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.
proactive_intelligence._extract_working_items (cognitive 40) backend/core/proactive_intelligence.py:1788— proactive_intelligence._extract_working_items has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (9 pts), error handling 2 (5 pts), boolean chains 2 (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.
useHealthMonitor.useHealthMonitor (cognitive 40) desktop/src/hooks/useHealthMonitor.ts:134— useHealthMonitor.useHealthMonitor has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 5, error handling 2, ternaries 1 (nesting depth added 9). Most of this is not in the body itself: 0 of the 40 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 222, 176, 293, …). 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.
FileContextMenu.FileContextMenu (cognitive 40) desktop/src/components/workspace-explorer/FileContextMenu.tsx:58— FileContextMenu.FileContextMenu has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (19 pts), ternaries 7 (12 pts), boolean chains 7, error handling 2 (nesting depth added 7). Most of this is not in the body itself: 9 of the 40 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 101, 141, 167, …). 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.
ContextHealthHook._refresh_code_intel (cognitive 39) backend/hooks/context_health_hook.py:577— ContextHealthHook._refresh_code_intel has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), error handling 2 (7 pts), loops 2 (3 pts), boolean chains 2 (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.
ActivityFeed.extractActivities (cognitive 39) desktop/src/pages/chat/components/ActivityFeed.tsx:24— ActivityFeed.extractActivities has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 8, ternaries 2 (5 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.
useVoiceConversation.useVoiceConversation (cognitive 39) desktop/src/hooks/useVoiceConversation.ts:75— useVoiceConversation.useVoiceConversation has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (25 pts), boolean chains 12, loops 1 (2 pts) (nesting depth added 2). Most of this is not in the body itself: 0 of the 39 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 179, 264, 149, …). 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.
ChatErrorMessage.ChatErrorMessage (cognitive 39) desktop/src/components/chat/ChatErrorMessage.tsx:35— ChatErrorMessage.ChatErrorMessage has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 12 (30 pts), boolean chains 8, if/else 1 (nesting depth added 18). Of this number, 38 points are the body's own statements and 1 belongs 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.
blast_radius.analyze_diff (cognitive 38) backend/core/code_intel/blast_radius.py:180— blast_radius.analyze_diff has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 7 (11 pts), ternaries 3 (6 pts), error handling 3 (4 pts), boolean chains 3 (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.
code_intel_feed.detect_tech_drift (cognitive 38) backend/core/code_intel_feed.py:59— code_intel_feed.detect_tech_drift has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 2, error handling 2, loops 2 (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.
context_injector._extract_tool_summary (cognitive 38) backend/core/context_injector.py:215— context_injector._extract_tool_summary has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 7, loops 2 (3 pts), error handling 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.
SessionUnit._emit_post_stream_metadata (cognitive 38) backend/core/session_unit.py:2976— SessionUnit._emit_post_stream_metadata has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 7 (11 pts), error handling 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.
ContextHealthHook._set_verified_from_pipeline_runs (cognitive 38) backend/hooks/context_health_hook.py:1433— ContextHealthHook._set_verified_from_pipeline_runs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (28 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 2 (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.
ImprovementWritebackHook._detect_project (cognitive 38) backend/hooks/improvement_writeback_hook.py:151— ImprovementWritebackHook._detect_project has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 3 (8 pts), boolean chains 3, loops 2 (3 pts), error handling 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.
channels.update_channel (cognitive 38) backend/routers/channels.py:180— channels.update_channel has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (24 pts), error handling 2 (6 pts), ternaries 4 (5 pts), boolean chains 3 (nesting depth added 11). 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.
artifact_cli._stage_publish_times (cognitive 38) backend/scripts/artifact_cli.py:5027— artifact_cli._stage_publish_times has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 2 (6 pts), ternaries 3 (6 pts), loops 3 (5 pts), boolean chains 3 (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.
eval_runner.evaluate_case (cognitive 38) backend/scripts/eval_runner.py:1606— eval_runner.evaluate_case has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (33 pts), loops 3 (5 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.
replace.validate_replacements (cognitive 38) backend/skills/s_pptx/scripts/replace.py:162— replace.validate_replacements has cognitive complexity 38 (threshold 15). Drivers by points: if/else 7 (26 pts), loops 3 (7 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 26). 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.
ContentBlockRenderer.ContentBlockRenderer (cognitive 38) desktop/src/pages/chat/components/ContentBlockRenderer.tsx:122— ContentBlockRenderer.ContentBlockRenderer has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 15, if/else 11 (15 pts), ternaries 4 (8 pts) (nesting depth added 8). Of this number, 37 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.
FolderPickerModal.FolderPickerModal (cognitive 38) desktop/src/components/workspace/FolderPickerModal.tsx:21— FolderPickerModal.FolderPickerModal has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 8 (19 pts), boolean chains 10, if/else 9 (nesting depth added 11). Of this number, 16 points are the body's own statements and 22 belong to 10 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.
SlackChannelAdapter._text_to_blocks (cognitive 37) REDACTED:1923— SlackChannelAdapter._text_to_blocks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4 (7 pts), boolean chains 6, ternaries 1 (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.
codebase_map._format_briefing (cognitive 37) backend/core/code_intel/codebase_map.py:43— codebase_map._format_briefing has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 4 (8 pts), ternaries 3 (8 pts), error handling 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.
parser._extract_from_tree (cognitive 37) backend/core/code_intel/parser.py:997— parser._extract_from_tree has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (11 pts), ternaries 4, boolean chains 3 (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.
ddd_cultivation.apply_to_ddd (cognitive 37) backend/core/ddd_cultivation.py:984— ddd_cultivation.apply_to_ddd has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 7, ternaries 4 (7 pts), loops 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.
mcp_migration.migrate_if_needed (cognitive 37) backend/core/mcp_migration.py:28— mcp_migration.migrate_if_needed has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (28 pts), error handling 3 (4 pts), loops 3 (4 pts), boolean chains 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.
PluginManager.sync_git_marketplace (cognitive 37) backend/core/plugin_manager.py:118— PluginManager.sync_git_marketplace has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), error handling 2 (6 pts), loops 3 (4 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.
artifact_cli._load_completed_runs (cognitive 37) backend/scripts/artifact_cli.py:1596— artifact_cli._load_completed_runs has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (24 pts), error handling 2 (7 pts), loops 2 (4 pts), boolean chains 2 (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.
ai_ready_helpers.compute_business_rules_dimension (cognitive 37) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3973— ai_ready_helpers.compute_business_rules_dimension has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 9, loops 2 (5 pts), ternaries 3 (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.
steeringify.group_and_propose (cognitive 37) backend/skills/s_steeringify/steeringify.py:198— steeringify.group_and_propose has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 6 (10 pts), error handling 1 (3 pts), boolean chains 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.
ExplorerContext.ExplorerProvider (cognitive 37) desktop/src/contexts/ExplorerContext.tsx:369— ExplorerContext.ExplorerProvider has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (23 pts), ternaries 3 (5 pts), boolean chains 4, error handling 3, loops 2 (nesting depth added 7). Most of this is not in the body itself: 0 of the 37 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 616, 531, 489, …). 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.
ddd_entry_lifecycle._strip_entries (cognitive 36) backend/core/ddd_entry_lifecycle.py:1789— ddd_entry_lifecycle._strip_entries has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 6, loops 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.
proactive_intelligence._parse_continue_hints (cognitive 36) backend/core/proactive_intelligence.py:176— proactive_intelligence._parse_continue_hints has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 4 (6 pts), boolean chains 3, ternaries 1 (3 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.
SwarmWorkspaceManager._cleanup_legacy_content (cognitive 36) backend/core/swarm_workspace_manager.py:2092— SwarmWorkspaceManager._cleanup_legacy_content has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 8 (13 pts), error handling 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.
DailyActivityExtractionHook._capture_git_activity (cognitive 36) backend/hooks/daily_activity_hook.py:333— DailyActivityExtractionHook._capture_git_activity has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (11 pts), error handling 3 (5 pts), boolean chains 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.
memory_health._resolve_open_thread (cognitive 36) backend/jobs/handlers/memory_health.py:887— memory_health._resolve_open_thread has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 4 (5 pts), ternaries 2 (3 pts), boolean chains 2, error handling 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.
tasks.create_task (cognitive 36) backend/routers/tasks.py:66— tasks.create_task has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (6 pts), boolean chains 4, error handling 3 (4 pts), ternaries 1 (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.
migrate_memory_lifecycle.migrate_file (cognitive 36) backend/scripts/migrate_memory_lifecycle.py:95— migrate_memory_lifecycle.migrate_file has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 4, loops 2 (4 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.
XMLEditor.get_node (cognitive 36) backend/skills/s_docx/scripts/utilities.py:76— XMLEditor.get_node has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (30 pts), ternaries 2 (5 pts), loops 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.
ai_ready_helpers.select_verification_tasks (cognitive 36) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3252— ai_ready_helpers.select_verification_tasks has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 5 (6 pts), boolean chains 4, error handling 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.
locked_write.locked_read_modify_write (cognitive 36) backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:515— locked_write.locked_read_modify_write has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (24 pts), error handling 6 (10 pts), boolean chains 1, 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.
TreeNodeRow.TreeNodeRow (cognitive 36) desktop/src/components/workspace-explorer/TreeNodeRow.tsx:188— TreeNodeRow.TreeNodeRow has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 15 (18 pts), boolean chains 9, if/else 8 (9 pts) (nesting depth added 4). 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, 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.
VirtualizedTree.VirtualizedTree (cognitive 36) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:688— VirtualizedTree.VirtualizedTree has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15, ternaries 8 (11 pts), error handling 5, boolean chains 4, loops 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 881, 925, 813, …). 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.
LibraryTree.LibraryTree (cognitive 36) desktop/src/components/layout/LibraryTree.tsx:218— LibraryTree.LibraryTree has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 13 (20 pts), if/else 8, boolean chains 7, error handling 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 19 belong to 8 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.
sentenceSplitter.extractSentences (cognitive 36) desktop/src/utils/sentenceSplitter.ts:127— sentenceSplitter.extractSentences has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 4, ternaries 1 (4 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.
domain_rules.compute_domain_rules (cognitive 35) backend/core/code_intel/domain_rules.py:136— domain_rules.compute_domain_rules has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 5 (13 pts), loops 4 (7 pts), boolean chains 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.
daily_activity_writer._format_session_entry (cognitive 35) backend/core/daily_activity_writer.py:134— daily_activity_writer._format_session_entry has cognitive complexity 35 (threshold 15). Drivers by points: loops 9 (18 pts), if/else 14, boolean chains 2, ternaries 1 (nesting depth added 9). 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.
proactive_scoring.detect_blocking (cognitive 35) backend/core/proactive_scoring.py:109— proactive_scoring.detect_blocking has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 2 (4 pts), boolean chains 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.
SQLiteDatabase._run_data_cleanups (cognitive 35) backend/database/sqlite.py:3248— SQLiteDatabase._run_data_cleanups has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 5 (13 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 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.
ContextHealthHook._extract_lessons_to_memory (cognitive 35) backend/hooks/context_health_hook.py:969— ContextHealthHook._extract_lessons_to_memory has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 3 (6 pts), loops 4 (5 pts), boolean chains 4, ternaries 2 (4 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.
ContextHealthHook._detect_stale_memory_claims (cognitive 35) backend/hooks/context_health_hook.py:2941— ContextHealthHook._detect_stale_memory_claims has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (8 pts), error handling 2 (4 pts), ternaries 1 (4 pts), boolean chains 2 (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.
ddd_self_audit.run_ddd_self_audit (cognitive 35) backend/jobs/handlers/ddd_self_audit.py:221— ddd_self_audit.run_ddd_self_audit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 5 (9 pts), error handling 2 (5 pts), boolean chains 4, loops 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.
chat.get_streaming_state_endpoint (cognitive 35) backend/routers/chat.py:907— chat.get_streaming_state_endpoint has cognitive complexity 35 (threshold 15). Drivers by points: error handling 4 (13 pts), if/else 4 (13 pts), loops 2 (4 pts), boolean chains 3, ternaries 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.
system._probe_ada_details (cognitive 35) backend/routers/system.py:751— system._probe_ada_details has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), ternaries 2 (6 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 20). 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.
pipeline_analytics.analyze_stage_efficiency (cognitive 35) backend/scripts/pipeline_analytics.py:503— pipeline_analytics.analyze_stage_efficiency has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (8 pts), boolean chains 7 (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.
design_system.format_ascii_box (cognitive 35) backend/skills/s_frontend-design/scripts/design_system.py:282— design_system.format_ascii_box has cognitive complexity 35 (threshold 15). Drivers by points: loops 10 (17 pts), if/else 15 (16 pts), boolean chains 2 (nesting depth added 8). 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.
ShapeData._estimate_frame_overflow (cognitive 35) backend/skills/s_pptx/scripts/inventory.py:562— ShapeData._estimate_frame_overflow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 6, error handling 1 (3 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.
streaming-machine.streamingReducer (cognitive 35) desktop/src/hooks/streaming-machine.ts:110— streaming-machine.streamingReducer has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 12 (23 pts), if/else 3 (9 pts), ternaries 1 (3 pts) (nesting depth added 19). 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.
CapabilitiesOverlay.CapabilitiesContent (cognitive 35) desktop/src/components/layout/CapabilitiesOverlay.tsx:173— CapabilitiesOverlay.CapabilitiesContent has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 14, if/else 11 (12 pts), ternaries 6 (7 pts), error handling 2 (nesting depth added 2). Most of this is not in the body itself: 12 of the 35 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 227, 327, 189, …). 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.
library_health.scan_library_health (cognitive 34) backend/core/library_health.py:103— library_health.scan_library_health has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 4 (5 pts), boolean chains 3, 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.
proactive_intelligence._get_job_result_highlights (cognitive 34) backend/core/proactive_intelligence.py:627— proactive_intelligence._get_job_result_highlights has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 3 (6 pts), ternaries 3 (6 pts), loops 2, 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.
skill_migration.migrate_skill_ids_to_allowed_skills (cognitive 34) backend/core/skill_migration.py:25— skill_migration.migrate_skill_ids_to_allowed_skills has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 7 (9 pts), loops 4 (6 pts), ternaries 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.
SummarizationPipeline._extract_decisions (cognitive 34) backend/core/summarization.py:382— SummarizationPipeline._extract_decisions has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (30 pts), loops 2 (3 pts), boolean chains 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.
ContextHealthHook._deep_check (cognitive 34) backend/hooks/context_health_hook.py:2492— ContextHealthHook._deep_check has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (20 pts), error handling 7 (10 pts), boolean chains 2, loops 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.
publish_dashboard.scan_deliver (cognitive 34) backend/skills/s_pollinate/scripts/publish_dashboard.py:44— publish_dashboard.scan_deliver has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 5 (19 pts), if/else 5 (11 pts), loops 2 (3 pts), boolean chains 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.
CMBrainOverlay.ArchivePanel (cognitive 34) desktop/src/components/layout/CMBrainOverlay.tsx:772— CMBrainOverlay.ArchivePanel has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 9 (29 pts), boolean chains 5 (nesting depth added 20). Of this number, 28 points are the body's own statements and 6 belong to 2 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.
BrainHub.DistributeView (cognitive 34) desktop/src/components/layout/BrainHub.tsx:1173— BrainHub.DistributeView has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 13 (23 pts), boolean chains 6, if/else 4 (5 pts) (nesting depth added 11). Of this number, 22 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.
ReviewModeGutter.ReviewModeGutter (cognitive 34) desktop/src/components/common/ReviewModeGutter.tsx:42— ReviewModeGutter.ReviewModeGutter has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 17 (23 pts), boolean chains 11 (nesting depth added 6). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 114, 156, 169). 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.
code_intel_hook._build_context (cognitive 33) backend/core/code_intel/code_intel_hook.py:235— code_intel_hook._build_context has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 9 (12 pts), loops 3 (6 pts), error handling 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.
parser._c_family_declarator_name (cognitive 33) backend/core/code_intel/parser.py:1292— parser._c_family_declarator_name has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (24 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2 (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.
ddd_cultivation.backfill_proposals (cognitive 33) backend/core/ddd_cultivation.py:2196— ddd_cultivation.backfill_proposals has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 4 (13 pts), boolean chains 3, ternaries 1 (2 pts), 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.
knowledge_store.sync_knowledge_index (cognitive 33) backend/core/knowledge_store.py:737— knowledge_store.sync_knowledge_index has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 6 (9 pts), boolean chains 3, error handling 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.
persist_routing.classify_content (cognitive 33) backend/core/persist_routing.py:248— persist_routing.classify_content has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 9, ternaries 2 (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.
SummarizationPipeline._parse_enrichment (cognitive 33) backend/core/summarization.py:823— SummarizationPipeline._parse_enrichment has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 6 (10 pts), boolean chains 4, loops 3, 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.
SQLiteDatabase._migrate_existing_task_data (cognitive 33) backend/database/sqlite.py:3328— SQLiteDatabase._migrate_existing_task_data has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (24 pts), error handling 2 (5 pts), ternaries 3 (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.
agents.update_agent (cognitive 33) backend/routers/agents.py:168— agents.update_agent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (30 pts), loops 1 (2 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.
pipeline_analytics.generate_report (cognitive 33) backend/scripts/pipeline_analytics.py:761— pipeline_analytics.generate_report has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 7 (11 pts), ternaries 3 (5 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.
extract_form_field_info.get_field_info (cognitive 33) backend/skills/s_pdf/scripts/extract_form_field_info.py:62— extract_form_field_info.get_field_info has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 4 (5 pts), error handling 1 (4 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.
rearrange.rearrange_presentation (cognitive 33) backend/skills/s_pptx/scripts/rearrange.py:149— rearrange.rearrange_presentation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 6 (10 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.
context_injector._extract_files_touched (cognitive 32) backend/core/context_injector.py:271— context_injector._extract_files_touched has cognitive complexity 32 (threshold 15). Drivers by points: if/else 4 (17 pts), loops 3 (6 pts), ternaries 1 (6 pts), boolean chains 2, error handling 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.
context_injector._extract_git_activity (cognitive 32) backend/core/context_injector.py:324— context_injector._extract_git_activity has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
context_injector.build_resume_context (cognitive 32) backend/core/context_injector.py:1139— context_injector.build_resume_context has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 4 (5 pts), boolean chains 2, error handling 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.
ddd_entry_lifecycle._strip_entries_by_line (cognitive 32) backend/core/ddd_entry_lifecycle.py:1857— ddd_entry_lifecycle._strip_entries_by_line has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 4, 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.
file_change_classifier.parse_bash_write_targets (cognitive 32) backend/core/file_change_classifier.py:73— file_change_classifier.parse_bash_write_targets has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 3 (5 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.
bedrock._resolve_credentials (cognitive 32) backend/jobs/bedrock.py:62— bedrock._resolve_credentials has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 3 (5 pts), loops 2 (5 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.
settings.update_app_configuration (cognitive 32) backend/routers/settings.py:263— settings.update_app_configuration has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 6, error handling 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.
artifact_cli.cmd_run_analytics (cognitive 32) backend/scripts/artifact_cli.py:5272— artifact_cli.cmd_run_analytics has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 7, error handling 2 (5 pts), loops 4 (5 pts) (nesting depth added 7). 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.
eval_runner._load_rules_context (cognitive 32) backend/scripts/eval_runner.py:803— eval_runner._load_rules_context has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (9 pts), boolean chains 1, error handling 1, ternaries 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.
pipeline_validator._parse_failed_patterns (cognitive 32) backend/scripts/pipeline_validator.py:1745— pipeline_validator._parse_failed_patterns has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 2 (5 pts), boolean chains 3 (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.
Document._update_settings (cognitive 32) backend/skills/s_docx/scripts/document.py:988— Document._update_settings has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 1 (3 pts), ternaries 1 (nesting depth added 17). 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.
check_bounding_boxes.get_bounding_box_messages (cognitive 32) backend/skills/s_pdf/scripts/check_bounding_boxes.py:18— check_bounding_boxes.get_bounding_box_messages has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 3 (4 pts), boolean chains 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.
publish_dashboard.generate_markdown (cognitive 32) backend/skills/s_pollinate/scripts/publish_dashboard.py:114— publish_dashboard.generate_markdown has cognitive complexity 32 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 7 (10 pts), ternaries 4 (10 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.
InlinePermissionRequest.InlinePermissionRequest (cognitive 32) desktop/src/pages/chat/components/InlinePermissionRequest.tsx:40— InlinePermissionRequest.InlinePermissionRequest has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 10, boolean chains 8 (nesting depth added 7). Of this number, 20 points are the body's own statements and 12 belong to 6 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.
ChannelsTab.ChannelsTab (cognitive 32) desktop/src/components/settings/ChannelsTab.tsx:13— ChannelsTab.ChannelsTab has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 14, ternaries 6 (14 pts), error handling 3, if/else 1 (nesting depth added 8). Of this number, 25 points are the body's own statements and 7 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.
OverlayHost.OverlayHost (cognitive 32) desktop/src/components/layout/OverlayHost.tsx:58— OverlayHost.OverlayHost has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 5, ternaries 4 (nesting depth added 5). Most of this is not in the body itself: 8 of the 32 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 77, 153, 106, …). 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.
ddd_maturity.update_evidence_from_changelog (cognitive 31) backend/core/ddd_maturity.py:459— ddd_maturity.update_evidence_from_changelog has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (3 pts), 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.
recall_multi._render_domain_hits (cognitive 31) backend/core/recall_multi.py:625— recall_multi._render_domain_hits has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 6, ternaries 1 (3 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.
SQLiteDatabase._run_legacy_migrations (cognitive 31) backend/database/sqlite.py:2885— SQLiteDatabase._run_legacy_migrations has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23 (25 pts), error handling 3 (4 pts), 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.
ContextHealthHook._enforce_retention_policies (cognitive 31) backend/hooks/context_health_hook.py:3410— ContextHealthHook._enforce_retention_policies has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (21 pts), error handling 2 (6 pts), loops 2 (4 pts) (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.
EvolutionMaintenanceHook.execute (cognitive 31) backend/hooks/evolution_maintenance_hook.py:196— EvolutionMaintenanceHook.execute has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 6 (8 pts), loops 4 (6 pts), boolean chains 3, 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.
executor._handle_agent_task (cognitive 31) REDACTED:739— executor._handle_agent_task has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (16 pts), error handling 4 (6 pts), boolean chains 4, ternaries 3 (4 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, 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.
font_link_backfill.main (cognitive 31) backend/skills/s_pollinate/scripts/font_link_backfill.py:94— font_link_backfill.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 5 (6 pts), ternaries 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.
publish_dashboard.generate_html (cognitive 31) backend/skills/s_pollinate/scripts/publish_dashboard.py:194— publish_dashboard.generate_html has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 5 (6 pts), boolean chains 3, error handling 1 (3 pts), ternaries 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.
ai_ready_helpers._render_domain_skeleton_body (cognitive 31) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1568— ai_ready_helpers._render_domain_skeleton_body has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 10, loops 5 (6 pts), ternaries 2 (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.
ai_ready_helpers.project_domain_skeleton (cognitive 31) backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1225— ai_ready_helpers.project_domain_skeleton has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 10, loops 5 (6 pts), ternaries 2 (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.
NewBrainOverlay.NewBrainContent (cognitive 31) desktop/src/components/layout/NewBrainOverlay.tsx:92— NewBrainOverlay.NewBrainContent has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 8 (11 pts), boolean chains 4, error handling 3 (4 pts), loops 1 (nesting depth added 6). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 215, 142, 185, …). 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.
EvalDashboard.GuideTab (cognitive 31) desktop/src/pages/EvalDashboard.tsx:1698— EvalDashboard.GuideTab has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 24 (30 pts), boolean chains 1 (nesting depth added 6). Of this number, 20 points are the body's own statements and 11 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.
FileViewerPanel.FileViewerPanelImpl (cognitive 31) desktop/src/components/file-viewer/FileViewerPanel.tsx:139— FileViewerPanel.FileViewerPanelImpl has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 15, if/else 11, ternaries 5. Of this number, 19 points are the body's own statements and 12 belong to 7 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.
ddd_entry_lifecycle.assess_decay (cognitive 30) backend/core/ddd_entry_lifecycle.py:855— ddd_entry_lifecycle.assess_decay has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 2, ternaries 1 (2 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.
mcp_config_loader.add_mcp_server_to_dict (cognitive 30) backend/core/mcp_config_loader.py:303— mcp_config_loader.add_mcp_server_to_dict has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (7 pts), boolean chains 5 (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.
PluginManager.list_cached_plugins (cognitive 30) backend/core/plugin_manager.py:954— PluginManager.list_cached_plugins has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 1 (5 pts), loops 4 (5 pts), boolean chains 2 (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.
SkillManager._scan_tier (cognitive 30) backend/core/skill_manager.py:576— SkillManager._scan_tier has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 6 (10 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.
DistillationTriggerHook._supersede_by_topic (cognitive 30) backend/hooks/distillation_hook.py:1276— DistillationTriggerHook._supersede_by_topic has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 2 (6 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.
eval_runner.eval_trajectory (cognitive 30) backend/scripts/eval_runner.py:440— eval_runner.eval_trajectory has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (9 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.
pipeline_validator._check_security_boundaries (cognitive 30) backend/scripts/pipeline_validator.py:1124— pipeline_validator._check_security_boundaries has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 5, ternaries 4 (5 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.
SelfLoopsHealthEngine._auto_remediate (cognitive 30) backend/skills/s_loops-health/scripts/loops_health_check.py:692— SelfLoopsHealthEngine._auto_remediate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (26 pts), error handling 1 (2 pts), boolean chains 1, 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.
format_recommend.recommend (cognitive 30) backend/skills/s_pollinate/scripts/format_recommend.py:158— format_recommend.recommend has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (5 pts), boolean chains 3, 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.
generate_tts.main (cognitive 30) backend/skills/s_pollinate/scripts/generate_tts.py:109— generate_tts.main has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (20 pts), loops 3 (5 pts), ternaries 1 (3 pts), boolean chains 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.
publish_meta.generate_publish_info (cognitive 30) backend/skills/s_pollinate/scripts/publish_meta.py:143— publish_meta.generate_publish_info has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (5 pts), boolean chains 3, ternaries 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.
HistoryView.HistoryView (cognitive 30) desktop/src/pages/chat/components/RightSidebar/HistoryView.tsx:34— HistoryView.HistoryView has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 10 (20 pts), boolean chains 6, if/else 4 (nesting depth added 10). Of this number, 20 points are the body's own statements and 10 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.
OnboardingPage.OnboardingPage (cognitive 30) desktop/src/pages/OnboardingPage.tsx:40— OnboardingPage.OnboardingPage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, ternaries 5 (6 pts), error handling 3 (4 pts) (nesting depth added 5). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 59, 144, 58, …). 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.
ddd_cultivation.detect_contradiction (cognitive 29) backend/core/ddd_cultivation.py:1446— ddd_cultivation.detect_contradiction has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7, loops 4 (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.
ddd_entry_lifecycle.bump_references (cognitive 29) backend/core/ddd_entry_lifecycle.py:783— ddd_entry_lifecycle.bump_references has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 pts), error handling 2 (5 pts), boolean chains 3 (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.
knowledge_store.chunk_markdown (cognitive 29) backend/core/knowledge_store.py:67— knowledge_store.chunk_markdown has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), ternaries 2 (5 pts), boolean chains 3 (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.
SessionUnit._check_mcp_health (cognitive 29) backend/core/session_unit.py:3111— SessionUnit._check_mcp_health has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 5, loops 2, error handling 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.
SwarmWorkspaceManager._seed_hive_from_package (cognitive 29) backend/core/swarm_workspace_manager.py:1243— SwarmWorkspaceManager._seed_hive_from_package has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 4, loops 2 (4 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.
ui_actions.format_attention_for_agent (cognitive 29) backend/core/ui_actions.py:773— ui_actions.format_attention_for_agent has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (8 pts), ternaries 2 (3 pts), boolean chains 2, error handling 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.
EvolutionMaintenanceHook._size_evict_locked (cognitive 29) backend/hooks/evolution_maintenance_hook.py:793— EvolutionMaintenanceHook._size_evict_locked has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 5 (6 pts), ternaries 2 (5 pts), error handling 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.
swarmai_monthly_report._collect_pipeline_metrics (cognitive 29) backend/jobs/handlers/swarmai_monthly_report.py:153— swarmai_monthly_report._collect_pipeline_metrics has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (5 pts), error handling 2 (4 pts), boolean chains 2, 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.
job_manager.cmd_edit (cognitive 29) backend/jobs/job_manager.py:210— job_manager.cmd_edit has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (4 pts), 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.
artifact_cli._lookup_already_committed (cognitive 29) backend/scripts/artifact_cli.py:2852— artifact_cli._lookup_already_committed has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (6 pts), error handling 2 (4 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.
artifact_cli.cmd_release_gate (cognitive 29) backend/scripts/artifact_cli.py:3258— artifact_cli.cmd_release_gate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 4 (7 pts), error handling 4 (6 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.
pipeline_validator._check_output_routing (cognitive 29) backend/scripts/pipeline_validator.py:2424— pipeline_validator._check_output_routing has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 2 (4 pts), boolean chains 2 (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.
distribute.main (cognitive 29) backend/skills/s_ddd-distribute/scripts/distribute.py:57— distribute.main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (9 pts), loops 4 (6 pts), error handling 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.
EvalDashboard.GoldenSetTab (cognitive 29) desktop/src/pages/EvalDashboard.tsx:495— EvalDashboard.GoldenSetTab has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 16, if/else 8, ternaries 4, loops 1. Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 519, 607, 531, …). 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.
useCanvasHost.useCanvasHost (cognitive 29) desktop/src/hooks/useCanvasHost.ts:148— useCanvasHost.useCanvasHost has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 9, ternaries 4, error handling 1 (nesting depth added 3). 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 literals inside it that branch (lines 311, 233, 251, …). 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.
ddd_drift_signal.map_at_risk_cases (cognitive 28) backend/core/ddd_drift_signal.py:158— ddd_drift_signal.map_at_risk_cases has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (17 pts), loops 4 (10 pts), boolean chains 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.
ddd_packager._scan_text (cognitive 28) backend/core/ddd_packager.py:244— ddd_packager._scan_text has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (8 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.
engine_metrics.collect_ddd_change_suggestions (cognitive 28) backend/core/engine_metrics.py:154— engine_metrics.collect_ddd_change_suggestions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 5, 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.
ingestion_gate.admit_memory_lesson (cognitive 28) backend/core/ingestion_gate.py:840— ingestion_gate.admit_memory_lesson has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 2 (7 pts), boolean chains 5, ternaries 1 (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.
library_mounts.index_docs_mount (cognitive 28) backend/core/library_mounts.py:579— library_mounts.index_docs_mount has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (4 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.
LifecycleManager._get_mcp_server_patterns (cognitive 28) backend/core/lifecycle_manager.py:1901— LifecycleManager._get_mcp_server_patterns has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 2, error handling 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.
prompt_builder._render_ui_context_section (cognitive 28) REDACTED:202— prompt_builder._render_ui_context_section has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 10, 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.
ProposalFeedbackTracker.compute_channel_stats (cognitive 28) backend/core/proposal_feedback.py:158— ProposalFeedbackTracker.compute_channel_stats has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (5 pts), error handling 2 (4 pts), loops 2, 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.
recall_multi.detect_active_project (cognitive 28) backend/core/recall_multi.py:1064— recall_multi.detect_active_project has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 1 (3 pts), ternaries 1 (3 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.
ContextHealthHook._run_eval_canary (cognitive 28) backend/hooks/context_health_hook.py:346— ContextHealthHook._run_eval_canary has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 3 (6 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.
ContextHealthHook._check_governance_budgets (cognitive 28) backend/hooks/context_health_hook.py:3291— ContextHealthHook._check_governance_budgets has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 3 (6 pts), boolean chains 2, 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.
DistillationTriggerHook._extract_lessons (cognitive 28) backend/hooks/distillation_hook.py:1161— DistillationTriggerHook._extract_lessons has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 7, loops 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.
EvolutionMaintenanceHook._check_promotion_threshold (cognitive 28) backend/hooks/evolution_maintenance_hook.py:961— EvolutionMaintenanceHook._check_promotion_threshold has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (3 pts), 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.
pipelines._load_pipeline_runs (cognitive 28) backend/routers/pipelines.py:116— pipelines._load_pipeline_runs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (8 pts), loops 3 (6 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.
context_recall_cli.main (cognitive 28) backend/scripts/context_recall_cli.py:52— context_recall_cli.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), error handling 2 (3 pts), ternaries 2 (3 pts), loops 1 (2 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.
evolution_escalation_probe.main (cognitive 28) backend/scripts/evolution_escalation_probe.py:73— evolution_escalation_probe.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, boolean chains 7, loops 6 (7 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.
migrate_skills.migrate_skill (cognitive 28) backend/scripts/migrate_skills.py:400— migrate_skills.migrate_skill has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 6). 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.
scan.main (cognitive 28) backend/skills/s_context-hygiene/scripts/scan.py:201— scan.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 4 (9 pts), boolean chains 1, ternaries 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.
DocxXMLEditor.revert_deletion (cognitive 28) backend/skills/s_docx/scripts/document.py:342— DocxXMLEditor.revert_deletion has cognitive complexity 28 (threshold 15). Drivers by points: loops 5 (14 pts), if/else 8 (12 pts), boolean chains 2 (nesting depth added 13). 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.
SelfLoopsHealthEngine._check_infrastructure (cognitive 28) backend/skills/s_loops-health/scripts/loops_health_check.py:609— SelfLoopsHealthEngine._check_infrastructure has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 7 (9 pts), boolean chains 2, loops 1 (nesting depth added 6). 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.
SelfLoopsHealthEngine._find_stale_pipelines (cognitive 28) backend/skills/s_loops-health/scripts/loops_health_check.py:893— SelfLoopsHealthEngine._find_stale_pipelines has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), error handling 1 (3 pts), boolean chains 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.
ExplorerToolbar.ExplorerToolbar (cognitive 28) desktop/src/components/workspace-explorer/ExplorerToolbar.tsx:34— ExplorerToolbar.ExplorerToolbar has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17, ternaries 4 (5 pts), boolean chains 4, error handling 2 (nesting depth added 1). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 89, 146, 127, …). 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.
CMBrainOverlay.CMBrainContent (cognitive 28) desktop/src/components/layout/CMBrainOverlay.tsx:167— CMBrainOverlay.CMBrainContent has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 10 (17 pts), boolean chains 9, if/else 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.
ToDoOverlay.ToDoContent (cognitive 28) desktop/src/components/layout/ToDoOverlay.tsx:195— ToDoOverlay.ToDoContent has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 7, if/else 7, error handling 3 (nesting depth added 5). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 299, 249, 214, …). 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.
PollinateOverlay.PollinateContent (cognitive 28) desktop/src/components/layout/PollinateOverlay.tsx:108— PollinateOverlay.PollinateContent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12, boolean chains 11, ternaries 4 (5 pts) (nesting depth added 1). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 168, 148, 213, …). 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.
EngineMetricsTab.EngineMetricsTab (cognitive 28) desktop/src/components/settings/EngineMetricsTab.tsx:54— EngineMetricsTab.EngineMetricsTab has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, ternaries 8 (12 pts), if/else 3, error handling 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 12 belong to 6 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.
SlackChannelAdapter._ws_health_monitor (cognitive 27) REDACTED:1650— SlackChannelAdapter._ws_health_monitor has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (18 pts), error handling 1 (5 pts), boolean chains 3, 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.
ddd_cultivation._cultivate_proposals (cognitive 27) backend/core/ddd_cultivation.py:2603— ddd_cultivation._cultivate_proposals has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (24 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.
needs_human_review.needs_human_review_batch (cognitive 27) backend/core/needs_human_review.py:369— needs_human_review.needs_human_review_batch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 3 (5 pts), loops 3 (4 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.
PluginManager._parse_marketplace_json_with_name (cognitive 27) backend/core/plugin_manager.py:250— PluginManager._parse_marketplace_json_with_name has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 4, error handling 1, loops 1 (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.
proactive_intelligence._get_signal_highlights (cognitive 27) backend/core/proactive_intelligence.py:556— proactive_intelligence._get_signal_highlights has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 3 (7 pts), error handling 2 (4 pts), loops 2, boolean chains 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.
scheduler.load_user_context (cognitive 27) backend/jobs/scheduler.py:242— scheduler.load_user_context has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 3 (5 pts), ternaries 2 (4 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.
design_system.format_page_override_md (cognitive 27) backend/skills/s_frontend-design/scripts/design_system.py:886— design_system.format_page_override_md has cognitive complexity 27 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 13 (nesting depth added 7). 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.
hiveComponents.AuthDisplay (cognitive 27) desktop/src/components/settings/hiveComponents.tsx:256— hiveComponents.AuthDisplay has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 8, error handling 3 (6 pts), boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 275, 310, 324, …). 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.
EvalDashboard.OverviewTab (cognitive 27) desktop/src/pages/EvalDashboard.tsx:289— EvalDashboard.OverviewTab has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 13 (14 pts), boolean chains 11, if/else 2 (nesting depth added 1). Of this number, 26 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.
FilePreviewModal.FilePreviewModal (cognitive 27) desktop/src/components/workspace/FilePreviewModal.tsx:48— FilePreviewModal.FilePreviewModal has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11, boolean chains 8, ternaries 5 (6 pts), error handling 1 (2 pts) (nesting depth added 2). Most of this is not in the body itself: 6 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 102, 79). 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.
context_injector._extract_agent_spawns (cognitive 26) backend/core/context_injector.py:362— context_injector._extract_agent_spawns has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (3 pts), boolean chains 1, error handling 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.
engine_metrics._collect_ddd_health (cognitive 26) backend/core/engine_metrics.py:477— engine_metrics._collect_ddd_health has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (8 pts), boolean chains 2, error handling 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.
proactive_intelligence._parse_open_threads (cognitive 26) backend/core/proactive_intelligence.py:100— proactive_intelligence._parse_open_threads has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 3, 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.
proactive_intelligence._extract_report_field (cognitive 26) backend/core/proactive_intelligence.py:1589— proactive_intelligence._extract_report_field has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (6 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.
security_hooks._is_irreversible_external_op (cognitive 26) backend/core/security_hooks.py:182— security_hooks._is_irreversible_external_op has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (5 pts), boolean chains 1, error handling 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. This shape REPEATS in the file: 2 other methods here (security_hooks._is_history_rewrite, security_hooks._command_has_git_commit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
security_hooks._is_history_rewrite (cognitive 26) backend/core/security_hooks.py:610— security_hooks._is_history_rewrite has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (5 pts), boolean chains 1, error handling 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. This shape REPEATS in the file: 2 other methods here (security_hooks._is_irreversible_external_op, security_hooks._command_has_git_commit) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
security_hooks._command_has_git_commit (cognitive 26) backend/core/security_hooks.py:1625— security_hooks._command_has_git_commit has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (5 pts), boolean chains 1, error handling 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. This shape REPEATS in the file: 2 other methods here (security_hooks._is_irreversible_external_op, security_hooks._is_history_rewrite) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
DistillationTriggerHook._apply_deliverable_reconciliation (cognitive 26) backend/hooks/distillation_hook.py:2117— DistillationTriggerHook._apply_deliverable_reconciliation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 5 (7 pts), boolean chains 3 (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.
swarmai_monthly_report._collect_eval_metrics (cognitive 26) backend/jobs/handlers/swarmai_monthly_report.py:297— swarmai_monthly_report._collect_eval_metrics has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 2 (4 pts), loops 2, ternaries 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.
self_tune.suggest_new_feeds (cognitive 26) backend/jobs/self_tune.py:349— self_tune.suggest_new_feeds has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 5 (9 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.
pipelines.pipeline_run_detail (cognitive 26) backend/routers/pipelines.py:645— pipelines.pipeline_run_detail has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, ternaries 2 (4 pts), loops 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.
pollinate._publish_status_for (cognitive 26) backend/routers/pollinate.py:232— pollinate._publish_status_for has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 1 (6 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 17). 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.
migrate_skills.generate_manifest (cognitive 26) backend/scripts/migrate_skills.py:235— migrate_skills.generate_manifest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 4 (7 pts), boolean chains 3, error handling 1 (2 pts), 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.
pipeline_pr.create_pr (cognitive 26) backend/skills/s_autonomous-pipeline/scripts/pipeline_pr.py:240— pipeline_pr.create_pr has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (16 pts), error handling 5 (9 pts), loops 1 (nesting depth added 6). 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.
brand_chart.apply_brand_to_charts (cognitive 26) backend/skills/s_pollinate/scripts/brand_chart.py:58— brand_chart.apply_brand_to_charts has cognitive complexity 26 (threshold 15). Drivers by points: error handling 4 (14 pts), if/else 2 (6 pts), loops 3 (6 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.
generate_shorts.main (cognitive 26) backend/skills/s_pollinate/scripts/generate_shorts.py:522— generate_shorts.main has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 4 (5 pts), 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.
ShapeData.get_font_path (cognitive 26) backend/skills/s_pptx/scripts/inventory.py:280— ShapeData.get_font_path has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (8 pts), error handling 1 (2 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.
MultiSelect.MultiSelect (cognitive 26) desktop/src/components/common/MultiSelect.tsx:25— MultiSelect.MultiSelect has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (9 pts), ternaries 2 (nesting depth added 1). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 69, 60, 44, …). 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.
CodeGraph.CodeGraph (cognitive 26) desktop/src/components/code-intel/CodeGraph.tsx:76— CodeGraph.CodeGraph has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, boolean chains 11, loops 2, ternaries 1. Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 168, 156, 100, …). 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.
PdfRenderer.PdfRenderer (cognitive 26) desktop/src/components/file-viewer/renderers/PdfRenderer.tsx:44— PdfRenderer.PdfRenderer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, ternaries 6 (7 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 167, 59, 78, …). 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.
TSCCModules.SystemPromptModule (cognitive 26) desktop/src/pages/chat/components/TSCCModules.tsx:655— TSCCModules.SystemPromptModule has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 11, ternaries 1. Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 713, 663, 726, …). 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.
dead_code._is_entry_point (cognitive 25) backend/core/code_intel/dead_code.py:59— dead_code._is_entry_point has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 3 (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.
community_data.parse_hot_topics (cognitive 25) backend/core/community_data.py:732— community_data.parse_hot_topics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, ternaries 2 (4 pts), error handling 2, loops 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.
CompactionGuard.check (cognitive 25) backend/core/compaction_guard.py:609— CompactionGuard.check has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (10 pts), error handling 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.
ddd_health.compute_section_health (cognitive 25) backend/core/ddd_health.py:256— ddd_health.compute_section_health has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 3 (7 pts), loops 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.
ddd_job_registry.build_manifest_jobs (cognitive 25) backend/core/ddd_job_registry.py:121— ddd_job_registry.build_manifest_jobs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), error handling 2 (3 pts), ternaries 1 (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.
ddd_orchestrator._watch_paths_for (cognitive 25) backend/core/ddd_orchestrator.py:215— ddd_orchestrator._watch_paths_for has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 16). 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.
ddd_packager._materialize_shared (cognitive 25) backend/core/ddd_packager.py:913— ddd_packager._materialize_shared has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (8 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.
security_hooks._is_dangerous_rm (cognitive 25) backend/core/security_hooks.py:99— security_hooks._is_dangerous_rm has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 6, loops 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.
session_registry.kill_all_claude_processes (cognitive 25) backend/core/session_registry.py:175— session_registry.kill_all_claude_processes has cognitive complexity 25 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 7 (10 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.
SessionRouter._evict_idle (cognitive 25) backend/core/session_router.py:2431— SessionRouter._evict_idle has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 3, 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.
session_utils._build_error_event (cognitive 25) backend/core/session_utils.py:498— session_utils._build_error_event has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (3 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.
ContextHealthHook._light_refresh (cognitive 25) backend/hooks/context_health_hook.py:175— ContextHealthHook._light_refresh has cognitive complexity 25 (threshold 15). Drivers by points: error handling 16 (19 pts), if/else 5 (6 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.
EvolutionMaintenanceHook._quality_gate (cognitive 25) backend/hooks/evolution_maintenance_hook.py:361— EvolutionMaintenanceHook._quality_gate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 2 (3 pts), loops 3, 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.
swarmai_monthly_report._collect_git_metrics (cognitive 25) backend/jobs/handlers/swarmai_monthly_report.py:537— swarmai_monthly_report._collect_git_metrics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (5 pts), error handling 2, boolean chains 1 (nesting depth added 13). 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.
model_resolve.resolve_job_model (cognitive 25) backend/jobs/model_resolve.py:36— model_resolve.resolve_job_model has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 4 (8 pts), boolean chains 6, 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.
ddd_brain._brain_detail_metrics (cognitive 25) backend/routers/ddd_brain.py:763— ddd_brain._brain_detail_metrics has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 5 (7 pts), loops 1 (2 pts), ternaries 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.
tscc.get_security_scan (cognitive 25) backend/routers/tscc.py:159— tscc.get_security_scan has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 6, ternaries 2 (3 pts), 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, 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.
artifact_cli._next_stage_continuation (cognitive 25) backend/scripts/artifact_cli.py:617— artifact_cli._next_stage_continuation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 2 (3 pts), boolean chains 2, error handling 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.
check_migration_class.check_migration_class (cognitive 25) backend/scripts/check_migration_class.py:197— check_migration_class.check_migration_class has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 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.
scenario_runner.parse_final_text (cognitive 25) backend/scripts/scenario_runner.py:114— scenario_runner.parse_final_text has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
SelfLoopsHealthEngine._compute_compound_score (cognitive 25) backend/skills/s_loops-health/scripts/loops_health_check.py:1051— SelfLoopsHealthEngine._compute_compound_score has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 2 (5 pts), error handling 2 (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.
cross_format_check.main (cognitive 25) backend/skills/s_pollinate/scripts/cross_format_check.py:266— cross_format_check.main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 1 (2 pts), ternaries 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.
format_recommend.detect_fast_path (cognitive 25) backend/skills/s_pollinate/scripts/format_recommend.py:412— format_recommend.detect_fast_path has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 3, loops 2 (3 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.
steeringify.extract_corrections (cognitive 25) backend/skills/s_steeringify/steeringify.py:94— steeringify.extract_corrections has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 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.
lint_skills.corpus_files (cognitive 25) scripts/lint_skills.py:262— lint_skills.corpus_files has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 1 (2 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.
UpdateNotification.UpdateNotification (cognitive 25) desktop/src/components/common/UpdateNotification.tsx:16— UpdateNotification.UpdateNotification has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, ternaries 3 (5 pts), if/else 4, error handling 3 (nesting depth added 2). Of this number, 15 points are the body's own statements and 10 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.
MergedToolBlock.MergedToolBlock (cognitive 25) desktop/src/pages/chat/components/MergedToolBlock.tsx:122— MergedToolBlock.MergedToolBlock has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 9, if/else 4 (5 pts) (nesting depth added 3). Of this number, 20 points are the body's own statements and 5 belong to 4 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.
BrainHub.ReviewView (cognitive 25) desktop/src/components/layout/BrainHub.tsx:840— BrainHub.ReviewView has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 5, if/else 5, error handling 3 (nesting depth added 2). Of this number, 17 points are the body's own statements and 8 belong to 4 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.
parser._regex_fallback (cognitive 24) backend/core/code_intel/parser.py:1742— parser._regex_fallback has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (8 pts), ternaries 2 (4 pts), boolean chains 2, error handling 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.
ContextDirectoryLoader._assemble_from_sources (cognitive 24) backend/core/context_directory_loader.py:869— ContextDirectoryLoader._assemble_from_sources has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (7 pts), boolean chains 2, loops 2, ternaries 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.
ddd_packager.gate_dangling_skill_refs (cognitive 24) backend/core/ddd_packager.py:580— ddd_packager.gate_dangling_skill_refs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts), boolean chains 3, ternaries 2 (3 pts), 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.
memory_index._bm25_scores (cognitive 24) backend/core/memory_index.py:267— memory_index._bm25_scores has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (7 pts), ternaries 2 (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.
session_health_probe.session_health_probe (cognitive 24) backend/core/session_health_probe.py:190— session_health_probe.session_health_probe has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), error handling 5 (6 pts), ternaries 3, 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.
StreamingOrchestrator._build_file_delete_events (cognitive 24) backend/core/streaming_orchestrator.py:435— StreamingOrchestrator._build_file_delete_events has cognitive complexity 24 (threshold 15). Drivers by points: error handling 3 (8 pts), if/else 4 (8 pts), ternaries 3 (7 pts), loops 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.
transcript_indexer.parse_transcript (cognitive 24) REDACTED:45— transcript_indexer.parse_transcript has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (4 pts), 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.
github_trending.fetch_github_trending (cognitive 24) backend/jobs/adapters/github_trending.py:47— github_trending.fetch_github_trending has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (8 pts), error handling 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.
weibo_trending._search_keyword (cognitive 24) backend/jobs/adapters/weibo_trending.py:135— weibo_trending._search_keyword has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (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.
swarmai_monthly_report._collect_prior_month_metrics (cognitive 24) backend/jobs/handlers/swarmai_monthly_report.py:480— swarmai_monthly_report._collect_prior_month_metrics has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 1, 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.
self_tune.track_signal_usage (cognitive 24) backend/jobs/self_tune.py:176— self_tune.track_signal_usage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (7 pts), ternaries 2, boolean chains 1, 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.
DocxXMLEditor.revert_insertion (cognitive 24) backend/skills/s_docx/scripts/document.py:264— DocxXMLEditor.revert_insertion has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 5 (8 pts) (nesting depth added 13). 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.
phonemes.load_phoneme_dicts (cognitive 24) backend/skills/s_pollinate/scripts/tts/phonemes.py:7— phonemes.load_phoneme_dicts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 1, ternaries 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.
todo_db._print_work_packet (cognitive 24) backend/skills/s_radar-todo/scripts/todo_db.py:149— todo_db._print_work_packet has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 11, ternaries 1 (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.
ai_ready_helpers.blind_spot_scan (cognitive 24) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:947— ai_ready_helpers.blind_spot_scan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, loops 5 (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.
mcp_validation.validate_config_entry (cognitive 24) backend/utils/mcp_validation.py:105— mcp_validation.validate_config_entry has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, 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.
BottomBar.BottomBar (cognitive 24) desktop/src/components/layout/BottomBar.tsx:89— BottomBar.BottomBar has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9, boolean chains 8, ternaries 5 (7 pts) (nesting depth added 2). Of this number, 13 points are the body's own statements and 11 belong to 8 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.
LibraryOverlay.BrowseTab (cognitive 24) desktop/src/components/layout/LibraryOverlay.tsx:198— LibraryOverlay.BrowseTab has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (19 pts), boolean chains 5 (nesting depth added 11). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 244, 252). 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.
SystemTab.SystemTab (cognitive 24) desktop/src/components/settings/SystemTab.tsx:26— SystemTab.SystemTab has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 6, error handling 4 (5 pts), if/else 3 (4 pts) (nesting depth added 6). Of this number, 12 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.
FileBrowser.FileBrowser (cognitive 24) desktop/src/components/workspace/FileBrowser.tsx:99— FileBrowser.FileBrowser has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 5, boolean chains 4 (nesting depth added 7). Of this number, 13 points are the body's own statements and 11 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.
ChannelGateway._should_reply (cognitive 23) backend/channels/gateway.py:1164— ChannelGateway._should_reply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, error handling 1 (3 pts), 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.
module_map.detect_cross_module_changes (cognitive 23) backend/core/code_intel/module_map.py:195— module_map.detect_cross_module_changes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 6 (9 pts), error handling 2 (3 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.
context_injector._extract_skill_invocations (cognitive 23) backend/core/context_injector.py:397— context_injector._extract_skill_invocations has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
ddd_bindings.describe_project_ddd_line (cognitive 23) backend/core/ddd_bindings.py:545— ddd_bindings.describe_project_ddd_line has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), error handling 2 (3 pts), ternaries 3, 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.
ddd_health._build_changelog_index (cognitive 23) backend/core/ddd_health.py:159— ddd_health._build_changelog_index has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 3 (5 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.
library_health.apply_action (cognitive 23) backend/core/library_health.py:191— library_health.apply_action has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts), error handling 2 (4 pts), boolean chains 2, ternaries 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.
proactive_intelligence._extract_jobs_summary (cognitive 23) backend/core/proactive_intelligence.py:1703— proactive_intelligence._extract_jobs_summary has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 4 (8 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.
recall_multi._ddd_entry_hits (cognitive 23) backend/core/recall_multi.py:98— recall_multi._ddd_entry_hits has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 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.
SessionRouter._acquire_chat_slot (cognitive 23) backend/core/session_router.py:2291— SessionRouter._acquire_chat_slot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 1 (2 pts), boolean chains 1, loops 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.
session_router._convert_unsupported_blocks_to_path_hints (cognitive 23) backend/core/session_router.py:1556— session_router._convert_unsupported_blocks_to_path_hints has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (3 pts), ternaries 1 (3 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.
swarm_workspace_manager._load_ddd_native_skill_templates (cognitive 23) backend/core/swarm_workspace_manager.py:630— swarm_workspace_manager._load_ddd_native_skill_templates has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 2 (6 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.
ContextHealthHook._check_self_report_drift (cognitive 23) backend/hooks/context_health_hook.py:3167— ContextHealthHook._check_self_report_drift has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 2 (5 pts), loops 2 (3 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.
DistillationTriggerHook._reconcile_open_threads_from_deliverables (cognitive 23) backend/hooks/distillation_hook.py:2053— DistillationTriggerHook._reconcile_open_threads_from_deliverables has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, error handling 2 (3 pts), 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.
ImprovementWritebackHook._extract_lessons (cognitive 23) backend/hooks/improvement_writeback_hook.py:212— ImprovementWritebackHook._extract_lessons has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 2, ternaries 1 (2 pts), 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.
trending.fetch_trending (cognitive 23) backend/jobs/adapters/trending.py:47— trending.fetch_trending has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 2 (3 pts), 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.
artifact_cli._auto_validate_before_advance (cognitive 23) backend/scripts/artifact_cli.py:827— artifact_cli._auto_validate_before_advance has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, error handling 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.
style-extract.aggregate_style (cognitive 23) backend/skills/s_pptx/scripts/style-extract.py:201— style-extract.aggregate_style has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 3 (5 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.
ai_ready_helpers.evaluate_verification_response (cognitive 23) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3422— ai_ready_helpers.evaluate_verification_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), boolean chains 2, ternaries 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.
diff_parser.format_human_summary (cognitive 23) backend/utils/diff_parser.py:86— diff_parser.format_human_summary has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, ternaries 2 (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.
lint_doc_frontmatter.main (cognitive 23) scripts/lint_doc_frontmatter.py:134— lint_doc_frontmatter.main has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (4 pts), ternaries 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.
uiCommands.dispatchUiCommand (cognitive 23) desktop/src/utils/uiCommands.ts:99— uiCommands.dispatchUiCommand has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (7 pts), boolean chains 6 (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.
BackupTab.BackupTab (cognitive 23) desktop/src/components/settings/BackupTab.tsx:15— BackupTab.BackupTab has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, ternaries 5 (6 pts), error handling 4, if/else 3 (nesting depth added 1). Of this number, 13 points are the body's own statements and 10 belong to 6 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.
SlackChannelAdapter._mcp_post_message (cognitive 22) REDACTED:1348— SlackChannelAdapter._mcp_post_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 1 (4 pts), boolean chains 2, loops 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.
graph_analysis._build_file_domain_map (cognitive 22) backend/core/code_intel/graph_analysis.py:93— graph_analysis._build_file_domain_map has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, loops 4 (6 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.
parser._resolve_binding_name_nodes (cognitive 22) backend/core/code_intel/parser.py:359— parser._resolve_binding_name_nodes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 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.
ddd_cultivation.filter_lessons_for_ddd (cognitive 22) backend/core/ddd_cultivation.py:723— ddd_cultivation.filter_lessons_for_ddd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, ternaries 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.
LifecycleManager._sample_process_memory (cognitive 22) backend/core/lifecycle_manager.py:335— LifecycleManager._sample_process_memory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, error handling 1, 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.
RecallEngine.search (cognitive 22) backend/core/recall_engine.py:57— RecallEngine.search has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (7 pts), loops 3 (5 pts), error handling 1 (2 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.
SwarmWorkspaceManager.verify_integrity (cognitive 22) backend/core/swarm_workspace_manager.py:2207— SwarmWorkspaceManager.verify_integrity has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts), error handling 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.
ContextHealthHook._auto_update_doc_frontmatter (cognitive 22) backend/hooks/context_health_hook.py:492— ContextHealthHook._auto_update_doc_frontmatter has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 2 (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.
ContextHealthHook._sync_transcript_index (cognitive 22) backend/hooks/context_health_hook.py:2393— ContextHealthHook._sync_transcript_index has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 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.
data_point_folding._fold_one_family (cognitive 22) backend/hooks/data_point_folding.py:201— data_point_folding._fold_one_family has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3, boolean chains 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.
DistillationTriggerHook._verify_claim_against_git (cognitive 22) backend/hooks/distillation_hook.py:1493— DistillationTriggerHook._verify_claim_against_git has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 3 (6 pts), boolean chains 4, 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.
KnowledgeBackflowHook._execute_inner (cognitive 22) backend/hooks/knowledge_backflow_hook.py:253— KnowledgeBackflowHook._execute_inner has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2, 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.
clean_foreign_run_stubs.find_foreign_stubs (cognitive 22) backend/scripts/clean_foreign_run_stubs.py:59— clean_foreign_run_stubs.find_foreign_stubs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (6 pts), boolean chains 3, 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.
pipeline_validator.check_artifact_freshness (cognitive 22) backend/scripts/pipeline_validator.py:2511— pipeline_validator.check_artifact_freshness has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 2 (5 pts), loops 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.
pipeline_validator.main (cognitive 22) backend/scripts/pipeline_validator.py:3642— pipeline_validator.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (6 pts), error handling 1 (2 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.
update_convergence.append_to_convergence (cognitive 22) backend/scripts/update_convergence.py:177— update_convergence.append_to_convergence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (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.
cross_format_check.check_message_alignment (cognitive 22) backend/skills/s_pollinate/scripts/cross_format_check.py:79— cross_format_check.check_message_alignment has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 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.
cross_format_check.check_data_integrity (cognitive 22) backend/skills/s_pollinate/scripts/cross_format_check.py:136— cross_format_check.check_data_integrity has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (9 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.
deck_notes_injector.main (cognitive 22) backend/skills/s_pollinate/scripts/deck_notes_injector.py:264— deck_notes_injector.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (6 pts), ternaries 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.
format_recommend.main (cognitive 22) backend/skills/s_pollinate/scripts/format_recommend.py:502— format_recommend.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (5 pts), 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.
md_freeze.split_blocks (cognitive 22) backend/skills/s_translate/scripts/md_freeze.py:96— md_freeze.split_blocks has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 1 (5 pts), boolean chains 1, loops 1 (nesting depth added 12). 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.
html2pptx.validateTextBoxPosition (cognitive 22) backend/skills/s_pptx/scripts/html2pptx.js:88— html2pptx.validateTextBoxPosition has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (17 pts), boolean chains 4, loops 1 (nesting depth added 12). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 101). 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.
HistoryOverlay.HistoryContent (cognitive 22) desktop/src/components/layout/HistoryOverlay.tsx:59— HistoryOverlay.HistoryContent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4 (7 pts), error handling 2, boolean chains 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 91, 117, 138, …). 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.
CommunityOverlay.SourcesTab (cognitive 22) desktop/src/components/layout/CommunityOverlay.tsx:374— CommunityOverlay.SourcesTab has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (15 pts), boolean chains 5, error handling 1, if/else 1 (nesting depth added 5). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 423, 386, 391, …). 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.
AboutTab.AboutTab (cognitive 22) desktop/src/components/settings/AboutTab.tsx:26— AboutTab.AboutTab has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 2 (4 pts), error handling 2 (nesting depth added 2). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 47, 64, 33, …). 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.
SlackChannelAdapter._normalize_event (cognitive 21) REDACTED:586— SlackChannelAdapter._normalize_event has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, 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.
ChannelGateway._retry_loop (cognitive 21) backend/channels/gateway.py:1019— ChannelGateway._retry_loop has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 2 (4 pts), 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.
HumanResponseFormatter._split_on_boundaries (cognitive 21) backend/channels/response_formatter.py:54— HumanResponseFormatter._split_on_boundaries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 4, 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.
streaming.cleanup_stream (cognitive 21) backend/channels/streaming.py:407— streaming.cleanup_stream has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 3 (7 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.
attention_authority._collect_community_digests (cognitive 21) backend/core/attention_authority.py:443— attention_authority._collect_community_digests has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 3 (5 pts), loops 2, 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.
freshness.detect_spec_details_staleness (cognitive 21) backend/core/code_intel/freshness.py:224— freshness.detect_spec_details_staleness has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, error handling 2 (3 pts), loops 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.
module_map.build_module_map (cognitive 21) backend/core/code_intel/module_map.py:131— module_map.build_module_map has cognitive complexity 21 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 3 (8 pts), error handling 2 (4 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.
context_recall._truncate_at_sentence (cognitive 21) backend/core/context_recall.py:66— context_recall._truncate_at_sentence has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (5 pts), ternaries 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.
ddd_entry_lifecycle.classify_entry_type (cognitive 21) backend/core/ddd_entry_lifecycle.py:465— ddd_entry_lifecycle.classify_entry_type has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 7 (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.
ddd_entry_lifecycle.archive_raw_lines (cognitive 21) backend/core/ddd_entry_lifecycle.py:1070— ddd_entry_lifecycle.archive_raw_lines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, 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.
ddd_maturity.parse_maturity (cognitive 21) backend/core/ddd_maturity.py:119— ddd_maturity.parse_maturity has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, 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.
engine_metrics._collect_session_stats (cognitive 21) backend/core/engine_metrics.py:537— engine_metrics._collect_session_stats has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), loops 2 (3 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.
EvolutionOptimizer._is_quality_correction (cognitive 21) backend/core/evolution_optimizer.py:687— EvolutionOptimizer._is_quality_correction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 1 (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.
LifecycleManager._proactive_rss_restart (cognitive 21) backend/core/lifecycle_manager.py:433— LifecycleManager._proactive_rss_restart has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 3 (5 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.
memory_extractor._format_conversation (cognitive 21) backend/core/memory_extractor.py:95— memory_extractor._format_conversation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 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.
proactive_intelligence._extract_recent_deliverables (cognitive 21) backend/core/proactive_intelligence.py:259— proactive_intelligence._extract_recent_deliverables has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 5, loops 2 (3 pts), error handling 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.
runtime_hooks._read_subagent_prompt_head (cognitive 21) backend/core/runtime_hooks.py:943— runtime_hooks._read_subagent_prompt_head has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 2 (3 pts), ternaries 1 (2 pts), boolean chains 1, 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.
SessionMiner.mine_all (cognitive 21) REDACTED:472— SessionMiner.mine_all has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (9 pts), error handling 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.
SessionRouter.drain_pending (cognitive 21) backend/core/session_router.py:2678— SessionRouter.drain_pending has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 2 (5 pts), boolean chains 4, error handling 2 (3 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.
SessionUnit._spawn (cognitive 21) backend/core/session_unit.py:3278— SessionUnit._spawn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 7, ternaries 3, error handling 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.
skill_manager.parse_skill_md (cognitive 21) backend/core/skill_manager.py:215— skill_manager.parse_skill_md has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 11, if/else 8 (9 pts), boolean chains 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.
SummarizationPipeline._extract_open_questions (cognitive 21) backend/core/summarization.py:495— SummarizationPipeline._extract_open_questions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (17 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.
SummarizationPipeline._format_conversation_for_llm (cognitive 21) backend/core/summarization.py:683— SummarizationPipeline._format_conversation_for_llm has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 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.
UserObserver.observe_session (cognitive 21) backend/core/user_observer.py:88— UserObserver.observe_session has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (6 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.
DistillationTriggerHook._update_effectiveness_scoring (cognitive 21) backend/hooks/distillation_hook.py:371— DistillationTriggerHook._update_effectiveness_scoring has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 5, loops 2 (3 pts), error handling 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.
DistillationTriggerHook._extract_decisions (cognitive 21) backend/hooks/distillation_hook.py:1126— DistillationTriggerHook._extract_decisions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 8, 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.
DistillationTriggerHook._archive_stale_rc_entries (cognitive 21) backend/hooks/distillation_hook.py:2259— DistillationTriggerHook._archive_stale_rc_entries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 3 (5 pts), boolean chains 1, 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.
github_releases.fetch_github_releases (cognitive 21) backend/jobs/adapters/github_releases.py:48— github_releases.fetch_github_releases has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), error handling 1 (2 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.
self_tune.extract_projects (cognitive 21) backend/jobs/self_tune.py:61— self_tune.extract_projects has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 1 (2 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.
settings._list_bedrock_inference_profiles (cognitive 21) backend/routers/settings.py:153— settings._list_bedrock_inference_profiles has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 3, loops 2 (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.
artifact_cli.cmd_ddd_noise (cognitive 21) backend/scripts/artifact_cli.py:5754— artifact_cli.cmd_ddd_noise has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (5 pts), 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.
completion_gate.completion_surface_verdict (cognitive 21) backend/scripts/completion_gate.py:59— completion_gate.completion_surface_verdict has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, loops 2 (4 pts) (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.
golden_case_validator.main (cognitive 21) backend/scripts/golden_case_validator.py:371— golden_case_validator.main has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 4 (6 pts), loops 2 (3 pts), error handling 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.
pipeline_analytics.analyze_abandon_patterns (cognitive 21) backend/scripts/pipeline_analytics.py:421— pipeline_analytics.analyze_abandon_patterns has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (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.
pipeline_validator._check_understanding_gate (cognitive 21) backend/scripts/pipeline_validator.py:1052— pipeline_validator._check_understanding_gate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, ternaries 2 (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.
scenario_runner.parse_trajectory (cognitive 21) backend/scripts/scenario_runner.py:72— scenario_runner.parse_trajectory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (6 pts), loops 2 (3 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.
design_system._generate_intelligent_overrides (cognitive 21) backend/skills/s_frontend-design/scripts/design_system.py:995— design_system._generate_intelligent_overrides has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 1, 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.
todo_db._build_linked_context (cognitive 21) backend/skills/s_radar-todo/scripts/todo_db.py:78— todo_db._build_linked_context has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 10, ternaries 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.
lint_skills.lint_body (cognitive 21) scripts/lint_skills.py:343— lint_skills.lint_body has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 5 (8 pts), boolean chains 1, 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.
useReviewMode.useReviewMode (cognitive 21) desktop/src/hooks/useReviewMode.ts:75— useReviewMode.useReviewMode has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 7 (8 pts), boolean chains 3 (nesting depth added 4). Most of this is not in the body itself: 0 of the 21 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 170, 83, 163, …). 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.
FileEditorCore.DiffView (cognitive 21) desktop/src/components/common/FileEditorCore.tsx:380— FileEditorCore.DiffView has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, ternaries 7 (8 pts), if/else 3 (nesting depth added 1). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 415, 399, 480). 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.
useAudioPlayer.useAudioPlayer (cognitive 21) desktop/src/hooks/useAudioPlayer.ts:31— useAudioPlayer.useAudioPlayer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, error handling 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 3). Most of this is not in the body itself: 0 of the 21 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 91, 173, 43, …). 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.
attention_authority._collect_governance (cognitive 20) backend/core/attention_authority.py:195— attention_authority._collect_governance has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (7 pts), ternaries 2 (4 pts), error handling 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.
BackupManager._restore_impl (cognitive 20) backend/core/backup_manager.py:471— BackupManager._restore_impl has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 4 (5 pts), loops 2 (3 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.
canvas_surface.is_canvas_surfaceable (cognitive 20) backend/core/canvas_surface.py:90— canvas_surface.is_canvas_surfaceable has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, error handling 2, ternaries 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.
dead_code.find_dead_code (cognitive 20) backend/core/code_intel/dead_code.py:156— dead_code.find_dead_code has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (4 pts), loops 2 (3 pts), ternaries 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.
GraphStore._migrate_schema (cognitive 20) backend/core/code_intel/graph_store.py:322— GraphStore._migrate_schema has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (5 pts), boolean chains 4, loops 1 (3 pts), 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.
GraphStore.store_file_nodes_edges (cognitive 20) backend/core/code_intel/graph_store.py:595— GraphStore.store_file_nodes_edges has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 5 (6 pts), ternaries 3 (6 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.
ddd_cultivation.apply_retire_proposal (cognitive 20) backend/core/ddd_cultivation.py:1678— ddd_cultivation.apply_retire_proposal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 3 (4 pts), boolean chains 3 (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.
ddd_cultivation.write_proposal (cognitive 20) backend/core/ddd_cultivation.py:2307— ddd_cultivation.write_proposal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 3 (6 pts), boolean chains 2, loops 1 (2 pts), ternaries 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.
ddd_entry_lifecycle.reclaim_duplicate_entries (cognitive 20) backend/core/ddd_entry_lifecycle.py:1509— ddd_entry_lifecycle.reclaim_duplicate_entries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3, 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.
ddd_skill_registry.build_manifest (cognitive 20) backend/core/ddd_skill_registry.py:177— ddd_skill_registry.build_manifest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 pts), error handling 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.
engine_metrics.collect_memory_effectiveness (cognitive 20) backend/core/engine_metrics.py:42— engine_metrics.collect_memory_effectiveness has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, error handling 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.
EvalService.decide_governance (cognitive 20) backend/core/eval_service.py:1669— EvalService.decide_governance has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 1 (4 pts), ternaries 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.
closed_loop.audit_recurrence (cognitive 20) backend/core/evolution/closed_loop.py:37— closed_loop.audit_recurrence has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (8 pts), loops 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.
governance_router.classify_new_corrections (cognitive 20) backend/core/evolution/governance_router.py:167— governance_router.classify_new_corrections has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 3 (4 pts), boolean chains 2, loops 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.
LifecycleManager._streaming_rss_check (cognitive 20) backend/core/lifecycle_manager.py:529— LifecycleManager._streaming_rss_check has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, loops 2, 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.
LifecycleManager._scan_unprocessed_sessions (cognitive 20) backend/core/lifecycle_manager.py:1642— LifecycleManager._scan_unprocessed_sessions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 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.
MemoryGuard.scan (cognitive 20) backend/core/memory_guard.py:109— MemoryGuard.scan has cognitive complexity 20 (threshold 15). Drivers by points: loops 9 (14 pts), ternaries 1 (3 pts), if/else 2, boolean chains 1 (nesting depth added 7). 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.
SessionUnit._force_kill (cognitive 20) backend/core/session_unit.py:4378— SessionUnit._force_kill has cognitive complexity 20 (threshold 15). Drivers by points: error handling 6 (14 pts), if/else 5 (6 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.
bedrock.converse_with_retry (cognitive 20) backend/jobs/bedrock.py:384— bedrock.converse_with_retry has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 2, 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.
executor._handle_maintenance (cognitive 20) REDACTED:1075— executor._handle_maintenance has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 1 (2 pts), boolean chains 1, ternaries 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.
session_quality.run_session_quality (cognitive 20) backend/jobs/handlers/session_quality.py:88— session_quality.run_session_quality has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, ternaries 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.
chat._merge_consecutive_assistant_messages (cognitive 20) backend/routers/chat.py:1078— chat._merge_consecutive_assistant_messages 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.
ddd_brain._section_members (cognitive 20) backend/routers/ddd_brain.py:480— ddd_brain._section_members has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (6 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.
workspace_api._get_git_status (cognitive 20) backend/routers/workspace_api.py:261— workspace_api._get_git_status has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, error handling 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.
artifact_cli.cleanup_orphans (cognitive 20) backend/scripts/artifact_cli.py:1324— artifact_cli.cleanup_orphans has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 1 (3 pts), loops 2 (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.
artifact_cli.cmd_run_get (cognitive 20) backend/scripts/artifact_cli.py:3420— artifact_cli.cmd_run_get has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (7 pts), loops 2 (4 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.
check_migration_class.validate_enumeration_cmd (cognitive 20) backend/scripts/check_migration_class.py:78— check_migration_class.validate_enumeration_cmd has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 1 (3 pts), boolean chains 1, 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.
eval_runner.eval_trajectory_capture (cognitive 20) backend/scripts/eval_runner.py:1388— eval_runner.eval_trajectory_capture has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, error handling 3 (4 pts), 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.
judge_telemetry_report.render (cognitive 20) backend/scripts/judge_telemetry_report.py:101— judge_telemetry_report.render has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 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, 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.
pipeline_analytics._is_replaced_duplicate (cognitive 20) backend/scripts/pipeline_analytics.py:296— pipeline_analytics._is_replaced_duplicate 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.
pipeline_analytics.analyze_estimation_accuracy (cognitive 20) backend/scripts/pipeline_analytics.py:629— pipeline_analytics.analyze_estimation_accuracy has cognitive complexity 20 (threshold 15). Drivers by points: loops 7 (8 pts), if/else 4 (7 pts), boolean chains 3, ternaries 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.
pipeline_validator.check_ddd_staleness (cognitive 20) backend/scripts/pipeline_validator.py:1895— pipeline_validator.check_ddd_staleness has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
scan._load_routing (cognitive 20) backend/skills/s_context-hygiene/scripts/scan.py:69— scan._load_routing has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 4 (6 pts), ternaries 2 (6 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.
DocxXMLEditor._inject_attributes_to_nodes (cognitive 20) backend/skills/s_docx/scripts/document.py:116— DocxXMLEditor._inject_attributes_to_nodes has cognitive complexity 20 (threshold 15). Drivers by points: loops 8 (16 pts), if/else 2 (4 pts) (nesting depth added 10). 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.
SelfLoopsHealthEngine._check_knowledge (cognitive 20) backend/skills/s_loops-health/scripts/loops_health_check.py:378— SelfLoopsHealthEngine._check_knowledge has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7, if/else 4 (6 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 4). 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.
SelfLoopsHealthEngine._fix_ot_resolved (cognitive 20) backend/skills/s_loops-health/scripts/loops_health_check.py:825— SelfLoopsHealthEngine._fix_ot_resolved has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 2 (3 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.
lint_doc_frontmatter.check_file (cognitive 20) scripts/lint_doc_frontmatter.py:47— lint_doc_frontmatter.check_file has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 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.
DeckStage._onKey (cognitive 20) REDACTED:559— DeckStage._onKey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 6, ternaries 1 (2 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.
hiveComponents.InstanceCard (cognitive 20) desktop/src/components/settings/hiveComponents.tsx:114— hiveComponents.InstanceCard has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 16, ternaries 2 (3 pts), error handling 1 (nesting depth added 1). Of this number, 18 points are the body's own statements and 2 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.
TerminalTab.TerminalTab (cognitive 20) desktop/src/components/terminal/TerminalTab.tsx:61— TerminalTab.TerminalTab has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, error handling 3 (5 pts) (nesting depth added 3). Most of this is not in the body itself: 0 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 233, 154, 107, …). 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.
useReferencedFiles.useReferencedFiles (cognitive 20) desktop/src/hooks/useReferencedFiles.ts:263— useReferencedFiles.useReferencedFiles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 0 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 286, 276, 283, …). 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.
AttachmentPreviewCard.AttachmentPreviewCard (cognitive 20) desktop/src/components/chat/AttachmentPreviewCard.tsx:36— AttachmentPreviewCard.AttachmentPreviewCard has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (16 pts), boolean chains 4 (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.
AttachedFileChips.AttachedFileChips (cognitive 20) desktop/src/components/chat/AttachedFileChips.tsx:174— AttachedFileChips.AttachedFileChips has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, match/switch 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 184, 197, 220, …). 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.
(anonymous)::_onKey (cognitive 20) REDACTED:559— (anonymous)::_onKey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 6, ternaries 1 (2 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.
claude_environment._configure_claude_environment (cognitive 19) backend/core/claude_environment.py:184— claude_environment._configure_claude_environment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7 (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.
GraphStore.resolve_bare_targets (cognitive 19) backend/core/code_intel/graph_store.py:1547— GraphStore.resolve_bare_targets has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (4 pts), loops 3, 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.
parser.parse_file_with_status (cognitive 19) backend/core/code_intel/parser.py:1848— parser.parse_file_with_status has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, error handling 2 (3 pts), loops 1 (2 pts), 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.
context_recall.recall_context (cognitive 19) backend/core/context_recall.py:258— context_recall.recall_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3, boolean chains 1, error handling 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.
evolution_optimizer._write_cycle_changelog (cognitive 19) backend/core/evolution_optimizer.py:1792— evolution_optimizer._write_cycle_changelog has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), error handling 3, loops 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.
LifecycleManager._process_cultivation_events (cognitive 19) backend/core/lifecycle_manager.py:1378— LifecycleManager._process_cultivation_events has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts), error handling 2, 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.
needs_human_review._worktree_roots (cognitive 19) backend/core/needs_human_review.py:137— needs_human_review._worktree_roots has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (5 pts), loops 2 (3 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.
proactive_intelligence._newest_completed_run (cognitive 19) backend/core/proactive_intelligence.py:759— proactive_intelligence._newest_completed_run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (6 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.
security_hooks._segment_is_history_rewrite (cognitive 19) backend/core/security_hooks.py:669— security_hooks._segment_is_history_rewrite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, 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, 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.
session_harvest._parse_draft (cognitive 19) backend/core/session_harvest.py:104— session_harvest._parse_draft has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, error handling 2 (3 pts), 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.
session_healing.build_rich_checkpoint (cognitive 19) backend/core/session_healing.py:937— session_healing.build_rich_checkpoint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, error handling 1 (2 pts), ternaries 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.
SessionUnit._ensure_spawned (cognitive 19) backend/core/session_unit.py:2622— SessionUnit._ensure_spawned has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (2 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, 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.
session_utils.read_owner_pid (cognitive 19) backend/core/session_utils.py:587— session_utils.read_owner_pid has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 2 (4 pts), loops 1 (3 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.
SkillManager._scan_ddd_tier (cognitive 19) backend/core/skill_manager.py:512— SkillManager._scan_ddd_tier has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 4 (7 pts), loops 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.
transcript_indexer.chunk_transcript (cognitive 19) REDACTED:126— transcript_indexer.chunk_transcript has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), boolean chains 3 (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.
ContextHealthHook._expire_stale_proposals (cognitive 19) backend/hooks/context_health_hook.py:2179— ContextHealthHook._expire_stale_proposals has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, error handling 1 (3 pts), 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.
ddd_refresh.run_ddd_refresh (cognitive 19) backend/jobs/handlers/ddd_refresh.py:34— ddd_refresh.run_ddd_refresh has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (4 pts), boolean chains 2, loops 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.
session_health_probe.run_session_health_probe (cognitive 19) REDACTED:172— session_health_probe.run_session_health_probe has cognitive complexity 19 (threshold 15). Drivers by points: error handling 3 (7 pts), boolean chains 5, if/else 3 (4 pts), ternaries 3 (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.
skill_proposer._gather_skill_context (cognitive 19) backend/jobs/handlers/skill_proposer.py:217— skill_proposer._gather_skill_context has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), error handling 1 (2 pts), ternaries 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.
skill_proposer._generate_skill_proposal (cognitive 19) backend/jobs/handlers/skill_proposer.py:274— skill_proposer._generate_skill_proposal has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 pts), loops 1 (2 pts), 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.
main.write_backend_json (cognitive 19) backend/main.py:220— main.write_backend_json has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 3 (8 pts), boolean chains 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.
pipelines.list_pipelines (cognitive 19) backend/routers/pipelines.py:308— pipelines.list_pipelines has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 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.
system._verify_bedrock (cognitive 19) backend/routers/system.py:464— system._verify_bedrock has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, error handling 1, ternaries 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.
migrate_skills.extract_first_docstring (cognitive 19) backend/scripts/migrate_skills.py:185— migrate_skills.extract_first_docstring has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), error handling 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.
pipeline_validator._blocked_findings (cognitive 19) backend/scripts/pipeline_validator.py:106— pipeline_validator._blocked_findings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 1 (4 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.
design_system.format_markdown (cognitive 19) backend/skills/s_frontend-design/scripts/design_system.py:422— design_system.format_markdown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 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.
SelfLoopsHealthEngine._check_coherence (cognitive 19) backend/skills/s_loops-health/scripts/loops_health_check.py:496— SelfLoopsHealthEngine._check_coherence has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 3 (4 pts), error handling 1 (3 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.
todo_db.cmd_update (cognitive 19) backend/skills/s_radar-todo/scripts/todo_db.py:335— todo_db.cmd_update has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts), ternaries 1 (2 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.
security_scan._cors_fingerprints (cognitive 19) scripts/security_scan.py:332— security_scan._cors_fingerprints has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 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.
CMBrainOverlay.KnowledgeGraph (cognitive 19) desktop/src/components/layout/CMBrainOverlay.tsx:669— CMBrainOverlay.KnowledgeGraph has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 11 (15 pts), boolean chains 4 (nesting depth added 4). Of this number, 10 points are the body's own statements and 9 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.
useChatStreamingLifecycle.cleanupStalePendingEntries (cognitive 19) desktop/src/hooks/useChatStreamingLifecycle.ts:845— useChatStreamingLifecycle.cleanupStalePendingEntries has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 3 (7 pts), loops 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.
PollinateOverlay.InsightsView (cognitive 19) desktop/src/components/layout/PollinateOverlay.tsx:693— PollinateOverlay.InsightsView has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 694). 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.
ThreeColumnLayout.LeftSidebar (cognitive 19) desktop/src/components/layout/ThreeColumnLayout.tsx:177— ThreeColumnLayout.LeftSidebar has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 2, ternaries 1. Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 15 function literals inside it that branch (lines 313, 314, 224, …). 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.
useStreamingActivity.useStreamingActivity (cognitive 19) desktop/src/hooks/useStreamingActivity.ts:37— useStreamingActivity.useStreamingActivity has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3 (nesting depth added 4). Most of this is not in the body itself: 0 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 52, 118, 88, …). 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.
OnboardingPage.StepRestore (cognitive 19) desktop/src/pages/OnboardingPage.tsx:354— OnboardingPage.StepRestore has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, error handling 1, loops 1 (nesting depth added 3). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 386, 372, 462). 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.
SkillsPage.SkillsPage (cognitive 19) desktop/src/pages/SkillsPage.tsx:77— SkillsPage.SkillsPage has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 6, error handling 3, if/else 3 (nesting depth added 2). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 205, 110, 122, …). 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.
SlackChannelAdapter.update_message (cognitive 18) REDACTED:1208— SlackChannelAdapter.update_message has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (5 pts), ternaries 2 (4 pts), 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.
SlackChannelAdapter._try_socket_mode_reconnect (cognitive 18) REDACTED:1574— SlackChannelAdapter._try_socket_mode_reconnect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 3 (6 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.
streaming.handle_tool_use (cognitive 18) backend/channels/streaming.py:344— streaming.handle_tool_use has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (4 pts), ternaries 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.
cjk_index._expand_token (cognitive 18) backend/core/cjk_index.py:98— cjk_index._expand_token has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (6 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.
context_injector._extract_user_directives (cognitive 18) backend/core/context_injector.py:511— context_injector._extract_user_directives has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, error handling 1, 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.
context_injector._format_recent_turns (cognitive 18) backend/core/context_injector.py:876— context_injector._format_recent_turns has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1, 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.
ddd_packager.emit_target_aim (cognitive 18) backend/core/ddd_packager.py:1500— ddd_packager.emit_target_aim has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, loops 3, ternaries 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.
EvalService._merge_partition_cases (cognitive 18) backend/core/eval_service.py:1338— EvalService._merge_partition_cases has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), boolean chains 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.
evolution_optimizer.run_evolution_cycle (cognitive 18) backend/core/evolution_optimizer.py:1066— evolution_optimizer.run_evolution_cycle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 3 (5 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.
git_sync_engine._export_tables_sync (cognitive 18) backend/core/git_sync_engine.py:66— git_sync_engine._export_tables_sync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (3 pts), loops 2 (3 pts), 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.
git_sync_engine._import_tables_sync (cognitive 18) backend/core/git_sync_engine.py:209— git_sync_engine._import_tables_sync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (6 pts), 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.
library_mounts.judge_mount_kind (cognitive 18) backend/core/library_mounts.py:391— library_mounts.judge_mount_kind has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (5 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.
LifecycleManager._check_memory_pressure (cognitive 18) backend/core/lifecycle_manager.py:1534— LifecycleManager._check_memory_pressure has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, error handling 1, 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.
ManifestLoader.ensure_dependencies (cognitive 18) backend/core/manifest_loader.py:161— ManifestLoader.ensure_dependencies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), error handling 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, 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.
proactive_intelligence._extract_first_heading (cognitive 18) backend/core/proactive_intelligence.py:1658— proactive_intelligence._extract_first_heading has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1, 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.
recall_multi.render_recall_body (cognitive 18) backend/core/recall_multi.py:567— recall_multi.render_recall_body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 1 (2 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.
TaskManager._handle_pending_interaction (cognitive 18) REDACTED:321— TaskManager._handle_pending_interaction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), 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.
todo_stats.compute_history_stats (cognitive 18) backend/core/todo_stats.py:55— todo_stats.compute_history_stats has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, ternaries 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.
tool_risk.classify (cognitive 18) backend/core/tool_risk.py:103— tool_risk.classify has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 1 (2 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.
user_observer._extract_text (cognitive 18) backend/core/user_observer.py:56— user_observer._extract_text has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 pts), loops 1 (2 pts) (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.
TodoLifecycleHook._handle_implicit_matching (cognitive 18) backend/hooks/todo_lifecycle_hook.py:351— TodoLifecycleHook._handle_implicit_matching has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (3 pts), boolean chains 1, 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.
self_tune.prune_unused_feeds (cognitive 18) backend/jobs/self_tune.py:286— self_tune.prune_unused_feeds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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.
system.get_system_status (cognitive 18) backend/routers/system.py:150— system.get_system_status has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (7 pts), error handling 4, if/else 4, boolean chains 3 (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.
system._probe_aws_profiles (cognitive 18) backend/routers/system.py:807— system._probe_aws_profiles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, ternaries 2 (4 pts), error handling 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.
judge_telemetry_report._load_rows (cognitive 18) backend/scripts/judge_telemetry_report.py:38— judge_telemetry_report._load_rows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 2 (5 pts), boolean chains 1, 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.
refresh_ai_docs.check_staleness (cognitive 18) backend/scripts/refresh_ai_docs.py:343— refresh_ai_docs.check_staleness has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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.
refresh_ai_docs.refresh (cognitive 18) backend/scripts/refresh_ai_docs.py:406— refresh_ai_docs.refresh 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.
uninstall_cleanup.main (cognitive 18) backend/scripts/uninstall_cleanup.py:65— uninstall_cleanup.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 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.
design_system.format_master_md (cognitive 18) backend/skills/s_frontend-design/scripts/design_system.py:612— design_system.format_master_md has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 2 (3 pts) (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.
cross_format_check.check_naming_conventions (cognitive 18) backend/skills/s_pollinate/scripts/cross_format_check.py:180— cross_format_check.check_naming_conventions 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.
azure.synthesize (cognitive 18) backend/skills/s_pollinate/scripts/tts/backends/azure.py:9— azure.synthesize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 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.
ShapeData.__init__ (cognitive 18) backend/skills/s_pptx/scripts/inventory.py:388— ShapeData.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9, if/else 3 (6 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.
ShapeData._get_default_font_size (cognitive 18) backend/skills/s_pptx/scripts/inventory.py:480— ShapeData._get_default_font_size has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (2 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.
EvalDashboard.CaseDetailDrawer (cognitive 18) desktop/src/pages/EvalDashboard.tsx:2191— EvalDashboard.CaseDetailDrawer has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 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.
TerminalPanel.TerminalPanel (cognitive 18) desktop/src/components/terminal/TerminalPanel.tsx:23— TerminalPanel.TerminalPanel has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 5, boolean chains 4 (nesting depth added 1). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 57, 70, 123, …). 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.
CanvasOutputRail.OutputRow (cognitive 18) desktop/src/components/file-viewer/CanvasOutputRail.tsx:109— CanvasOutputRail.OutputRow has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 6, if/else 1 (nesting depth added 2). Of this number, 16 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.
fileClassification.determineDeliveryStrategy (cognitive 18) desktop/src/utils/fileClassification.ts:177— fileClassification.determineDeliveryStrategy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 1 (2 pts), boolean chains 1, 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.
parser._is_entry_point (cognitive 17) backend/core/code_intel/parser.py:746— parser._is_entry_point has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4 (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.
CompactionGuard.work_summary (cognitive 17) backend/core/compaction_guard.py:748— CompactionGuard.work_summary has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (6 pts), if/else 2 (4 pts), error handling 2 (3 pts), ternaries 1 (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.
ddd_cultivation._locate_target_entry (cognitive 17) backend/core/ddd_cultivation.py:1546— ddd_cultivation._locate_target_entry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, loops 3 (4 pts), error handling 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.
ddd_cultivation.derive_gate2_outcome (cognitive 17) backend/core/ddd_cultivation.py:1917— ddd_cultivation.derive_gate2_outcome has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, 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.
ddd_packager.gate_provenance_leaks (cognitive 17) backend/core/ddd_packager.py:494— ddd_packager.gate_provenance_leaks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2, error handling 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.
EvalService._load_golden_set (cognitive 17) backend/core/eval_service.py:91— EvalService._load_golden_set has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, 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.
EvolutionOptimizer.optimize_skill (cognitive 17) backend/core/evolution_optimizer.py:785— EvolutionOptimizer.optimize_skill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, loops 1 (2 pts), ternaries 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.
EvolutionOptimizer._log_to_evolution (cognitive 17) backend/core/evolution_optimizer.py:935— EvolutionOptimizer._log_to_evolution has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3, loops 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.
hook_builder.build_hooks (cognitive 17) backend/core/hook_builder.py:229— hook_builder.build_hooks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 2 (4 pts), boolean chains 3, ternaries 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.
LifecycleManager._maintenance_loop (cognitive 17) backend/core/lifecycle_manager.py:264— LifecycleManager._maintenance_loop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 3 (6 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.
LifecycleManager._reap_by_pattern (cognitive 17) backend/core/lifecycle_manager.py:1817— LifecycleManager._reap_by_pattern has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (4 pts), boolean chains 1, 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.
observation_hooks._maybe_emit_ddd_event_sync (cognitive 17) backend/core/observation_hooks.py:125— observation_hooks._maybe_emit_ddd_event_sync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 2 (6 pts), boolean chains 2, 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.
PluginManager._detect_standalone_skill (cognitive 17) backend/core/plugin_manager.py:406— PluginManager._detect_standalone_skill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (4 pts), loops 2 (4 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.
runtime_hooks.read_correction_stats (cognitive 17) backend/core/runtime_hooks.py:1414— runtime_hooks.read_correction_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (3 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.
security_hooks._match_governance_tier (cognitive 17) backend/core/security_hooks.py:2332— security_hooks._match_governance_tier has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, 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.
ServiceManager._health_monitor (cognitive 17) backend/core/service_manager.py:343— ServiceManager._health_monitor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
SessionRouter._acquire_channel_slot (cognitive 17) backend/core/session_router.py:2236— SessionRouter._acquire_channel_slot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (2 pts), boolean chains 1, 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.
session_utils.classify_failure (cognitive 17) backend/core/session_utils.py:57— session_utils.classify_failure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, 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.
skill_health.build_health_map (cognitive 17) backend/core/skill_health.py:96— skill_health.build_health_map has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 3, if/else 1 (2 pts), loops 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.
code_change_feed._reindex_changed_files (cognitive 17) backend/hooks/code_change_feed.py:378— code_change_feed._reindex_changed_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 2 (3 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.
ContextHealthHook._update_maturity (cognitive 17) backend/hooks/context_health_hook.py:1343— ContextHealthHook._update_maturity has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 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.
ContextHealthHook._extract_title (cognitive 17) backend/hooks/context_health_hook.py:3613— ContextHealthHook._extract_title has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, error handling 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.
DailyActivityExtractionHook._execute_locked (cognitive 17) backend/hooks/daily_activity_hook.py:188— DailyActivityExtractionHook._execute_locked has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 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.
DistillationTriggerHook._extract_competence (cognitive 17) backend/hooks/distillation_hook.py:1237— DistillationTriggerHook._extract_competence has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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.
signal_ddd_bridge.bridge_signals_to_ddd (cognitive 17) backend/hooks/signal_ddd_bridge.py:44— signal_ddd_bridge.bridge_signals_to_ddd has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, 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.
swarmai_monthly_report._collect_job_metrics (cognitive 17) backend/jobs/handlers/swarmai_monthly_report.py:374— swarmai_monthly_report._collect_job_metrics has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (2 pts), boolean chains 1, loops 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.
scheduler.validate_config (cognitive 17) backend/jobs/scheduler.py:689— scheduler.validate_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 4 (6 pts), loops 2 (3 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.
main._start_code_intel_watchers (cognitive 17) backend/main.py:770— main._start_code_intel_watchers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, error handling 1, 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.
pollinate.pollinate_assets (cognitive 17) backend/routers/pollinate.py:558— pollinate.pollinate_assets has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), error handling 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.
workspace_config.update_mcp_configs (cognitive 17) backend/routers/workspace_config.py:167— workspace_config.update_mcp_configs has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (5 pts), boolean chains 1, error handling 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.
eval_runner.eval_recall_at_k (cognitive 17) backend/scripts/eval_runner.py:376— eval_runner.eval_recall_at_k has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, 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.
seed_corrections.write_corrections (cognitive 17) backend/scripts/seed_corrections.py:128— seed_corrections.write_corrections has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 1 (4 pts), loops 2 (3 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.
DesignSystemGenerator._select_best_match (cognitive 17) backend/skills/s_frontend-design/scripts/design_system.py:122— DesignSystemGenerator._select_best_match has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (6 pts), boolean chains 2, 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.
generate_tts._hard_split (cognitive 17) backend/skills/s_pollinate/scripts/generate_tts.py:39— generate_tts._hard_split has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), 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.
generate_tts.chunk_text (cognitive 17) backend/skills/s_pollinate/scripts/generate_tts.py:75— generate_tts.chunk_text has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 pts), 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.
inventory.extract_text_inventory (cognitive 17) backend/skills/s_pptx/scripts/inventory.py:914— inventory.extract_text_inventory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 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.
thumbnail.create_grid (cognitive 17) backend/skills/s_pptx/scripts/thumbnail.py:321— thumbnail.create_grid has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 1, error handling 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.
mcp_validation.validate_env_no_system_db (cognitive 17) backend/utils/mcp_validation.py:27— mcp_validation.validate_env_no_system_db has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (5 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.
MarkdownRenderer.MermaidModal (cognitive 17) REDACTED:79— MarkdownRenderer.MermaidModal 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). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 98, 142, 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.
ErrorBoundary.ApiError (cognitive 17) desktop/src/components/common/ErrorBoundary.tsx:154— ErrorBoundary.ApiError has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 7. Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 155, 165). 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.
JobsRunsOverlay.JobsRunsContent (cognitive 17) desktop/src/components/layout/JobsRunsOverlay.tsx:59— JobsRunsOverlay.JobsRunsContent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, ternaries 5, boolean chains 2, error handling 1. Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 74, 93, 114, …). 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.
SettingsTabs.SettingsTabs (cognitive 17) desktop/src/components/settings/SettingsTabs.tsx:58— SettingsTabs.SettingsTabs has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 2 (3 pts), ternaries 3 (nesting depth added 1). Most of this is not in the body itself: 0 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 103, 72, 63, …). 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.
CommentPopover.CommentPopover (cognitive 17) desktop/src/components/common/CommentPopover.tsx:34— CommentPopover.CommentPopover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, ternaries 2 (nesting depth added 1). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 96, 52, 77, …). 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.
useChangeStatus.useChangeStatus (cognitive 17) desktop/src/hooks/useChangeStatus.ts:91— useChangeStatus.useChangeStatus has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 4). Most of this is not in the body itself: 0 of the 17 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 115, 150, 140, …). 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.
EvolutionMessage.EvolutionMessage (cognitive 17) desktop/src/components/chat/EvolutionMessage.tsx:82— EvolutionMessage.EvolutionMessage has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, ternaries 6 (8 pts), if/else 1 (nesting depth added 2). 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: 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.
TSCCModules.RecallTab (cognitive 17) desktop/src/pages/chat/components/TSCCModules.tsx:369— TSCCModules.RecallTab has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 2). Of this number, 12 points are the body's own statements and 5 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.
TSCCPopoverButton.TSCCPopoverButton (cognitive 17) desktop/src/pages/chat/components/TSCCPopoverButton.tsx:62— TSCCPopoverButton.TSCCPopoverButton has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 4, ternaries 3 (4 pts) (nesting depth added 1). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 105, 80, 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.
ChannelGateway.resolve_approval (cognitive 16) backend/channels/gateway.py:574— ChannelGateway.resolve_approval has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 3, error handling 1 (2 pts), ternaries 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.
canvas_noise.is_noise_path (cognitive 16) backend/core/canvas_noise.py:223— canvas_noise.is_noise_path has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3, boolean chains 2, error handling 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.
code_intel.invalidate_cache (cognitive 16) backend/core/code_intel/__init__.py:88— code_intel.invalidate_cache has cognitive complexity 16 (threshold 15). Drivers by points: error handling 2 (6 pts), if/else 4 (6 pts), loops 2 (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.
parser._sql_call_edges (cognitive 16) backend/core/code_intel/parser.py:1680— parser._sql_call_edges has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (3 pts), boolean chains 2, 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.
community_data.parse_sources (cognitive 16) backend/core/community_data.py:209— community_data.parse_sources has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 3 (5 pts), ternaries 2 (4 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.
context_directory_loader._filter_dormant_entries (cognitive 16) backend/core/context_directory_loader.py:165— context_directory_loader._filter_dormant_entries 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). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
context_injector._format_message (cognitive 16) backend/core/context_injector.py:116— context_injector._format_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 1, error handling 1, loops 1, ternaries 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.
daily_activity_writer._sanitize_summary_injection (cognitive 16) backend/core/daily_activity_writer.py:399— daily_activity_writer._sanitize_summary_injection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 1, error handling 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.
ddd_maturity.inject_maturity (cognitive 16) backend/core/ddd_maturity.py:216— ddd_maturity.inject_maturity 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.
EvalService.reclaim_stale_skeletons (cognitive 16) backend/core/eval_service.py:751— EvalService.reclaim_stale_skeletons has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (2 pts), boolean chains 1, 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.
CorrectionClassTracker.briefing_lines (cognitive 16) backend/core/evolution/correction_tracker.py:517— CorrectionClassTracker.briefing_lines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 1 (3 pts), 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.
escalation_ladder.decide_escalation (cognitive 16) backend/core/evolution/escalation_ladder.py:75— escalation_ladder.decide_escalation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, error handling 2, ternaries 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.
LifecycleManager._check_ttl (cognitive 16) backend/core/lifecycle_manager.py:933— LifecycleManager._check_ttl has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (15 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.
ManifestLoader.load (cognitive 16) backend/core/manifest_loader.py:116— ManifestLoader.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (3 pts), boolean chains 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.
proactive_intelligence._detect_patterns (cognitive 16) backend/core/proactive_intelligence.py:405— proactive_intelligence._detect_patterns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2, 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.
proactive_scoring.generate_reasoning (cognitive 16) backend/core/proactive_scoring.py:240— proactive_scoring.generate_reasoning has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (4 pts), boolean chains 1, 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.
RetryManager._inject_abandon_continuation (cognitive 16) backend/core/retry_manager.py:637— RetryManager._inject_abandon_continuation has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (6 pts), if/else 6, boolean chains 4 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServiceManager.start_all (cognitive 16) backend/core/service_manager.py:123— ServiceManager.start_all has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 1 (2 pts), loops 2, boolean chains 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.
StreamingOrchestrator._stream_response (cognitive 16) backend/core/streaming_orchestrator.py:241— StreamingOrchestrator._stream_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), 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.
SummarizationPipeline._derive_title (cognitive 16) backend/core/summarization.py:543— SummarizationPipeline._derive_title 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.
swarm_workspace_manager._assert_ai_instruction_sentinels (cognitive 16) backend/core/swarm_workspace_manager.py:112— swarm_workspace_manager._assert_ai_instruction_sentinels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 2 (5 pts), boolean chains 3, 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.
transcript_indexer.sync_transcript_index (cognitive 16) REDACTED:680— transcript_indexer.sync_transcript_index has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), error handling 3 (6 pts), 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.
CodeChangeFeed._detect_arch_changes (cognitive 16) backend/hooks/code_change_feed.py:182— CodeChangeFeed._detect_arch_changes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 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.
DistillationTriggerHook._passes_frequency_gate (cognitive 16) backend/hooks/distillation_hook.py:1387— DistillationTriggerHook._passes_frequency_gate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 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.
hacker_news.fetch_hacker_news (cognitive 16) backend/jobs/adapters/hacker_news.py:22— hacker_news.fetch_hacker_news has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (6 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2, error handling 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.
executor._handle_script (cognitive 16) REDACTED:986— executor._handle_script has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 3 (4 pts), boolean chains 3, error handling 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.
executor._purge_terminal_todos (cognitive 16) REDACTED:1920— executor._purge_terminal_todos has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (3 pts), ternaries 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.
signal_digest._llm_digest (cognitive 16) backend/jobs/handlers/signal_digest.py:253— signal_digest._llm_digest has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (6 pts), if/else 4 (5 pts), boolean chains 3, error handling 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.
signal_digest._write_l4_json (cognitive 16) backend/jobs/handlers/signal_digest.py:494— signal_digest._write_l4_json has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 1 (2 pts), loops 2, boolean chains 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.
skill_proposer._find_existing_skill (cognitive 16) backend/jobs/handlers/skill_proposer.py:172— skill_proposer._find_existing_skill has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 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.
ddd_brain._gallery_entry_stats (cognitive 16) backend/routers/ddd_brain.py:563— ddd_brain._gallery_entry_stats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), error handling 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.
pollinate._build_card (cognitive 16) backend/routers/pollinate.py:490— pollinate._build_card has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 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.
artifact_cli._release_marker_authorizes_head (cognitive 16) backend/scripts/artifact_cli.py:3194— artifact_cli._release_marker_authorizes_head has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 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.
backfill_cjk_escapes.audit_unlisted_columns (cognitive 16) backend/scripts/backfill_cjk_escapes.py:256— backfill_cjk_escapes.audit_unlisted_columns has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 2 (5 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.
eval_runner._resolve_reference (cognitive 16) backend/scripts/eval_runner.py:910— eval_runner._resolve_reference has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, error handling 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.
eval_runner.run_eval (cognitive 16) backend/scripts/eval_runner.py:1771— eval_runner.run_eval has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 1 (2 pts), 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.
pipeline_analytics.analyze_adversarial_value (cognitive 16) backend/scripts/pipeline_analytics.py:576— pipeline_analytics.analyze_adversarial_value has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 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.
seed_corrections.parse_corrections (cognitive 16) backend/scripts/seed_corrections.py:28— seed_corrections.parse_corrections has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (6 pts), 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.
SelfLoopsHealthEngine._check_brain_safety (cognitive 16) backend/skills/s_loops-health/scripts/loops_health_check.py:551— SelfLoopsHealthEngine._check_brain_safety has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7, error handling 2 (3 pts), boolean chains 2, if/else 2, loops 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.
geo_score.main (cognitive 16) backend/skills/s_pollinate/scripts/geo_score.py:345— geo_score.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (5 pts), ternaries 2 (3 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.
check_commit_trailers.main (cognitive 16) scripts/check_commit_trailers.py:137— check_commit_trailers.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 3 (5 pts), loops 1, ternaries 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, 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.
smoke_import.main (cognitive 16) scripts/smoke_import.py:23— smoke_import.main has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (6 pts), if/else 3 (5 pts), loops 2 (3 pts), boolean chains 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.
SectionLayouts.StepCard (cognitive 16) backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:579— SectionLayouts.StepCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 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.
ChapterProgressBar.ChapterProgressBar (cognitive 16) backend/skills/s_pollinate/templates/remotion/components/ChapterProgressBar.tsx:7— ChapterProgressBar.ChapterProgressBar has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 4, if/else 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 40). 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.
html2pptx.html2pptx (cognitive 16) backend/skills/s_pptx/scripts/html2pptx.js:896— html2pptx.html2pptx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 2 (3 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.
MarkdownRenderer.MermaidDiagram (cognitive 16) REDACTED:238— MarkdownRenderer.MermaidDiagram has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 4 (5 pts), error handling 2, boolean chains 1 (nesting depth added 1). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 316, 284, 247, …). 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.
MarkdownRenderer.isWorkspaceFilePath (cognitive 16) REDACTED:617— MarkdownRenderer.isWorkspaceFilePath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 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.
api.parseApiError (cognitive 16) desktop/src/services/api.ts:49— api.parseApiError has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, ternaries 3 (6 pts), if/else 2, match/switch 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.
JobsRunsOverlay.JobDetailDrawer (cognitive 16) desktop/src/components/layout/JobsRunsOverlay.tsx:316— JobsRunsOverlay.JobDetailDrawer has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, ternaries 5 (6 pts), if/else 3 (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to 4 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.
PipelineOverlay.PipelineContent (cognitive 16) desktop/src/components/layout/PipelineOverlay.tsx:89— PipelineOverlay.PipelineContent has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5, ternaries 3, error handling 1. Of this number, 8 points are the body's own statements and 8 belong to 8 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.
DddCard.FullBody (cognitive 16) desktop/src/components/layout/DddCard.tsx:291— DddCard.FullBody has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5, 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.
dddOverview.docSignalMap (cognitive 16) desktop/src/components/layout/dddOverview.ts:72— dddOverview.docSignalMap has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (7 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.
dddOverview.weeklyReportModel (cognitive 16) desktop/src/components/layout/dddOverview.ts:144— dddOverview.weeklyReportModel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 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.
BrainHub.hunkSummary (cognitive 16) desktop/src/components/layout/BrainHub.tsx:50— BrainHub.hunkSummary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 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.
useReferencedFiles.applyWrite (cognitive 16) desktop/src/hooks/useReferencedFiles.ts:188— useReferencedFiles.applyWrite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 1 (3 pts), boolean chains 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.
TSCCModules.PromptTab (cognitive 16) desktop/src/pages/chat/components/TSCCModules.tsx:555— TSCCModules.PromptTab has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9 (12 pts), boolean chains 2, error handling 1, if/else 1 (nesting depth added 3). 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: 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.
D4 · Code Duplication· Near-duplicate member family (6 members, 65 shared lines) · ×1
Near-duplicate member family (6 members, 65 shared lines) backend/scripts/locked_write.py:417— backend/scripts/locked_write.py:417-512 | backend/scripts/locked_write.py:519-675 | backend/skills/s_persist/scripts/locked_write.py:417-512 | backend/skills/s_persist/scripts/locked_write.py:519-675 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:417-512 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:519-647 — These 6 members are variants of one another: a block of 65 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 43 shared lines) · ×1
Near-duplicate member family (3 members, 43 shared lines) backend/scripts/locked_write.py:341— backend/scripts/locked_write.py:341-406 | backend/skills/s_persist/scripts/locked_write.py:341-406 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:341-406 — These 3 members are variants of one another: a block of 43 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 35 shared lines) · ×1
Near-duplicate member family (3 members, 35 shared lines) backend/scripts/locked_write.py:280— backend/scripts/locked_write.py:280-335 | backend/skills/s_persist/scripts/locked_write.py:280-335 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:280-335 — These 3 members are variants of one another: a block of 35 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
Near-duplicate member pair (109 shared lines) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2747— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2747-2857 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2400-2510 — These two members are variants of one another: 109 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (54 shared lines) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1569— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1569-1628 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1226-1292 — These two members are variants of one another: 54 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (28 shared lines) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:214— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:214-247 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:213-246 — These two members are variants of one another: 28 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×1
Edited copy of a member (28 corresponding lines) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1484— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1484-1511 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1195-1222 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×1
Edited copy of a member (27 corresponding lines) backend/core/ddd_job_registry.py:234— backend/core/ddd_job_registry.py:234-260 | backend/core/ddd_skill_registry.py:299-327 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (12 members, 50+ identical tokens) backend/skills/s_docx/ooxml/scripts/validation/base.py:187— backend/skills/s_docx/ooxml/scripts/validation/base.py:187-275 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:73-122 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:125-171 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:217-261 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:78-119 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:129-201 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:187-278 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:73-122 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:125-171 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:217-261 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:78-119 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:129-201 — These 12 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 12 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 12 times.
D4 · Code Duplication· Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (11 members, 50+ identical tokens) backend/database/sqlite.py:975— backend/database/sqlite.py:975-983 | backend/database/sqlite.py:1091-1099 | backend/database/sqlite.py:1192-1200 | backend/database/sqlite.py:1309-1317 | backend/database/sqlite.py:1361-1369 | backend/database/sqlite.py:1397-1405 | backend/database/sqlite.py:1486-1494 | backend/database/sqlite.py:1497-1508 | backend/database/sqlite.py:1606-1614 | backend/database/sqlite.py:1617-1625 | backend/database/sqlite.py:1718-1726 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) backend/core/conversation_extract.py:120— backend/core/conversation_extract.py:120-155 | backend/core/memory_extractor.py:255-297 | backend/core/session_harvest.py:105-132 | backend/core/summarization.py:824-889 | backend/jobs/handlers/ddd_refresh.py:235-262 | backend/jobs/handlers/memory_health.py:458-487 | backend/jobs/handlers/skill_proposer.py:275-319 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) backend/skills/s_frontend-design/scripts/design_system.py:423— backend/skills/s_frontend-design/scripts/design_system.py:423-528 | backend/skills/s_frontend-design/scripts/design_system.py:613-883 | backend/skills/s_frontend-design/scripts/design_system.py:887-992 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2271-2370 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1923-2023 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (161 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2389— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2389-2549 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2042-2202 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (121–122 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2953— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2953-3073 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2606-2727 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (117 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:523— backend/skills/s_docx/ooxml/scripts/validation/base.py:523-639 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:526-642 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (109 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:278— backend/skills/s_docx/ooxml/scripts/validation/base.py:278-386 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:281-389 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (96 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:389— backend/skills/s_docx/ooxml/scripts/validation/base.py:389-484 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:392-487 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (94 lines × 3) backend/scripts/locked_write.py:679— backend/scripts/locked_write.py:679-772 | backend/skills/s_persist/scripts/locked_write.py:679-772 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:651-744 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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 (92 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:114— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:114-205 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:114-205 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 after the matched lines, `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:206` calls `extend`, `check_business_rule_anchor_files` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:206` 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 (90 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:23— backend/skills/s_docx/ooxml/scripts/validation/redlining.py:23-112 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:23-112 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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 (76 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/redlining.py:140— backend/skills/s_docx/ooxml/scripts/validation/redlining.py:140-215 | backend/skills/s_pptx/ooxml/scripts/validation/redlining.py:140-215 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/redlining.py` and `backend/skills/s_pptx/ooxml/scripts/validation/redlining.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 245 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 (74 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3174— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3174-3247 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2827-2900 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (70 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2301— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2301-2370 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1954-2023 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (69 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:774— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:774-842 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:688-756 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (64 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:206— backend/skills/s_docx/ooxml/scripts/validation/base.py:206-269 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:209-272 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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, `backend/skills/s_pptx/ooxml/scripts/validation/base.py:207` calls `isinstance` and `backend/skills/s_docx/ooxml/scripts/validation/base.py:204` does not — after which the two agree again for 3 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 (61 lines × 2) backend/core/daemon_guard.py:414— backend/core/daemon_guard.py:414-474 | desktop/resources/daemon/daemon_guard.py:414-474 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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 (59 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1180— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1180-1238 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:917-975 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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–58 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:326— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:326-382 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:325-382 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:326` 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 (57 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3083— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3083-3139 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2736-2792 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (52–57 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3253— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3253-3309 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2906-2957 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 after the matched lines, `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3310` calls `set` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2958` 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 (43–57 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3426— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3426-3482 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:3076-3118 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (56 lines × 3) backend/scripts/locked_write.py:171— backend/scripts/locked_write.py:171-226 | backend/skills/s_persist/scripts/locked_write.py:171-226 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:171-226 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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 (53–55 lines × 6) backend/scripts/locked_write.py:433— backend/scripts/locked_write.py:433-485 | backend/scripts/locked_write.py:547-599 | backend/skills/s_persist/scripts/locked_write.py:433-485 | backend/skills/s_persist/scripts/locked_write.py:547-599 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:433-485 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:540-594 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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 (55 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1653— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1653-1707 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1317-1371 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (51–54 lines × 2) backend/core/streaming_orchestrator.py:1456— backend/core/streaming_orchestrator.py:1456-1506 | backend/core/streaming_orchestrator.py:1629-1682 — 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 `backend/core/streaming_orchestrator.py:1456` 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 (44–51 lines × 2) backend/core/knowledge_store.py:574— backend/core/knowledge_store.py:574-624 | REDACTED:631-674 — 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 `backend/core/knowledge_store.py:574` 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 (51 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:689— backend/skills/s_docx/ooxml/scripts/validation/base.py:689-739 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:692-742 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (49 lines × 2) backend/skills/s_docx/ooxml/scripts/validate.py:17— backend/skills/s_docx/ooxml/scripts/validate.py:17-65 | backend/skills/s_pptx/ooxml/scripts/validate.py:17-65 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validate.py` and `backend/skills/s_pptx/ooxml/scripts/validate.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 (48 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:649— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:649-696 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:563-610 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (45 lines × 3) backend/scripts/locked_write.py:83— backend/scripts/locked_write.py:83-127 | backend/skills/s_persist/scripts/locked_write.py:83-127 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:83-127 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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 (45 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:642— backend/skills/s_docx/ooxml/scripts/validation/base.py:642-686 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:645-689 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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–44 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1043— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1043-1085 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:779-822 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (35–43 lines × 6) backend/scripts/locked_write.py:280— backend/scripts/locked_write.py:280-314 | backend/scripts/locked_write.py:341-383 | backend/skills/s_persist/scripts/locked_write.py:280-314 | backend/skills/s_persist/scripts/locked_write.py:341-383 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:280-314 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:341-383 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/scripts/locked_write.py:386` calls `match` and `backend/scripts/locked_write.py:315` does not — after which the two agree again for 3 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 (35–43 lines × 3) backend/core/streaming_orchestrator.py:1470— backend/core/streaming_orchestrator.py:1470-1504 | backend/core/streaming_orchestrator.py:1644-1678 | backend/core/streaming_orchestrator.py:1802-1844 — 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 `backend/core/streaming_orchestrator.py:1470` 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 (43 lines × 3) backend/scripts/locked_write.py:232— backend/scripts/locked_write.py:232-274 | backend/skills/s_persist/scripts/locked_write.py:232-274 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:232-274 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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 (42 lines × 2) backend/skills/s_docx/ooxml/scripts/pack.py:46— backend/skills/s_docx/ooxml/scripts/pack.py:46-87 | backend/skills/s_pptx/ooxml/scripts/pack.py:46-87 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/pack.py` and `backend/skills/s_pptx/ooxml/scripts/pack.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 127 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 (33–39 lines × 2) backend/core/skill_manager.py:920— backend/core/skill_manager.py:920-958 | backend/core/skill_manager.py:1017-1049 — 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 (32–39 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1569— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1569-1600 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1226-1264 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (23–38 lines × 2) backend/core/library_mounts.py:523— backend/core/library_mounts.py:523-545 | backend/core/library_mounts.py:580-617 — 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 (37 lines × 3) backend/scripts/locked_write.py:131— backend/scripts/locked_write.py:131-167 | backend/skills/s_persist/scripts/locked_write.py:131-167 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:131-167 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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–37 lines × 2) backend/core/proactive_intelligence.py:1438— backend/core/proactive_intelligence.py:1438-1474 | backend/core/proactive_intelligence.py:1917-1942 — 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 (36 lines × 2) backend/core/daemon_guard.py:372— backend/core/daemon_guard.py:372-407 | desktop/resources/daemon/daemon_guard.py:372-407 — before extracting anything, compare `backend/core/daemon_guard.py` and `desktop/resources/daemon/daemon_guard.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 280 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 (19–35 lines × 2) backend/core/ddd_cultivation.py:513— backend/core/ddd_cultivation.py:513-547 | backend/core/ingestion_gate.py:89-107 — 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 (30–35 lines × 2) backend/hooks/distillation_hook.py:1614— backend/hooks/distillation_hook.py:1614-1643 | backend/hooks/distillation_hook.py:1693-1727 — 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 (27–35 lines × 2) backend/skills/s_estimate-tokens/scripts/estimate_tokens.py:44— backend/skills/s_estimate-tokens/scripts/estimate_tokens.py:44-78 | backend/skills/s_library/scripts/library.py:26-52 — 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 (13–33 lines × 2) backend/core/security_hooks.py:611— backend/core/security_hooks.py:611-643 | backend/core/security_hooks.py:1626-1638 — 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 (33 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/docx.py:217— backend/skills/s_docx/ooxml/scripts/validation/docx.py:217-249 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:217-249 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py: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. 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 (30–31 lines × 2) backend/core/retry_manager.py:91— backend/core/retry_manager.py:91-121 | backend/core/retry_manager.py:207-236 — 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 `backend/core/retry_manager.py:91` 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. Note first that the copies are not typed on the same thing: `SessionState` names `.session_unit` in one and `core.session_unit` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (26–31 lines × 2) backend/routers/workspace.py:465— backend/routers/workspace.py:465-495 | backend/routers/workspace.py:570-595 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (29–30 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2271— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2271-2299 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1923-1952 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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–29 lines × 2) REDACTED:1107— REDACTED:1107-1132 | REDACTED:1229-1257 — 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 (25–29 lines × 2) backend/scripts/eval_runner.py:566— backend/scripts/eval_runner.py:566-594 | backend/scripts/eval_runner.py:700-724 — 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 (27–29 lines × 2) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1288— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1288-1314 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1025-1053 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (14–27 lines × 2) backend/channels/gateway.py:1920— backend/channels/gateway.py:1920-1946 | backend/channels/gateway.py:2044-2057 — 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 `backend/channels/gateway.py:1920` 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 (22–27 lines × 2) backend/database/sqlite.py:2997— backend/database/sqlite.py:2997-3023 | backend/database/sqlite.py:3046-3067 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/database/sqlite.py:3068` calls `fetchone`, `execute` and `backend/database/sqlite.py:3024` 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 (20–27 lines × 2) backend/jobs/handlers/memory_health.py:888— backend/jobs/handlers/memory_health.py:888-914 | backend/jobs/handlers/memory_health.py:1006-1025 — 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 (27 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:128— backend/skills/s_docx/ooxml/scripts/validation/base.py:128-154 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:128-154 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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–26 lines × 3) backend/core/evolution/correction_tracker.py:287— backend/core/evolution/correction_tracker.py:287-312 | backend/core/evolution/correction_tracker.py:350-370 | backend/core/evolution/correction_tracker.py:404-417 — 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 (23–26 lines × 2) backend/core/session_pending.py:431— backend/core/session_pending.py:431-456 | backend/core/session_pending.py:460-482 — 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 (24–25 lines × 2) backend/core/ddd_job_registry.py:234— backend/core/ddd_job_registry.py:234-257 | backend/core/ddd_skill_registry.py:299-323 — 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 `backend/core/ddd_job_registry.py:234` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/core/ddd_skill_registry.py:324` calls `isinstance`, `get` and `backend/core/ddd_job_registry.py:258` does not — after which the two agree again for 3 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 (11–24 lines × 2) backend/core/ddd_cultivation.py:2437— backend/core/ddd_cultivation.py:2437-2460 | backend/core/ddd_cultivation.py:2547-2557 — 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 (17–24 lines × 2) backend/core/security_hooks.py:247— backend/core/security_hooks.py:247-270 | backend/core/security_hooks.py:1634-1650 — 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 (20–24 lines × 2) backend/hooks/daily_activity_hook.py:56— backend/hooks/daily_activity_hook.py:56-75 | backend/hooks/todo_lifecycle_hook.py:53-76 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `max_commits` to `int = 15` in one and `int = 50` 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 (24 lines × 2) backend/skills/s_docx/ooxml/scripts/validation/base.py:766— backend/skills/s_docx/ooxml/scripts/validation/base.py:766-789 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:769-792 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (15–23 lines × 2) backend/database/sqlite.py:2934— backend/database/sqlite.py:2934-2956 | backend/database/sqlite.py:3028-3042 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–22 lines × 2) backend/hooks/distillation_hook.py:1208— backend/hooks/distillation_hook.py:1208-1225 | backend/hooks/distillation_hook.py:1238-1259 — 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 (17–22 lines × 2) backend/jobs/handlers/memory_health.py:660— backend/jobs/handlers/memory_health.py:660-681 | backend/jobs/handlers/memory_health.py:743-759 — 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–22 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:461— backend/skills/s_frontend-design/scripts/design_system.py:461-482 | backend/skills/s_frontend-design/scripts/design_system.py:647-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.
Duplicated block (21 lines × 3) backend/scripts/locked_write.py:59— backend/scripts/locked_write.py:59-79 | backend/skills/s_persist/scripts/locked_write.py:59-79 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:59-79 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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 (13–21 lines × 3) backend/skills/s_notify/notify.py:94— backend/skills/s_notify/notify.py:94-114 | backend/skills/s_notify/notify.py:118-130 | backend/skills/s_notify/notify.py:134-146 — 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. 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–21 lines × 2) backend/core/chat_thread_manager.py:90— backend/core/chat_thread_manager.py:90-101 | backend/core/todo_manager.py:519-539 — 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 (19–21 lines × 2) backend/core/proactive_intelligence.py:511— backend/core/proactive_intelligence.py:511-529 | backend/core/proactive_scoring.py:84-104 — 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 (17–21 lines × 2) backend/core/recall_multi.py:753— backend/core/recall_multi.py:753-773 | backend/core/recall_multi.py:788-804 — 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 (16–20 lines × 3) backend/core/security_hooks.py:260— backend/core/security_hooks.py:260-279 | backend/core/security_hooks.py:648-664 | backend/core/security_hooks.py:1644-1659 — 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 (19–20 lines × 2) backend/core/engine_metrics.py:279— backend/core/engine_metrics.py:279-298 | backend/jobs/handlers/ddd_refresh.py:384-402 — 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 (20 lines × 2) backend/routers/workspace.py:326— backend/routers/workspace.py:326-345 | backend/routers/workspace.py:415-434 — 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–20 lines × 2) backend/scripts/pipeline_analytics.py:809— backend/scripts/pipeline_analytics.py:809-828 | backend/scripts/pipeline_analytics.py:891-899 — 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 (11–19 lines × 2) backend/core/resource_monitor.py:470— backend/core/resource_monitor.py:470-480 | backend/core/resource_monitor.py:587-605 — 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 (16–19 lines × 2) backend/hooks/code_change_feed.py:125— backend/hooks/code_change_feed.py:125-143 | backend/hooks/code_change_feed.py:265-280 — 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 (17–19 lines × 2) backend/scripts/pipeline_validator.py:1719— backend/scripts/pipeline_validator.py:1719-1737 | backend/scripts/pipeline_validator.py:1746-1762 — 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 (12–17 lines × 3) backend/routers/hive.py:528— backend/routers/hive.py:528-539 | backend/routers/hive.py:575-586 | backend/routers/hive.py:669-685 — 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 (15–17 lines × 3) backend/skills/s_frontend-design/scripts/design_system.py:718— backend/skills/s_frontend-design/scripts/design_system.py:718-732 | backend/skills/s_frontend-design/scripts/design_system.py:751-765 | backend/skills/s_frontend-design/scripts/design_system.py:781-797 — 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 (12–17 lines × 2) backend/core/voice_synthesize.py:317— backend/core/voice_synthesize.py:317-333 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:173-184 — 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 (15–17 lines × 2) backend/middleware/error_handler.py:98— backend/middleware/error_handler.py:98-114 | backend/middleware/error_handler.py:140-154 — 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 `backend/middleware/error_handler.py:98` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `exc` to `RequestValidationError` in one and `ValidationError` 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 (12–16 lines × 3) backend/core/security_hooks.py:285— backend/core/security_hooks.py:285-299 | backend/core/security_hooks.py:670-681 | backend/core/security_hooks.py:1593-1608 — 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. 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–16 lines × 2) REDACTED:100— REDACTED:100-115 | REDACTED:133-146 — 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:100` 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–15 lines × 2) backend/hooks/distillation_hook.py:1181— backend/hooks/distillation_hook.py:1181-1195 | backend/hooks/distillation_hook.py:1215-1227 — 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 (12–15 lines × 2) backend/scripts/artifact_cli.py:1308— backend/scripts/artifact_cli.py:1308-1319 | backend/scripts/artifact_cli.py:1358-1372 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/scripts/artifact_cli.py:1307` calls `get` and `backend/scripts/artifact_cli.py:1357` does not — after which the two agree again for 3 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–15 lines × 2) backend/skills/s_loops-health/scripts/loops_health_check.py:412— backend/skills/s_loops-health/scripts/loops_health_check.py:412-420 | backend/skills/s_loops-health/scripts/loops_health_check.py:499-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `backend/skills/s_loops-health/scripts/loops_health_check.py:496` calls `_check_coherence`, `_read_safe` and `backend/skills/s_loops-health/scripts/loops_health_check.py:407` 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 (14 lines × 6) backend/skills/s_docx/ooxml/scripts/validation/docx.py:103— backend/skills/s_docx/ooxml/scripts/validation/docx.py:103-116 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:152-165 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:242-255 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:103-116 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:152-165 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:242-255 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/docx.py` and `backend/skills/s_pptx/ooxml/scripts/validation/docx.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 244 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 `backend/skills/s_docx/ooxml/scripts/validation/docx.py:103` 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 (14 lines × 3) backend/core/evolution/governance_router.py:113— backend/core/evolution/governance_router.py:113-126 | backend/core/evolution/governance_router.py:348-361 | backend/core/evolution/governance_router.py:404-417 — 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 (11–14 lines × 2) backend/database/sqlite.py:507— backend/database/sqlite.py:507-517 | backend/database/sqlite.py:1649-1662 — 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 `backend/database/sqlite.py:507` 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–14 lines × 3) backend/hooks/distillation_hook.py:1545— backend/hooks/distillation_hook.py:1545-1556 | backend/hooks/distillation_hook.py:1558-1571 | backend/hooks/distillation_hook.py:1572-1579 — 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 `backend/hooks/distillation_hook.py:1545` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13 lines × 10) backend/skills/s_docx/ooxml/scripts/validation/base.py:263— backend/skills/s_docx/ooxml/scripts/validation/base.py:263-275 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:110-122 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:159-171 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:249-261 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:107-119 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:266-278 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:110-122 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:159-171 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:249-261 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:107-119 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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–13 lines × 4) backend/database/sqlite.py:2910— backend/database/sqlite.py:2910-2922 | backend/database/sqlite.py:2939-2951 | backend/database/sqlite.py:2996-3006 | backend/database/sqlite.py:3027-3037 — all 4 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/database/sqlite.py:2926` calls `execute`, `fetchall` and `backend/database/sqlite.py:3039` 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 (11–13 lines × 2) backend/core/ddd_job_registry.py:138— backend/core/ddd_job_registry.py:138-148 | backend/core/ddd_skill_registry.py:192-204 — 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–13 lines × 2) backend/routers/ddd_brain.py:237— backend/routers/ddd_brain.py:237-246 | backend/routers/ddd_brain.py:1704-1716 — 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 `backend/routers/ddd_brain.py:237` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–13 lines × 2) backend/scripts/artifact_cli.py:5839— backend/scripts/artifact_cli.py:5839-5851 | backend/scripts/artifact_cli.py:6010-6018 — 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 `backend/scripts/artifact_cli.py:5839` 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–12 lines × 11) backend/database/sqlite.py:975— backend/database/sqlite.py:975-983 | backend/database/sqlite.py:1091-1099 | backend/database/sqlite.py:1192-1200 | backend/database/sqlite.py:1309-1317 | backend/database/sqlite.py:1361-1369 | backend/database/sqlite.py:1397-1405 | backend/database/sqlite.py:1486-1494 | backend/database/sqlite.py:1497-1508 | backend/database/sqlite.py:1606-1614 | backend/database/sqlite.py:1617-1625 | backend/database/sqlite.py:1718-1726 — all 11 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. 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 × 8) backend/database/sqlite.py:2899— backend/database/sqlite.py:2899-2910 | backend/database/sqlite.py:2919-2930 | backend/database/sqlite.py:2956-2967 | backend/database/sqlite.py:2968-2980 | backend/database/sqlite.py:2981-2996 | backend/database/sqlite.py:3076-3088 | backend/database/sqlite.py:3089-3101 | backend/database/sqlite.py:3102-3122 — all 8 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 (12 lines × 7) backend/skills/s_frontend-design/scripts/design_system.py:515— backend/skills/s_frontend-design/scripts/design_system.py:515-526 | backend/skills/s_frontend-design/scripts/design_system.py:686-697 | backend/skills/s_frontend-design/scripts/design_system.py:745-756 | backend/skills/s_frontend-design/scripts/design_system.py:790-801 | backend/skills/s_frontend-design/scripts/design_system.py:902-915 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2336-2347 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:1989-2000 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (12 lines × 6) backend/scripts/locked_write.py:501— backend/scripts/locked_write.py:501-512 | backend/scripts/locked_write.py:664-675 | backend/skills/s_persist/scripts/locked_write.py:501-512 | backend/skills/s_persist/scripts/locked_write.py:664-675 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:501-512 | backend/templates/ddd-skills/s_ddd-persist/scripts/locked_write.py:636-647 — before extracting anything, compare `backend/scripts/locked_write.py` and `backend/skills/s_persist/scripts/locked_write.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 456 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–12 lines × 4) backend/hooks/context_health_hook.py:3513— backend/hooks/context_health_hook.py:3513-3522 | backend/hooks/distillation_hook.py:1941-1950 | backend/hooks/distillation_hook.py:2094-2103 | backend/hooks/evolution_maintenance_hook.py:380-391 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11–12 lines × 2) backend/core/code_intel/graph_store.py:639— backend/core/code_intel/graph_store.py:639-650 | backend/core/code_intel/graph_store.py:1665-1675 — 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 `backend/core/code_intel/graph_store.py:639` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–11 lines × 3) backend/routers/channels.py:320— backend/routers/channels.py:320-328 | backend/routers/channels.py:370-378 | backend/routers/channels.py:388-398 — 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 `backend/routers/channels.py:388` 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 (8–11 lines × 3) backend/skills/s_pollinate/scripts/check_rpv.py:65— backend/skills/s_pollinate/scripts/check_rpv.py:65-72 | backend/skills/s_pollinate/scripts/check_rpv.py:141-148 | backend/skills/s_pollinate/scripts/check_rpv.py:168-178 — 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. 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–11 lines × 2) backend/core/memory_extractor.py:266— backend/core/memory_extractor.py:266-276 | backend/core/summarization.py:826-834 — 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 (8–11 lines × 2) backend/routers/chat.py:498— backend/routers/chat.py:498-508 | backend/routers/todos.py:463-470 — 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 × 10) backend/skills/s_docx/ooxml/scripts/validation/docx.py:107— backend/skills/s_docx/ooxml/scripts/validation/docx.py:107-116 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:156-165 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:246-255 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:104-113 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:183-192 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:107-116 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:156-165 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:246-255 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:104-113 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:183-192 — there are 10 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `backend/skills/s_docx/ooxml/scripts/validation/docx.py:107` 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–10 lines × 4) backend/database/sqlite.py:515— backend/database/sqlite.py:515-522 | backend/database/sqlite.py:1422-1430 | backend/database/sqlite.py:1659-1668 | backend/database/sqlite.py:1707-1715 — all 4 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. 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 (9–10 lines × 4) backend/skills/s_docx/scripts/document.py:320— backend/skills/s_docx/scripts/document.py:320-328 | backend/skills/s_docx/scripts/document.py:401-409 | backend/skills/s_docx/scripts/document.py:504-513 | backend/skills/s_docx/scripts/document.py:561-570 — all 4 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/skills/s_docx/scripts/document.py:573` calls `getElementsByTagName` and `backend/skills/s_docx/scripts/document.py:412` 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 (7–10 lines × 5) backend/skills/s_frontend-design/scripts/design_system.py:911— backend/skills/s_frontend-design/scripts/design_system.py:911-920 | backend/skills/s_frontend-design/scripts/design_system.py:922-931 | backend/skills/s_frontend-design/scripts/design_system.py:933-942 | backend/skills/s_frontend-design/scripts/design_system.py:944-953 | backend/skills/s_frontend-design/scripts/design_system.py:954-960 — all 5 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 3) backend/core/ddd_orchestrator.py:256— backend/core/ddd_orchestrator.py:256-265 | backend/core/engine_metrics.py:289-298 | backend/jobs/handlers/ddd_refresh.py:393-402 — 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.
Duplicated block (7–10 lines × 2) REDACTED:1912— REDACTED:1912-1918 | REDACTED:1997-2006 — 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 (8–10 lines × 2) backend/core/security_hooks.py:827— backend/core/security_hooks.py:827-836 | backend/core/security_hooks.py:2248-2255 — 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 (9 lines × 12) backend/skills/s_docx/ooxml/scripts/validation/base.py:262— backend/skills/s_docx/ooxml/scripts/validation/base.py:262-270 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:109-117 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:158-166 | backend/skills/s_docx/ooxml/scripts/validation/docx.py:248-256 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:106-114 | backend/skills/s_docx/ooxml/scripts/validation/pptx.py:185-193 | backend/skills/s_pptx/ooxml/scripts/validation/base.py:265-273 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:109-117 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:158-166 | backend/skills/s_pptx/ooxml/scripts/validation/docx.py:248-256 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:106-114 | backend/skills/s_pptx/ooxml/scripts/validation/pptx.py:185-193 — before extracting anything, compare `backend/skills/s_docx/ooxml/scripts/validation/base.py` and `backend/skills/s_pptx/ooxml/scripts/validation/base.py` as WHOLE FILES: this scan already matched 20 separate duplicated blocks between them, totalling at least 820 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 (9 lines × 10) backend/database/sqlite.py:2894— backend/database/sqlite.py:2894-2902 | backend/database/sqlite.py:2906-2914 | backend/database/sqlite.py:2963-2971 | backend/database/sqlite.py:2976-2984 | backend/database/sqlite.py:2992-3000 | backend/database/sqlite.py:3023-3031 | backend/database/sqlite.py:3071-3079 | backend/database/sqlite.py:3084-3092 | backend/database/sqlite.py:3097-3105 | backend/database/sqlite.py:3118-3126 — all 10 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `backend/database/sqlite.py:2906` calls `execute`, `fetchall` and `backend/database/sqlite.py:2918` 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–9 lines × 3) backend/skills/s_pollinate/scripts/tts/backends/azure.py:26— backend/skills/s_pollinate/scripts/tts/backends/azure.py:26-33 | backend/skills/s_pollinate/scripts/tts/backends/edge.py:24-31 | backend/skills/s_pollinate/scripts/tts/backends/polly.py:275-283 — 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, `backend/skills/s_pollinate/scripts/tts/backends/azure.py:22` calls `get` and `backend/skills/s_pollinate/scripts/tts/backends/polly.py:272` 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–9 lines × 2) backend/skills/s_frontend-design/scripts/design_system.py:816— backend/skills/s_frontend-design/scripts/design_system.py:816-822 | backend/skills/s_frontend-design/scripts/design_system.py:829-837 — 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 (8 lines × 3) backend/skills/s_frontend-design/scripts/design_system.py:283— backend/skills/s_frontend-design/scripts/design_system.py:283-290 | backend/skills/s_frontend-design/scripts/design_system.py:423-430 | backend/skills/s_frontend-design/scripts/design_system.py:613-620 — 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 (7–8 lines × 2) backend/routers/hive.py:637— backend/routers/hive.py:637-643 | backend/routers/hive.py:657-664 — 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 (6–7 lines × 6) backend/core/conversation_extract.py:121— backend/core/conversation_extract.py:121-126 | backend/core/memory_extractor.py:265-271 | backend/core/summarization.py:825-830 | backend/jobs/handlers/ddd_refresh.py:251-256 | backend/jobs/handlers/memory_health.py:476-481 | backend/jobs/handlers/skill_proposer.py:294-299 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 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 6 times.
Duplicated block (7 lines × 4) backend/skills/s_frontend-design/scripts/design_system.py:726— backend/skills/s_frontend-design/scripts/design_system.py:726-732 | backend/skills/s_frontend-design/scripts/design_system.py:744-750 | backend/skills/s_frontend-design/scripts/design_system.py:759-765 | backend/skills/s_frontend-design/scripts/design_system.py:789-797 — all 4 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 (6 lines × 6) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2820— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2820-2825 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2827-2832 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2834-2839 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2473-2478 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2480-2485 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2487-2492 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:2820` 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 (6 lines × 5) backend/core/conversation_extract.py:122— backend/core/conversation_extract.py:122-127 | backend/core/session_harvest.py:108-113 | backend/jobs/handlers/ddd_refresh.py:252-258 | backend/jobs/handlers/memory_health.py:477-483 | backend/jobs/handlers/skill_proposer.py:295-301 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times.
Duplicated block (5 lines × 6) backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:227— backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:227-231 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:234-238 | backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:241-245 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:226-230 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:233-237 | backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py:240-244 — before extracting anything, compare `backend/skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` and `backend/templates/ddd-skills/s_repo-to-ddd/scripts/ai_ready_helpers.py` as WHOLE FILES: this scan already matched 79 separate duplicated blocks between them, totalling at least 2758 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 (4–5 lines × 3) backend/skills/s_frontend-design/scripts/design_system.py:439— backend/skills/s_frontend-design/scripts/design_system.py:439-443 | backend/skills/s_frontend-design/scripts/design_system.py:455-458 | backend/skills/s_frontend-design/scripts/design_system.py:491-495 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) backend/routers/tasks.py:162— backend/routers/tasks.py:162-166 | backend/routers/tasks.py:171-175 | backend/routers/todos.py:161-168 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. 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.
Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — desktop/ runs vitest but declares no coverage provider, so the suite can run and still produce no lcov — add `@vitest/coverage-v8` (or `@vitest/coverage-istanbul`) as a devDependency. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan. Alternatively, commit the lcov/Cobertura report your CI produces and it is read without a re-run.
Duplication concentrated across 6 sibling directories (34 clone groups) desktop/src/components/settings/BackupTab.tsx:22— 34 duplicated blocks under desktop/src/ have copies in at least two of the sibling directories components, contexts, hooks, pages, stores, utils — 9 of them are reported below, and 25 are 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 34 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 34 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 34 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 8 sibling directories (25 clone groups) desktop/src/components/common/Modal.tsx:58— 25 duplicated blocks under desktop/src/components/ have copies in at least two of the sibling directories common, file-viewer, layout, modals, settings, workspace (+2 more sibling(s) not listed) — 9 of them are reported below, and 16 are 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 25 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 25 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 25 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 (126 matched lines × 2 locations) · ×1
Duplicated block with local edits (126 matched lines × 2 locations) desktop/src/components/common/Dropdown.tsx:31— desktop/src/components/common/Dropdown.tsx:31 · desktop/src/components/common/MultiSelect.tsx:36 — the two spans are one implementation copied and then locally edited — 645 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.
R10 · Code Duplication· Duplicated block with local edits (61 matched lines × 2 locations) · ×1
Duplicated block with local edits (61 matched lines × 2 locations) desktop/src/components/settings/BackupTab.tsx:22— desktop/src/components/settings/BackupTab.tsx:22 · desktop/src/pages/OnboardingPage.tsx:355 — the two spans are one implementation copied and then locally edited — 413 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 (59 lines × 2 locations) desktop/src/components/workspace/FileBrowser.tsx:159— desktop/src/components/workspace/FileBrowser.tsx:159 · desktop/src/components/workspace/FolderPickerModal.tsx:164 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (57 matched lines × 2 locations) · ×1
Duplicated block with local edits (57 matched lines × 2 locations) desktop/src/components/layout/HiveFleetOverlay.tsx:90— desktop/src/components/layout/HiveFleetOverlay.tsx:90 · desktop/src/components/layout/JobsRunsOverlay.tsx:142 — the two spans are one implementation copied and then locally edited — 396 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.
R10 · Code Duplication· Duplicated block with local edits (53 matched lines × 2 locations) · ×1
Duplicated block with local edits (53 matched lines × 2 locations) desktop/src/components/layout/PipelineOverlay.tsx:91— desktop/src/components/layout/PipelineOverlay.tsx:91 · desktop/src/components/layout/PollinateOverlay.tsx:109 — the two spans are one implementation copied and then locally edited — 407 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.
R10 · Code Duplication· Duplicated block with local edits (44 matched lines × 2 locations) · ×1
Duplicated block with local edits (44 matched lines × 2 locations) desktop/src/components/layout/ThreeColumnLayout.tsx:393— desktop/src/components/layout/ThreeColumnLayout.tsx:393 · desktop/src/components/layout/ThreeColumnLayout.tsx:466 — the two spans are one implementation copied and then locally edited — 330 tokens are still identical, in the same order in both spans, 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.
R10 · Code Duplication· Duplicated block with local edits (42 matched lines × 2 locations) · ×1
Duplicated block with local edits (42 matched lines × 2 locations) desktop/src/services/agents.ts:18— desktop/src/services/agents.ts:18 · desktop/src/services/channels.ts:64 — the two spans are one implementation copied and then locally edited — 401 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 (36 lines × 2 locations) desktop/src/hooks/useChatStreamingLifecycle.ts:2017— desktop/src/hooks/useChatStreamingLifecycle.ts:2017 · desktop/src/hooks/useStreamingActivity.ts:42 — 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 (35 matched lines × 2 locations) · ×1
Duplicated block with local edits (35 matched lines × 2 locations) desktop/src/components/common/Modal.tsx:58— desktop/src/components/common/Modal.tsx:58 · desktop/src/components/layout/OverlayHost.tsx:100 — the two spans are one implementation copied and then locally edited — 253 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 (34 lines × 2 locations) desktop/src/pages/chat/components/ChatInput.tsx:809— desktop/src/pages/chat/components/ChatInput.tsx:809 · desktop/src/pages/chat/components/ChatInput.tsx:849 — 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.
R10 · Code Duplication· Duplicated block with local edits (32 matched lines × 2 locations) · ×1
Duplicated block with local edits (32 matched lines × 2 locations) desktop/src/components/layout/CMBrainOverlay.tsx:1141— desktop/src/components/layout/CMBrainOverlay.tsx:1141 · desktop/src/components/layout/LibraryOverlay.tsx:520 — the two spans are one implementation copied and then locally edited — 193 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 (30 lines × 3 locations) desktop/src/pages/SkillsPage.tsx:469— desktop/src/pages/SkillsPage.tsx:469 · desktop/src/pages/SkillsPage.tsx:579 · desktop/src/pages/SkillsPage.tsx:743 — 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 (27 lines × 2 locations) desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:14— desktop/src/components/file-viewer/renderers/AudioRenderer.tsx:14 · desktop/src/components/file-viewer/renderers/VideoRenderer.tsx:14 — 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 (26 lines × 2 locations) backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10— backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:10 · backend/skills/s_pollinate/templates/remotion/components/ShortIntroCard.tsx: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 (21 lines × 2 locations) desktop/src/components/settings/SettingsTabs.tsx:82— desktop/src/components/settings/SettingsTabs.tsx:82 · desktop/src/pages/EvalDashboard.tsx:253 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (20 matched lines × 2 locations) · ×1
Duplicated block with local edits (20 matched lines × 2 locations) desktop/src/components/common/BackendStartupOverlay.tsx:408— desktop/src/components/common/BackendStartupOverlay.tsx:408 · desktop/src/components/common/BackendStartupOverlay.tsx:460 — the two spans are one implementation copied and then locally edited — 104 tokens are still identical, in the same order in both spans, 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.
R10 · Code Duplication· Duplicated block with local edits (18 matched lines × 2 locations) · ×1
Duplicated block with local edits (18 matched lines × 2 locations) desktop/src/components/chat/FileAttachmentButton.tsx:64— desktop/src/components/chat/FileAttachmentButton.tsx:64 · desktop/src/components/chat/ScreenshotButton.tsx:71 — 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.
Complex function (anonymous) (cyclomatic 308, cognitive 576) desktop/src/hooks/useChatStreamingLifecycle.ts:2302— (anonymous) has cyclomatic complexity 308 and cognitive complexity 576; 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 FileEditorCore (cyclomatic 96, cognitive 83) desktop/src/components/common/FileEditorCore.tsx:606— FileEditorCore has cyclomatic complexity 96 and cognitive complexity 83; 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.
R2 · Cyclomatic Complexity· Complex function main (cyclomatic 93, cognitive 115) · ×1
Complex function main (cyclomatic 93, cognitive 115) backend/skills/s_browser-agent/browser-agent.mjs:304— main has cyclomatic complexity 93 and cognitive complexity 115; 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 76, cognitive 128) backend/skills/s_pptx/scripts/html2pptx.js:534— (anonymous) has cyclomatic complexity 76 and cognitive complexity 128; 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 reconcile (cyclomatic 69, cognitive 138) desktop/src/hooks/useChatStreamingLifecycle.ts:1235— reconcile has cyclomatic complexity 69 and cognitive complexity 138; 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 60, cognitive 90) desktop/src/pages/ChatPage.tsx:2156— (anonymous) has cyclomatic complexity 60 and cognitive complexity 90; 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 ChatInput (cyclomatic 57, cognitive 53) desktop/src/pages/chat/components/ChatInput.tsx:164— ChatInput has cyclomatic complexity 57 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 streamingReducer (cyclomatic 53, cognitive 35) desktop/src/hooks/streaming-machine.ts:110— streamingReducer has cyclomatic complexity 53 and cognitive complexity 35; 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 (anonymous) (cyclomatic 50, cognitive 52) desktop/src/hooks/useChatStreamingLifecycle.ts:3756— (anonymous) has cyclomatic complexity 50 and cognitive complexity 52; 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 AssistantMessageView (cyclomatic 48, cognitive 38) desktop/src/pages/chat/components/AssistantMessageView.tsx:77— AssistantMessageView has cyclomatic complexity 48 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 (anonymous) (cyclomatic 44, cognitive 93) desktop/src/hooks/useChatStreamingLifecycle.ts:372— (anonymous) has cyclomatic complexity 44 and cognitive complexity 93; 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 flattenTree (cyclomatic 42, cognitive 50) desktop/src/components/workspace-explorer/VirtualizedTree.tsx:255— flattenTree has cyclomatic complexity 42 and cognitive complexity 50; 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 compress (cyclomatic 40, cognitive 54) backend/skills/s_browser-agent/browser-agent.mjs:199— compress has cyclomatic complexity 40 and cognitive complexity 54; 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 EngineMetricsTab (cyclomatic 40, cognitive 39) desktop/src/components/settings/EngineMetricsTab.tsx:54— EngineMetricsTab has cyclomatic complexity 40 and cognitive complexity 39; 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 fetchFileContent (cyclomatic 39, cognitive 66) desktop/src/components/file-viewer/FileViewer.tsx:262— fetchFileContent has cyclomatic complexity 39 and cognitive complexity 66; 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 FileViewerPanelImpl (cyclomatic 38, cognitive 37) desktop/src/components/file-viewer/FileViewerPanel.tsx:139— FileViewerPanelImpl has cyclomatic complexity 38 and cognitive complexity 37; 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 (anonymous) (cyclomatic 34, cognitive 56) backend/skills/s_pptx/scripts/html2pptx.js:422— (anonymous) has cyclomatic complexity 34 and cognitive complexity 56; 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 step (cyclomatic 34, cognitive 45) desktop/vite.config.js:14— step has cyclomatic complexity 34 and cognitive complexity 45; 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 33, cognitive 49) desktop/src/pages/ChatPage.tsx:940— (anonymous) has cyclomatic complexity 33 and cognitive complexity 49; 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.
Dead file (~1074 LoC) desktop/src/pages/SkillsPage.tsx— no import path from any entry point (60 application, 13 tooling, 253 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (desktop/src/components/settings/SkillsTab.tsx) — 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 (~979 LoC) backend/skills/s_pptx/scripts/html2pptx.js— no import path from any entry point (60 application, 13 tooling, 253 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 (~322 LoC) desktop/src/components/workspace/FolderPickerModal.tsx— no import path from any entry point (60 application, 13 tooling, 253 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 (~272 LoC) desktop/src/components/workspace/FileBrowser.tsx— no import path from any entry point (60 application, 13 tooling, 253 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 (~101 LoC) desktop/src/components/modals/ConvertToTaskModal.tsx— no import path from any entry point (60 application, 13 tooling, 253 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 (~91 LoC) desktop/src/pages/chat/components/radar/EvolutionBadge.tsx— no import path from any entry point (60 application, 13 tooling, 253 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 (~39 LoC) desktop/src/services/radar.ts— no import path from any entry point (60 application, 13 tooling, 253 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 (~18 LoC) desktop/src/components/settings/SkillsTab.tsx— no import path from any entry point (60 application, 13 tooling, 253 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 (~13 LoC) desktop/src/components/modals/index.ts— no import path from any entry point (60 application, 13 tooling, 253 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 (~9 LoC) desktop/src/components/layout/index.ts— no import path from any entry point (60 application, 13 tooling, 253 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
Unused dependency '@tauri-apps/plugin-notification' — Declared in desktop/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency '@tauri-apps/plugin-shell' — Declared in desktop/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Documentation: no installation or build instructions README.md— The desktop README shows how to run Tauri frontend from the project root but there is no installation or build step for the backend. Add setup instructions for running the backend standalone (cd backend, uv sync, activate .venv/bin/activate then python main.py) and a one-line 'Run both backend + frontend' command.
Documentation: no installation or build instructions docs/USER_GUIDE.md— The 'Installation' section is cut at the clip marker before Build from Source and Clone the repo install steps appear; no build/run instructions for the frontend or backend follow the prerequisites list. Complete the Installation chapter with Build from Source (setup Node, run npm install -g claude-code + ai-ready helpers), clone the repo, install frontend dependencies, set up backend environment, and run in development mode.
Unused export 'default' backend/skills/s_pollinate/templates/remotion/Thumbnail.tsx:105— Nothing imports this binding — it is safe to review for removal.
Unused export 'default' backend/skills/s_pollinate/templates/remotion/Video.tsx:360— Nothing imports this binding — it is safe to review for removal.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
M2 · Architecture documentation· ADRs not easily discoverable · ×1
ADRs not easily discoverable — 2 ADR-shaped document(s) detected by content — `backend/skills/s_narrative-writing/reference/templates/adr.md`, `backend/skills/s_project-manager/SKILL.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.
No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
No SAST — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 38191 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
R7 · Dead Code· Unused export 'AudioWaveform' · ×1
Unused export 'AudioWaveform' backend/skills/s_pollinate/templates/remotion/components/AudioWaveform.tsx:19— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'CodeBlock' backend/skills/s_pollinate/templates/remotion/components/CodeBlock.tsx:5— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'ComparisonCard' · ×1
Unused export 'ComparisonCard' backend/skills/s_pollinate/templates/remotion/components/ComparisonCard.tsx:5— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'DataBar' backend/skills/s_pollinate/templates/remotion/components/DataBar.tsx:5— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'DataTable' backend/skills/s_pollinate/templates/remotion/components/DataTable.tsx:5— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'DiagramReveal' · ×1
Unused export 'DiagramReveal' backend/skills/s_pollinate/templates/remotion/components/DiagramReveal.tsx:390— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'ErrorBoundary' · ×1
Unused export 'ErrorBoundary' backend/skills/s_pollinate/templates/remotion/components/ErrorBoundary.tsx:15— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'FeatureGrid' backend/skills/s_pollinate/templates/remotion/components/FeatureGrid.tsx:5— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'FlowChart' backend/skills/s_pollinate/templates/remotion/components/FlowChart.tsx:130— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'LottieAnimation' · ×1
Unused export 'LottieAnimation' backend/skills/s_pollinate/templates/remotion/components/LottieAnimation.tsx:23— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'MediaGrid' backend/skills/s_pollinate/templates/remotion/components/MediaSection.tsx:83— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'QuoteBlock' backend/skills/s_pollinate/templates/remotion/components/QuoteBlock.tsx:5— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'SplitLayout' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:30— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'StatHighlight' · ×1
Unused export 'StatHighlight' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:124— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'ZigzagCards' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:206— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'CenteredShowcase' · ×1
Unused export 'CenteredShowcase' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:318— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'MetricsRow' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:387— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'StepProgress' backend/skills/s_pollinate/templates/remotion/components/SectionLayouts.tsx:511— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'ShortCTACard' backend/skills/s_pollinate/templates/remotion/components/ShortCTACard.tsx:5— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'ShortIntroCard' · ×1
Unused export 'ShortIntroCard' backend/skills/s_pollinate/templates/remotion/components/ShortIntroCard.tsx:4— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'StatCounter' backend/skills/s_pollinate/templates/remotion/components/StatCounter.tsx:6— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'Timeline' backend/skills/s_pollinate/templates/remotion/components/Timeline.tsx:79— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
Unused export 'useExit' backend/skills/s_pollinate/templates/remotion/components/animations.tsx:40— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code· Unused export 'useTextReveal' · ×1
Unused export 'useTextReveal' backend/skills/s_pollinate/templates/remotion/components/animations.tsx:134— Nothing ultimately consumes this binding: its only referrer is the re-export in backend/skills/s_pollinate/templates/remotion/components/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in backend/skills/s_pollinate/templates/remotion/components/index.ts in the same commit, or the barrel will import a name that no longer exists.
No security response headers detected hive/Caddyfile:19— No Content-Security-Policy / X-Frame-Options / X-Content-Type-Options configuration found — defense in depth, even when a reverse proxy could set them. This is reported because `Caddyfile` is committed to this repository and declares the server that serves it, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.)
Outdated: tauri — `tauri` is locked at 2.11.5 but 2.11.6 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri` and commit the updated Cargo.lock.
Outdated: tauri-plugin-updater — `tauri-plugin-updater` is locked at 2.11.0 but 2.12.0 is the current stable release on crates.io, and it already satisfies the `"2"` requirement declared in desktop/src-tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-updater` and commit the updated Cargo.lock.
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.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
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 2 file(s) — `desktop/src/pages/EvalDashboard.tsx`, `desktop/src/types/index.ts` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a0c534-3fdb-7a57-bd20-353c09ed89bc · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 192 · Warnings: 2137 · Recommendations: 39 · Info: 2 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 21-09-2026 @ 18:22 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.