Public report of vNeeL-code/GHOST, published 17 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 17 November 2026, 20:09 UTC · Survey ID cd_b97c8e106e9e41ceac294d9f7f0dac42
vNeeL-code/GHOST
Measured 17 November 2026, 20:04 UTC, at code version 88b58f7
First survey, so nothing to compare with yet
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A medium codebase: 27,825 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 0.2 person-years · Weakest lens: Production Readiness, 22.9
Findings by how serious they are
0 critical319 serious141 minor
13 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 20:04 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
45of 45 dimensions measured by tools.
335of 460 findings point to an exact file and line, so you can open each one in the code. The other 125 concern the repository as a whole, such as missing documentation.
45dimensions across 6 lenses, read from 27,825 lines of product code in 2 projects.
vNeeL-code/GHOST falls short of our standard for production because we found no working pipeline that builds or tests changes to the code and no automated security scanning of the code, its secrets or its dependencies. It scores 48.6 out of 100 and is rated Weak, and it has no critical findings.
Production Readiness, at 22.9, is the weakest lens and counts most in the score. The best first step for the work it takes is recording design decisions, worth about 3.9 points. Adding an automated build and test pipeline would lift Production Readiness itself, worth about 5.9 points. Raising Production Readiness to 70 would lift the score to about 68.8.
Most of the 319 serious findings are in Code Health.
The product code is 27,825 lines, about €26,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 22.9 to 70, the lowest score rated Strong, the score would rise from 48.6 to about 68.8.
Code composition: what the lines of code are
Product code 98%Tests 2%
Rebuild cost: about €26,000 · Estimate
Cost to rebuild
€8,700 to €44,000, for 145 to 460 hours of work, about 0.2 person-years for one engineer
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 49. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Medium: 27,825 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with build.gradle.kts.
Raises the score by about 3.9 points · Low effort · ADR Quality
2
Resolve the 1 `cleanForTTS` spells `TTS` where 43 names in the project spell it `Tts` finding(s) in Naming Consistency — start with GhostAgent.kt.
Add a CI workflow that builds and runs the test suite on every push/PR.
Raises the score by about 5.9 points · Medium effort · CI/CD gates
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €26,000 to build again, about 0.2 person-years of work. Its weakest lens is Production Readiness, at 22.9 (Critical). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 3.9 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.4 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 7% to 15% on every change. The history of the code shows how much it changes: about 55,543 lines over the last 90 days, which is about 225,258 lines a year. At that pace, the extra work comes to an estimated 36.7 to 220.2 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
69 modules, with 79 dependencies between them. 2 loops run through 10 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 29 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
GemmaAccessibilityService uses com.ghost.api, so a change to com.ghost.api can break GemmaAccessibilityService, while a change to GemmaAccessibilityService can't break com.ghost.api.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
15→38 GemmaService uses com.ghost.apipart of a loop✕
Connections
2 pairs of types, where a type in GemmaService uses a type in com.ghost.api.
ModelDownloader.DownloadState uses ModelDownloader, so a change to ModelDownloader can break ModelDownloader.DownloadState, while a change to ModelDownloader.DownloadState can't break ModelDownloader.
Position
Below the diagonal: ModelDownloader.DownloadState uses a module listed above it, which is the healthy direction.
billing.BillingManager uses billing, so a change to billing can break billing.BillingManager, while a change to billing.BillingManager can't break billing.
Position
Below the diagonal: billing.BillingManager uses a module listed above it, which is the healthy direction.
database.MemoryDatabase uses database, so a change to database can break database.MemoryDatabase, while a change to database.MemoryDatabase can't break database.
Position
Below the diagonal: database.MemoryDatabase uses a module listed above it, which is the healthy direction.
hardware uses hardware.HardwarePropertiesManager, so a change to hardware.HardwarePropertiesManager can break hardware, while a change to hardware can't break hardware.HardwarePropertiesManager.
Position
Below the diagonal: hardware uses a module listed above it, which is the healthy direction.
hardware uses hardware.NetworkToolSet, so a change to hardware.NetworkToolSet can break hardware, while a change to hardware can't break hardware.NetworkToolSet.
Position
Below the diagonal: hardware uses a module listed above it, which is the healthy direction.
hardware uses hardware.SystemToolSet, so a change to hardware.SystemToolSet can break hardware, while a change to hardware can't break hardware.SystemToolSet.
Position
Below the diagonal: hardware uses a module listed above it, which is the healthy direction.
hardware.HardwarePropertiesManager.ThermalState uses hardware.HardwarePropertiesManager, so a change to hardware.HardwarePropertiesManager can break hardware.HardwarePropertiesManager.ThermalState, while a change to hardware.HardwarePropertiesManager.ThermalState can't break hardware.HardwarePropertiesManager.
Position
Below the diagonal: hardware.HardwarePropertiesManager.ThermalState uses a module listed above it, which is the healthy direction.
23→31 services.TTSManager uses servicespart of a loop✕
Connections
1 pair of types, where a type in services.TTSManager uses a type in services.
GemmaService.ThermalSafetyState uses GemmaService, so a change to GemmaService can break GemmaService.ThermalSafetyState, while a change to GemmaService.ThermalSafetyState can't break GemmaService.
Position
Below the diagonal: GemmaService.ThermalSafetyState uses a module listed above it, which is the healthy direction.
agent.GhostAgent.AgentEvent uses agent.GhostAgent, so a change to agent.GhostAgent can break agent.GhostAgent.AgentEvent, while a change to agent.GhostAgent.AgentEvent can't break agent.GhostAgent.
Position
Below the diagonal: agent.GhostAgent.AgentEvent uses a module listed above it, which is the healthy direction.
agent.GhostAgent.SystemEventType uses agent.GhostAgent, so a change to agent.GhostAgent can break agent.GhostAgent.SystemEventType, while a change to agent.GhostAgent.SystemEventType can't break agent.GhostAgent.
Position
Below the diagonal: agent.GhostAgent.SystemEventType uses a module listed above it, which is the healthy direction.
hardware.AutomationToolSet uses hardware, so a change to hardware can break hardware.AutomationToolSet, while a change to hardware.AutomationToolSet can't break hardware.
Position
Below the diagonal: hardware.AutomationToolSet uses a module listed above it, which is the healthy direction.
hardware.ScheduledTask uses hardware, so a change to hardware can break hardware.ScheduledTask, while a change to hardware.ScheduledTask can't break hardware.
Position
Below the diagonal: hardware.ScheduledTask uses a module listed above it, which is the healthy direction.
service uses agent.GhostAgent.AgentEvent, so a change to agent.GhostAgent.AgentEvent can break service, while a change to service can't break agent.GhostAgent.AgentEvent.
Position
Below the diagonal: service uses a module listed above it, which is the healthy direction.
agent uses agent.GhostAgent.AgentEvent, so a change to agent.GhostAgent.AgentEvent can break agent, while a change to agent can't break agent.GhostAgent.AgentEvent.
Position
Below the diagonal: agent uses a module listed above it, which is the healthy direction.
com.ghost.api uses ModelDownloader, so a change to ModelDownloader can break com.ghost.api, while a change to com.ghost.api can't break ModelDownloader.
Position
Below the diagonal: com.ghost.api uses a module listed above it, which is the healthy direction.
com.ghost.api uses hardware.HardwarePropertiesManager, so a change to hardware.HardwarePropertiesManager can break com.ghost.api, while a change to com.ghost.api can't break hardware.HardwarePropertiesManager.
Position
Below the diagonal: com.ghost.api uses a module listed above it, which is the healthy direction.
com.ghost.api uses GemmaAccessibilityService, so a change to GemmaAccessibilityService can break com.ghost.api, while a change to com.ghost.api can't break GemmaAccessibilityService.
Position
Below the diagonal: com.ghost.api uses a module listed above it, which is the healthy direction.
GemmaNotificationListener uses GemmaNotificationListener.Companion, so a change to GemmaNotificationListener.Companion can break GemmaNotificationListener, while a change to GemmaNotificationListener can't break GemmaNotificationListener.Companion.
Position
Below the diagonal: GemmaNotificationListener uses a module listed above it, which is the healthy direction.
GemmaNotificationListener uses com.ghost.api, so a change to com.ghost.api can break GemmaNotificationListener, while a change to GemmaNotificationListener can't break com.ghost.api.
Position
Below the diagonal: GemmaNotificationListener uses a module listed above it, which is the healthy direction.
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
1
Medium
A01:2025 — Broken Access Control
1
Medium
Roadmap
Top priorities: Add a CI workflow that builds and runs the test suite on every push/PR; Run what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing; Adopt SLF4J (with a Logback or Log4j2 JSON encoder) and log at meaningful points in the modules you run.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with build.gradle.kts.
Run what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing.
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
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 — 0
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 — 319
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 — 141
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 13
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey 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. All 45 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.8, the weighted average across measured dimensions.
Every figure here is one of two 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. 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.
What we checked — 45 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, 335 of 460 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 or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.kt) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo.
D11 Test Reliability — not measured this run — We 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 source is present (.kt) and this repository declares a JVM test suite (repository root, Gradle), but it was not re-run: the analyzer environment could not run it. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D12 Dependency Hygiene — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. Currency was graded against Maven Central, but whether an artifact is DEPRECATED is not: Maven Central publishes no deprecation marker, exactly as rubygems.org does not. Whether one is UNMAINTAINED is not graded either — no registry publishes a maintenance status, and release age does not stand in for one. Two of this dimension's four signals are therefore unread on a Gradle tree, and its score reflects currency alone.
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 1692 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.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We 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. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
D24 Comment Value — not measured this run — We 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's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D26 Project Cohesion — not measured this run — We 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. `app` (27858 LoC, 226 module-visible types across 23 directories) is over its size bounds, and whether one unit is a coherent whole or a grab-bag is read from its type references: the parts of it that reach the rest only through its shared core. Those are read over the C#/VB code model, which this unit's source did not supply. Its size alone is no verdict on its cohesion, so none is published.
D32 Data Compliance (PII/GDPR) — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. `app/src/main/kotlin/com/ghost/api/Constants.kt`, `app/src/main/kotlin/com/ghost/api/service/GhostForegroundNotificationController.kt`, `app/src/main/kotlin/com/ghost/api/skills/QrCodeGenerator.kt` 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.
AXR1 Runtime accessibility — not measured this run — We 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. Boot via AndroidApp (app). the Android app built but did not install on the emulator (system-images;android-34;aosp_atd;x86_64): Performing Streamed Install
adb: failed to install app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk: Failure [INSTALL_FAILED_NO_MATCHING_AB… — runtime evidence skipped.
C2 Access Controls — not measured this run — We 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.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and this repository's Kotlin is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and this repository's Kotlin is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P5 DR & Backup — 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. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Scala, Ruby and Python source only, and no C# was loaded and no JavaScript/TypeScript, Java, Scala, Ruby or Python was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we 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. 73 further occurrence(s) are not listed individually; the score already reflects all 113.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
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").
D32 Data Compliance (PII/GDPR): PII/GDPR signals are heuristic pattern matches in code — they flag likely handling concerns, not legal compliance, and cannot trace where data actually flows at runtime.
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.
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.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
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.
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.
62 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was GhostAgent.processUserMessage at 149. A further 2 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 SystemVisualizer.pushEmotionColor at 40 — they are counted neither in the figure above nor in this dimension's score.
+ 57 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 6 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with GhostAgent.processUserMessage (cyclomatic 149), SettingsDialogKt.SettingsDialog (cyclomatic 146), GemmaService.initialize (cyclomatic 80). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 6 together lifts Cyclomatic Complexity from 2.0 to about 3.3/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 83 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 12 bodies over 60 down to 60 or less in Cognitive Complexity — start with SettingsDialogKt.SettingsDialog (cognitive 399), GhostAgent.processUserMessage (cognitive 298), GemmaService.initialize (cognitive 146). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 12 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes6.5 / 10Adequate✓ 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 21 MethodTooLong finding(s) in God Classes — start with AvatarWallpaperService.kt (4), GemmaService.kt (3), ChatScreen.kt (2). — One of this dimension's main actionable groups (21 warning-level).
Resolve the 10 FileTooLong finding(s) in God Classes — start with SettingsDialog.kt, GemmaService.kt, ChatScreen.kt. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 8 ClassTooLong finding(s) in God Classes — start with GemmaService.kt, GhostAgent.kt, AvatarWallpaperService.kt. — One of this dimension's main actionable groups (8 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
49 duplicated block group(s) detected. 4.3 % of the production lines (1,197 of 27,825) are in a reported copy. A further 9 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.
+ 32 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 7 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with ApiServer.kt (2), AvatarWallpaperService.kt, ContextManager.kt. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 4 Duplicated block (15 lines × 2) finding(s) in Code Duplication — start with SettingsDialog.kt (2), GhostAgent.kt, ChatScreen.kt. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 4 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with SettingsDialog.kt (2), GemmaService.kt, GhostAgent.kt. — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
2 production modules (Gradle), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; 0 module(s) off the main sequence, with abstractness counted on 1 of the 2 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 2 Low cohesion finding(s) in Cohesion (LCOM4) — start with UiMacroToolSet.kt, FileToolSet.kt. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
This repository's Gradle dependency graph was RESOLVED BY A BUILD, across every subproject rather than the root alone: 306 artifact(s) resolved, 149 of them gradable against Maven Central, and 120 behind a shipped release. Where a version was requested and a different one won conflict resolution, the RESOLVED version is what is graded — grading the request would recommend an upgrade already applied. Known CVEs in the same graph are a separate question again, reported under D30.
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 10 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 2 Maven/Gradle manifest(s) declare with a version resolvable from the manifest itself — the same declaration-site closure this analysis reads for dependency currency. The JVM has no lockfile a checkout is guaranteed to carry, so this is deliberately NOT the transitive closure. A further 13 coordinate(s) are not published to Maven Central — another repository (Google's Maven hosts androidx), a SNAPSHOT, or a private artifact — so their licences are not readable from here and they are outside this verdict.
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: app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt (49×146=7154); app/src/main/kotlin/com/ghost/api/GemmaService.kt (77×80=6160); app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt (28×149=4172) Repeated repair below the complexity floor: app/src/main/kotlin/com/ghost/api/services/TTSManager.kt (12 of 17 changes were fixes); app/src/main/kotlin/com/ghost/api/agent/SessionMemoryCompactor.kt (5 of 8 changes were fixes)
Resolve the 19 Hotspot finding(s) in Churn × Complexity Hotspots — start with SettingsDialog.kt, GemmaService.kt, GhostAgent.kt. — One of this dimension's main actionable groups (19 warning-level).
Resolve the 2 Repeated repair finding(s) in Churn × Complexity Hotspots — start with TTSManager.kt, SessionMemoryCompactor.kt. — One of this dimension's main actionable groups (2 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.
1 deducted task-comment markers across 27825 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 1 TodoComment finding(s) in Explicit Debt — start with SensorFusionManager.kt. — One of this dimension's main actionable groups (1 warning-level).
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: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 1 document(s) read across 2 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with build.gradle.kts. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
1 naming inconsistencies among 44 declarations measured against a convention their peers follow.
`cleanForTTS` spells `TTS` where 43 names in the project spell it `Tts`app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1691
What to do
Resolve the 1 `cleanForTTS` spells `TTS` where 43 names in the project spell it `Tts` finding(s) in Naming Consistency — start with GhostAgent.kt. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
33 % of calls cross a namespace and 15 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D32 · Data Compliance (PII/GDPR)9.0 / 10Stronggated by 1 serious finding✓ Tool-verified
What it measures: Likely personal-data (PII / GDPR) handling concerns — logging or storing data without safeguards.
Method: Heuristic PII/GDPR LEAK scan via semgrep across the repo, using our own ruleset: personal data crossing a boundary it should not — reaching a log/console sink, a URL or query string, or unprotected browser storage. Matches map to severity and a 0-10 wide normalizer. A clean sweep is unscored rather than an unearned 10, and is a statement about the leak paths checked only — this dimension does not inventory the personal data a repository holds (the personal-data map and the C1-C5 compliance cards do that), so it never reports that a repository has no personal-data surface. Reported LOUDLY as a measurement gap if the ruleset is missing from the analyzer image. Exhaustive over the leak paths, advisory-leaning; degrades on parse failure.
1 finding(s): 0 critical, 0 high, 1 medium, 0 low. semgrep could not parse 3 file(s) — `app/src/main/kotlin/com/ghost/api/Constants.kt`, `app/src/main/kotlin/com/ghost/api/service/GhostForegroundNotificationController.kt`, `app/src/main/kotlin/com/ghost/api/skills/QrCodeGenerator.kt` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Data Compliance (PII/GDPR) — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d32_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 62 of the 81 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 1 Change coupling finding(s) in Change Coupling — start with AvatarWallpaperService.kt. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 28 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
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.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`AgentPlatformCallbacks` declares 22 abstract methods: `showThinking`, `cancelThinking`, `showResponse`, `onMessageAdded`, `onThoughtUpdated`, `onThoughtComplete`, `onEmotionSignal`, `updateNotification`, `showConfirmation`, `speak`, `stopSpeaking`, `storeConversationTurn`, `writeDiaryEntry`, `unloadEngine`, `reloadEngine`, `isEngineLoaded`, `getCurrentThermalState`, `getThermalDelayMs`, `broadcastMoodChange`, `getRecentConversationHistory`, `createCalendarEvent`, `getSkillsList`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — app/src/main/kotlin/com/ghost/api/agent/AgentPlatformCallbacks.kt:6
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
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.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Do you agree with this assessment?
P1 · CI/CD gates0.0 / 10Critical✓ Tool-verified
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
No CI workflow found (.github/workflows, azure-pipelines.yml, .gitlab-ci.yml, …) — changes aren't gated by an automated build/test.
What to do
Add a CI workflow that builds and runs the test suite on every push/PR.
Do you agree with this assessment?
P2 · Observability1.0 / 10Critical✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
No logging call was found in the 79 JavaScript/TypeScript, JVM production file(s) this check read across 2 module(s). Each was searched for its ecosystem's logging libraries (JVM: SLF4J, Log4j2, java.util.logging, Logback, kotlin-logging, scala-logging; JavaScript/TypeScript: pino, winston, bunyan, log4js, loglevel, consola, the NestJS Logger) and for a call on a receiver named `log`/`logger` (or ending in `Logger`/`_logger`) with a level verb. It cannot see logging through a repo-local wrapper named otherwise, or in source it did not read — this is 'no logging found by this walk', not a verdict that nothing here logs. If it is right, production issues will be hard to diagnose.
What to do
Adopt SLF4J (with a Logback or Log4j2 JSON encoder) and log at meaningful points in the modules you run.
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 spotbugs with find-sec-bugs (or `semgrep --config=auto`, which runs on any language) — this repository has no CI pipeline yet, so run it locally to clear the existing findings, then make it a step of the first workflow you add so a regression fails the build. What was searched, so you can tell an absence from a miss: the 0 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.
`app/build.gradle.kts` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — app/build.gradle.kts:143
What to do
Run what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add 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 traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
What to do
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for (x in c)` or `c.forEach { … }` leaves the collection it is walking alone — a `mutableListOf`/`ArrayList`, `mutableMapOf`/`HashMap` or `mutableSetOf`/`HashSet` is a `java.util` collection on the JVM and is walked by its own fail-fast iterator, so a body that adds to or removes from the very collection the loop is walking makes the next step throw `ConcurrentModificationException` and the remaining elements are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×6) — app/src/main/kotlin/com/ghost/api/Constants.kt:42, app/src/main/kotlin/com/ghost/api/Constants.kt:53, app/src/main/kotlin/com/ghost/api/Constants.kt:62, …
`catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×7) — app/src/main/kotlin/com/ghost/api/Constants.kt:93, app/src/main/kotlin/com/ghost/api/GemmaService.kt:118, app/src/main/kotlin/com/ghost/api/GemmaService.kt:332, …
`catch (_: Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:81
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×26) — app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:194, app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:195, app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:206, …
Other · Code Health — Whether Kotlin's null safety is not undermined by not-null assertions — `String` cannot hold null and `String?` must be checked before use in every Kotlin module, and each `!!` is a run-time `NullPointerException` the author has told the compiler cannot happen.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 2 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 5 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 9 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 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.
P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 67 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — Not applicable: this repository's Kotlin imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Kotlin code is a Spring, JSR-330 or CDI singleton bean. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the Android app built but did not install on the emulator (system-images;android-34;aosp_atd;x86_64): Performing Streamed Install
adb: failed to install app/build/outputs/apk/fdroid/debug/app-fdroid-debug.apk: Failure [INSTALL_FAILED_NO_MATCHING_AB… — runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the app is inaccessible, only that it was never run.
C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no data at rest for these controls to protect.
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.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named column (email, first_name, date_of_birth, phone_number, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
D10 Test Quality — ~668 lines of test source are present (.kt) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D11 Test Reliability — Test reliability not included — the .kt suite was found but not re-run
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.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .kt, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — no ADRs to check
D26 Project Cohesion — D26 could not read how the parts of this repository's one build unit reference each other, so its cohesion was not measured. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Gradle build (build.gradle/build.gradle.kts) — not scanned yet).
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.
D36 Supply-chain Provenance & Signing — No CI/build pipeline found (.github/.forgejo/.gitea workflows, .circleci, .buildkite, .woodpecker, .teamcity, .gitlab-ci.yml, .travis.yml, bitbucket-pipelines.yml, .drone.yml, .cirrus.yml, .woodpecker.yml, appveyor.yml, azure-pipelines*.yml, .pipelines/, .vsts-ci/, .azuredevops/, Jenkinsfile); there is no build to attest provenance for.
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
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.
D43 Malicious Dependencies — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Gradle build (build.gradle/build.gradle.kts) — not scanned yet).
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (1 domain event(s); its domain events are published by services or handlers — no domain entity raises one)
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
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#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — no CI workflow found
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `@Benchmark` in a Java, Kotlin or Scala file importing JMH or kotlinx-benchmark, Jetpack Benchmark's `measureRepeated` in a file importing androidx.benchmark, or JMH/kotlinx-benchmark/androidx.benchmark in a pom.xml, Gradle or sbt build, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — no C# was loaded; this repository's Kotlin was read, and no request in it can be cancelled by a caller (Ktor, OkHttp's newCall or a URL stream, from a suspend function) — a Kotlin request outside a suspend function has no caller's cancellation to honour
X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — 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
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Kotlin was read, and it logs through none that an assembled message defeats: Android's `Log` and Timber, java.util.logging and log4j-api-kotlin take one finished message (as log4net does in C#), or it makes no call through a named logger at all. Calls made through SLF4J, log4j 2 or kotlin-logging (`LoggerFactory.getLogger`, `KotlinLogging.logger {}`) would be judged.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:194— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:195— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:206— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:207— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:516— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:551— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:610— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:633— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:638— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:644— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:648— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:699— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/GemmaService.kt:873— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:235— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:236— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:237— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:245— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:289— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:325— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:355— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:361— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:370— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1855— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1858— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:73— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
MethodTooLong: GemmaService.initialize app/src/main/kotlin/com/ghost/api/GemmaService.kt:933— MethodTooLong — initialize runs 298 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 198 over it, 2.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GemmaEngine.streamResponse app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:243— MethodTooLong — streamResponse runs 191 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 91 over it, 1.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPServer.executeTool app/src/main/kotlin/com/ghost/api/mcp/MCPServer.kt:151— MethodTooLong — executeTool 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.
MethodTooLong: GhostDiaryAndCronManager.runDiaryCycleSuspend app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:249— MethodTooLong — runDiaryCycleSuspend 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.
MethodTooLong: AvatarEngine.drawOptionBHexLattice app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1024— MethodTooLong — drawOptionBHexLattice runs 183 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 83 over it, 1.83× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ChatScreenKt.VoiceMessageBubble app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:850— MethodTooLong — VoiceMessageBubble runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SensorFusionManager.registerEnvironmentSensors app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:617— MethodTooLong — registerEnvironmentSensors runs 152 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AvatarEngine.drawOptionDCubeLattice app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1547— MethodTooLong — drawOptionDCubeLattice runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GhostAgent.tryExecuteFallbackTool app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1358— MethodTooLong — tryExecuteFallbackTool runs 148 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 48 over it, 1.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: IntentHandler.handleAction app/src/main/kotlin/com/ghost/api/logic/IntentHandler.kt:16— MethodTooLong — handleAction runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ModelDownloader.startDownload app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:74— MethodTooLong — startDownload runs 142 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 42 over it, 1.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.
MethodTooLong: AvatarEngine.drawOptionAOrbitalStar app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:808— MethodTooLong — drawOptionAOrbitalStar runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AvatarEngine.drawOptionCDeltaTunnel app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1327— MethodTooLong — drawOptionCDeltaTunnel runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: QrCodeGenerator.encodeMatrix app/src/main/kotlin/com/ghost/api/skills/QrCodeGenerator.kt:50— MethodTooLong — encodeMatrix runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GemmaService.onCreate app/src/main/kotlin/com/ghost/api/GemmaService.kt:398— MethodTooLong — onCreate runs 133 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 33 over it, 1.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.
MethodTooLong: OverlayActionRegistry.executeAction app/src/main/kotlin/com/ghost/api/ui/OverlayActionRegistry.kt:229— MethodTooLong — executeAction runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SystemVisualizer.init app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:434— MethodTooLong — init runs 125 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ChatScreenKt.ReportResponseDialog app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1215— MethodTooLong — ReportResponseDialog runs 123 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 23 over it, 1.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.
MethodTooLong: ApiServer.start app/src/main/kotlin/com/ghost/api/ApiServer.kt:27— MethodTooLong — start runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GhostMcpTool.run_js app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:170— MethodTooLong — run_js runs 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: GemmaService.onStartCommand app/src/main/kotlin/com/ghost/api/GemmaService.kt:219— MethodTooLong — onStartCommand runs 108 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 8 over it, 1.08× 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.
Hotspot: app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:48— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 146 in SettingsDialogKt.SettingsDialog at line 48. 12 of those changes were fix/bug commits, and the other 37 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt`: 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: app/src/main/kotlin/com/ghost/api/GemmaService.kt app/src/main/kotlin/com/ghost/api/GemmaService.kt:933— app/src/main/kotlin/com/ghost/api/GemmaService.kt changed 77 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in GemmaService.initialize at line 933. 38 of those changes were fix/bug commits, and the other 39 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/GemmaService.kt`: 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: app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:392— app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 149 in GhostAgent.processUserMessage at line 392. 17 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt`: 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: app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:496— app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt changed 74 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in AvatarEngine.drawFrame at line 496. 23 of those changes were fix/bug commits, and the other 51 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt`: 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: app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:394— app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in ChatScreenKt.ChatMessageRow at line 394. 13 of those changes were fix/bug commits, and the other 24 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt`: 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: app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:434— app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in SystemVisualizer.init at line 434. 19 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt`: 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: app/src/main/kotlin/com/ghost/api/GemmaEngine.kt app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:243— app/src/main/kotlin/com/ghost/api/GemmaEngine.kt changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in GemmaEngine.streamResponse at line 243. 13 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/GemmaEngine.kt`: 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: app/src/main/kotlin/com/ghost/api/mcp/MCPServer.kt app/src/main/kotlin/com/ghost/api/mcp/MCPServer.kt:151— app/src/main/kotlin/com/ghost/api/mcp/MCPServer.kt changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in MCPServer.executeTool at line 151. 5 of those changes were fix/bug commits, and the other 11 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/mcp/MCPServer.kt`: 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: app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:405— app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 52 in GhostMcpTool.parseParams at line 405. 12 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt`: 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: app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:617— app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in SensorFusionManager.registerEnvironmentSensors at line 617. 8 of those changes were fix/bug commits, and the other 13 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt`: 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:66— REDACTED changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in SystemToolSet.app at line 66. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00: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: app/src/main/kotlin/com/ghost/api/ModelDownloader.kt app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:74— app/src/main/kotlin/com/ghost/api/ModelDownloader.kt changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in ModelDownloader.startDownload at line 74. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/ModelDownloader.kt`: 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: app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:531— app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in BaseEdgeView.drawWireframe at line 531. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt`: 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: app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:88— app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in IntentBagger.bagIntents at line 88. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt`: 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: app/src/main/kotlin/com/ghost/api/logic/IntentHandler.kt app/src/main/kotlin/com/ghost/api/logic/IntentHandler.kt:16— app/src/main/kotlin/com/ghost/api/logic/IntentHandler.kt changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in IntentHandler.handleAction at line 16. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/logic/IntentHandler.kt`: 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: app/src/main/kotlin/com/ghost/api/ui/GhostWorkIndicatorOverlay.kt app/src/main/kotlin/com/ghost/api/ui/GhostWorkIndicatorOverlay.kt:161— app/src/main/kotlin/com/ghost/api/ui/GhostWorkIndicatorOverlay.kt changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in FlavorTexts.pick at line 161. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/ui/GhostWorkIndicatorOverlay.kt`: 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: app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:48— app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in GemmaAccessibilityService.getSemanticScreenDump at line 48. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt`: 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: app/src/main/kotlin/com/ghost/api/logic/FastPathRouter.kt app/src/main/kotlin/com/ghost/api/logic/FastPathRouter.kt:88— app/src/main/kotlin/com/ghost/api/logic/FastPathRouter.kt changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in FastPathRouter.route at line 88. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/logic/FastPathRouter.kt`: 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: app/src/main/kotlin/com/ghost/api/logic/GeminiDirectClient.kt app/src/main/kotlin/com/ghost/api/logic/GeminiDirectClient.kt:28— app/src/main/kotlin/com/ghost/api/logic/GeminiDirectClient.kt changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in GeminiDirectClient.generateContent at line 28. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/logic/GeminiDirectClient.kt`: 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.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/Constants.kt:42— `catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/Constants.kt:53— `catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/Constants.kt:62— `catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/Constants.kt:93— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:340— `catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:81— `catch (_: Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/GemmaService.kt:118— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/GemmaService.kt:332— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1470— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/MainActivity.kt:461— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:56— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/ui/EdgeNubOverlay.kt:102— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/ui/InputOverlay.kt:524— `catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) app/src/main/kotlin/com/ghost/api/ui/InputOverlay.kt:525— `catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
FileTooLong: screens/SettingsDialog.kt app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt— FileTooLong — 1776 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1276 over it, 3.55× 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: api/GemmaService.kt app/src/main/kotlin/com/ghost/api/GemmaService.kt— FileTooLong — 1413 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: GemmaService (61-2179). The bar is 500 significant lines; this is 913 over it, 2.83× 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: screens/ChatScreen.kt app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt— FileTooLong — 1370 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 870 over it, 2.74× 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: agent/GhostAgent.kt app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt— FileTooLong — 1275 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: GhostAgent (34-1755). The bar is 500 significant lines; this is 775 over it, 2.55× 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: ui/AvatarWallpaperService.kt app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt— FileTooLong — 1197 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: AvatarWallpaperService (22-1861). The bar is 500 significant lines; this is 697 over it, 2.39× 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: hardware/SensorFusionManager.kt app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt— FileTooLong — 1116 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: SensorFusionManager (150-1592). The bar is 500 significant lines; this is 616 over it, 2.23× 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: audio/SystemVisualizer.kt app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt— FileTooLong — 787 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 287 over it, 1.57× 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: api/GemmaEngine.kt app/src/main/kotlin/com/ghost/api/GemmaEngine.kt— FileTooLong — 566 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: GemmaEngine (37-803). The bar is 500 significant lines; this is 66 over it, 1.13× 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: ui/EdgeLightsManager.kt app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt— FileTooLong — 554 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 54 over it, 1.11× 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 — 513 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: SystemToolSet (20-722). The bar is 500 significant lines; this is 13 over it, 1.03× 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.
ClassTooLong: GemmaService app/src/main/kotlin/com/ghost/api/GemmaService.kt:61— ClassTooLong — 1364 significant lines (blank, comment-only and punctuation-only lines excluded), 78 methods. The bar is 400 significant lines; this is 964 over it, 3.41× 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: GhostAgent app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:34— ClassTooLong — 1251 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 851 over it, 3.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AvatarWallpaperService app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:22— ClassTooLong — 1178 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 778 over it, 2.95× 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: SensorFusionManager app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:150— ClassTooLong — 998 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 598 over it, 2.50× 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: GemmaEngine app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:37— ClassTooLong — 535 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 135 over it, 1.34× 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: SystemToolSet REDACTED:20— ClassTooLong — 496 significant lines (blank, comment-only and punctuation-only lines excluded), 14 methods. The bar is 400 significant lines; this is 96 over it, 1.24× 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: TTSManager app/src/main/kotlin/com/ghost/api/services/TTSManager.kt:30— ClassTooLong — 458 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 58 over it, 1.15× 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: InputOverlay app/src/main/kotlin/com/ghost/api/ui/InputOverlay.kt:42— ClassTooLong — 453 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 53 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (7 lines × 2) app/src/main/kotlin/com/ghost/api/ApiServer.kt:54— app/src/main/kotlin/com/ghost/api/ApiServer.kt:54-60 | app/src/main/kotlin/com/ghost/api/ApiServer.kt:160-166 — 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 `app/src/main/kotlin/com/ghost/api/ApiServer.kt:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1397— app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1397-1403 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1424-1430 — 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) app/src/main/kotlin/com/ghost/api/ApiServer.kt:77— app/src/main/kotlin/com/ghost/api/ApiServer.kt:77-83 | app/src/main/kotlin/com/ghost/api/ApiServer.kt:172-178 — 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 `app/src/main/kotlin/com/ghost/api/ApiServer.kt:77` 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) app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:102— app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:102-108 | app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:119-125 — 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 `app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) REDACTED:196— REDACTED:196-202 | REDACTED:228-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:196` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:194` calls `putExtra` and `REDACTED:226` 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 (7 lines × 2) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:515— app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:515-521 | app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:550-556 — 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) app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:356— app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:356-362 | app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:367-373 — 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, `app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:354` calls `toString` and `app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:365` 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 (15 lines × 2) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:937— app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:937-951 | app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1033-1047 — 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 `app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:937` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1092— app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1092-1106 | app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1228-1242 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1092` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1689— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1689-1703 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1786-1800 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1689` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:520— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:520-534 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:783-797 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:520` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1078— app/src/main/kotlin/com/ghost/api/GemmaService.kt:1078-1088 | app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:375-385 — 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 (11 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1278— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1278-1288 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1369-1379 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1278` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1367` calls `Spacer`, `height` and `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1275` 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 (11 lines × 2) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:477— app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:477-487 | app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:501-511 — 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) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1247— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1247-1257 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1334-1344 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1247` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:215— app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:215-223 | app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:270-278 — 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 `app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:215` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:269— app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:269-277 | app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:481-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. Read the line range as the matched WINDOW rather than a finished unit: at `app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:269` 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) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:726— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:726-734 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1201-1209 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:726` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:725` calls `listOf` and `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1200` 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 (9 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2312— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2312-2320 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2365-2373 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2312` 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.
TooManyMethods: GemmaService app/src/main/kotlin/com/ghost/api/GemmaService.kt:61— TooManyMethods — 78 methods. The bar is 30 methods; this is 48 over it, 2.60× 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: ActionFlavorTexts app/src/main/kotlin/com/ghost/api/logic/GenuinePeoplePersonality.kt:52— 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: GhostAgent app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:34— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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 (5 lines × 2) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:645— app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:645-649 | app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:672-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. Read the line range as the matched WINDOW rather than a finished unit: at `app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:645` 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) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1337— app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1337-1341 | app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1583-1587 — 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) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1053— app/src/main/kotlin/com/ghost/api/GemmaService.kt:1053-1057 | app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:356-360 — 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 `app/src/main/kotlin/com/ghost/api/GemmaService.kt:1053` 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.
Repeated repair: app/src/main/kotlin/com/ghost/api/services/TTSManager.kt app/src/main/kotlin/com/ghost/api/services/TTSManager.kt:554— app/src/main/kotlin/com/ghost/api/services/TTSManager.kt changed 17 times in last 90 days and 12 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is TTSManager.doSmartSpeak at line 554), AT OR 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(peers): swap Copilot glyph from 🪟 to universal Unicode ⊞ (U+229E)”; “fix(peers): swap Copilot glyph from 🔶 to 🪟 across SystemVisualizer, AiPhonebook, and GLOSSARY”; “fix(visualizer): swap Grok glyph to ∅ and restore 🟣 Qwen & all peer glyphs in setActivePeer”; “fix(sensory): replace stamina with energy, debounce notification announcements, and append visual cards to chat”. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/services/TTSManager.kt`: 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: app/src/main/kotlin/com/ghost/api/agent/SessionMemoryCompactor.kt app/src/main/kotlin/com/ghost/api/agent/SessionMemoryCompactor.kt:15— app/src/main/kotlin/com/ghost/api/agent/SessionMemoryCompactor.kt 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 15 (its worst body is SessionMemoryCompactor.compactOldMessages at line 15), AT OR 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: “v4.40.1: fix consult_peer knowledge synthesis & eliminate mid-word prompt truncation loop”; “fix(sensory): eliminate context tag leakage, sanitize preambles in UI/TTS/history, and harden zero-leak sensory rules”; “fix(prompt): isolate subconscious telemetry, fix emoji choke false-flush, upgrade Gemini to 2.5 flash, and add TTS readback for peer consultations”; “fix(stability): resolve startup ANR crash and eliminate stuck thinking deadlock”. 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-08-14..2026-11-12, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-14 23:08:49 +00:00' --until='2026-11-12 23:08:49 +00:00' --full-history --no-merges -- app/src/main/kotlin/com/ghost/api/agent/SessionMemoryCompactor.kt`: 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 (26 lines × 2) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:729— app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:729-754 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:763-788 — 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 (26 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2115— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2115-2140 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2206-2231 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2115` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:177— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:177-192 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:227-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:177` 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 (16 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:166— app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:166-181 | app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:192-207 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:166` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:708— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:708-719 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:737-748 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:708` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1221— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1221-1232 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1786-1797 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1221` 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 × 3) app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:204— app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:204-209 | app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:240-245 | app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:369-374 — 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 `app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:204` 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, `app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:211` calls `isProtectedModelFile`, `mapOf` and `app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:247` 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 × 3) app/src/main/kotlin/com/ghost/api/GemmaNotificationListener.kt:45— app/src/main/kotlin/com/ghost/api/GemmaNotificationListener.kt:45-50 | app/src/main/kotlin/com/ghost/api/GemmaNotificationListener.kt:78-83 | app/src/main/kotlin/com/ghost/api/GemmaNotificationListener.kt:240-245 — 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.
Low cohesion: UiMacroToolSet (LCOM4 5) app/src/main/kotlin/com/ghost/api/hardware/UiMacroToolSet.kt:9— UiMacroToolSet's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: FileToolSet (LCOM4 4) app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:23— FileToolSet's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
GhostAgent.processUserMessage (cyclomatic 149) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:392— GhostAgent.processUserMessage has cyclomatic complexity 149 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SettingsDialogKt.SettingsDialog (cyclomatic 146) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:48— SettingsDialogKt.SettingsDialog has cyclomatic complexity 146 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GemmaService.initialize (cyclomatic 80) app/src/main/kotlin/com/ghost/api/GemmaService.kt:933— GemmaService.initialize has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GhostAgent.tryExecuteFallbackTool (cyclomatic 65) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1358— GhostAgent.tryExecuteFallbackTool has cyclomatic complexity 65 (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.
QrCodeGenerator.encodeMatrix (cyclomatic 63) app/src/main/kotlin/com/ghost/api/skills/QrCodeGenerator.kt:50— QrCodeGenerator.encodeMatrix 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.
MCPServer.executeTool (cyclomatic 62) app/src/main/kotlin/com/ghost/api/mcp/MCPServer.kt:151— MCPServer.executeTool has cyclomatic complexity 62 (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.
GhostMcpTool.parseParams (cyclomatic 52) app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:405— GhostMcpTool.parseParams has cyclomatic complexity 52 (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.
ChatScreenKt.ChatMessageRow (cyclomatic 51) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:394— ChatScreenKt.ChatMessageRow has cyclomatic complexity 51 (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.
GhostDiaryAndCronManager.runDiaryCycleSuspend (cyclomatic 49) app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:249— GhostDiaryAndCronManager.runDiaryCycleSuspend has cyclomatic complexity 49 (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.
SystemVisualizer.init (cyclomatic 48) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:434— SystemVisualizer.init has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GemmaEngine.streamResponse (cyclomatic 47) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:243— GemmaEngine.streamResponse has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SensorFusionManager.registerEnvironmentSensors (cyclomatic 47) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:617— SensorFusionManager.registerEnvironmentSensors has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelDownloader.startDownload (cyclomatic 43) app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:74— ModelDownloader.startDownload 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.
IntentHandler.handleAction (cyclomatic 41) app/src/main/kotlin/com/ghost/api/logic/IntentHandler.kt:16— IntentHandler.handleAction has cyclomatic complexity 41 (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.
OverlayActionRegistry.defaultActionForSlot (cyclomatic 41) app/src/main/kotlin/com/ghost/api/ui/OverlayActionRegistry.kt:123— OverlayActionRegistry.defaultActionForSlot has cyclomatic complexity 41 (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.
ChatScreenKt.InputBar (cyclomatic 40) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1650— ChatScreenKt.InputBar 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.
TimePreprocessor.parseTime (cyclomatic 38) app/src/main/kotlin/com/ghost/api/logic/TimePreprocessor.kt:38— TimePreprocessor.parseTime 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.
IntentBagger.bagIntents (cyclomatic 36) app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:88— IntentBagger.bagIntents has cyclomatic complexity 36 (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.
OverlayActionRegistry.executeAction (cyclomatic 36) app/src/main/kotlin/com/ghost/api/ui/OverlayActionRegistry.kt:229— OverlayActionRegistry.executeAction 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.
SystemToolSet.app (cyclomatic 35) REDACTED:66— SystemToolSet.app has cyclomatic complexity 35 (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.
SystemVisualizer.setActivePeer (cyclomatic 33) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:908— SystemVisualizer.setActivePeer has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: SystemVisualizer.pushEmotionColor (cyclomatic 40) 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.
FastPathRouter.route (cyclomatic 33) app/src/main/kotlin/com/ghost/api/logic/FastPathRouter.kt:88— FastPathRouter.route has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GemmaService.onStartCommand (cyclomatic 32) app/src/main/kotlin/com/ghost/api/GemmaService.kt:219— GemmaService.onStartCommand 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.
SystemToolSet.parseAlarmParams (cyclomatic 32) REDACTED:648— SystemToolSet.parseAlarmParams 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.
AvatarEngine.drawFrame (cyclomatic 29) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:496— AvatarEngine.drawFrame has cyclomatic complexity 29 (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.
AvatarEngine.drawOptionDCubeLattice (cyclomatic 28) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1547— AvatarEngine.drawOptionDCubeLattice 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.
SensorFusionManager.buildContextString (cyclomatic 26) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1424— SensorFusionManager.buildContextString 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.
IntentBagger.matchVolume (cyclomatic 26) app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:339— IntentBagger.matchVolume has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ModelDownloader.findAnyLocalModel (cyclomatic 25) app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:322— ModelDownloader.findAnyLocalModel 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.
TuiCommandEngine.volume (cyclomatic 25) app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt:52— TuiCommandEngine.volume has cyclomatic complexity 25 (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.
AvatarEngine.drawOptionBHexLattice (cyclomatic 25) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1024— AvatarEngine.drawOptionBHexLattice 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.
BaseEdgeView.drawWireframe (cyclomatic 24) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:531— BaseEdgeView.drawWireframe 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.
SystemVisualizer.applyAiBrandColor (cyclomatic 23) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:881— SystemVisualizer.applyAiBrandColor has cyclomatic complexity 23 (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. This is NOT this file's highest cyclomatic complexity: SystemVisualizer.pushEmotionColor (cyclomatic 40) 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.
ChatScreenKt.VoiceMessageBubble (cyclomatic 23) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:850— ChatScreenKt.VoiceMessageBubble has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GhostMcpTool.run_js (cyclomatic 22) app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:170— GhostMcpTool.run_js 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.
GeminiDirectClient.generateContent (cyclomatic 22) app/src/main/kotlin/com/ghost/api/logic/GeminiDirectClient.kt:28— GeminiDirectClient.generateContent 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.
IntentBagger.formatPromptEnvelope (cyclomatic 22) app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:540— IntentBagger.formatPromptEnvelope has cyclomatic complexity 22 (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.
AvatarEngine.drawOptionAOrbitalStar (cyclomatic 22) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:808— AvatarEngine.drawOptionAOrbitalStar 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.
GemmaEngine.initializeInternal (cyclomatic 21) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:117— GemmaEngine.initializeInternal 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.
SystemVisualizer.resolveAudioPlayingApp (cyclomatic 21) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:217— SystemVisualizer.resolveAudioPlayingApp 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. This is NOT this file's highest cyclomatic complexity: SystemVisualizer.pushEmotionColor (cyclomatic 40) 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.
TuiCommandEngine.dispatchMediaAction (cyclomatic 21) app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt:247— TuiCommandEngine.dispatchMediaAction has cyclomatic complexity 21 (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.
IntentBagger.matchAppLaunch (cyclomatic 21) app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:255— IntentBagger.matchAppLaunch 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.
FlavorTexts.pick (cyclomatic 21) app/src/main/kotlin/com/ghost/api/ui/GhostWorkIndicatorOverlay.kt:161— FlavorTexts.pick has cyclomatic complexity 21 (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.
GemmaAccessibilityService.getSemanticScreenDump (cyclomatic 20) app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:48— GemmaAccessibilityService.getSemanticScreenDump 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.
GhostMcpTool.executeMcpAction (cyclomatic 20) app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:338— GhostMcpTool.executeMcpAction has cyclomatic complexity 20 (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.
SystemVisualizer.extractPaletteFromBitmap (cyclomatic 20) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:711— SystemVisualizer.extractPaletteFromBitmap 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. This is NOT this file's highest cyclomatic complexity: SystemVisualizer.pushEmotionColor (cyclomatic 40) 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.
SensorFusionManager.getConnectivityState (cyclomatic 20) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1175— SensorFusionManager.getConnectivityState 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.
AvatarEngine.drawOptionCDeltaTunnel (cyclomatic 20) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1327— AvatarEngine.drawOptionCDeltaTunnel 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.
FileToolSet.search_files (cyclomatic 19) app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:78— FileToolSet.search_files 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. This is NOT this file's highest cyclomatic complexity: FileToolSet.open_file (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.
GemmaEngine.generateOneShot (cyclomatic 18) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:572— GemmaEngine.generateOneShot 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.
SystemToolSet.parseDurationSeconds (cyclomatic 18) REDACTED:530— SystemToolSet.parseDurationSeconds has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.html.fetchWikiFuzzyAndInfobox (cyclomatic 18) app/src/main/assets/skills/query-wikipedia/scripts/index.html:29— index.html.fetchWikiFuzzyAndInfobox has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GemmaService.processQuery (cyclomatic 17) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1543— GemmaService.processQuery 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.
SystemVisualizer.onForegroundAppChanged (cyclomatic 17) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:758— SystemVisualizer.onForegroundAppChanged has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: SystemVisualizer.pushEmotionColor (cyclomatic 40) 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.
TuiCommandEngine.status (cyclomatic 17) app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt:148— TuiCommandEngine.status 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.
GhostDiaryAndCronManager.scheduleNextDiaryAlarm (cyclomatic 17) app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:83— GhostDiaryAndCronManager.scheduleNextDiaryAlarm 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.
Constants.readMaxSocThermalCelsius (cyclomatic 16) app/src/main/kotlin/com/ghost/api/Constants.kt:31— Constants.readMaxSocThermalCelsius 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.
GemmaService.onCreate (cyclomatic 16) app/src/main/kotlin/com/ghost/api/GemmaService.kt:398— GemmaService.onCreate 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.
SensorFusionManager.getNetworkState (cyclomatic 16) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1017— SensorFusionManager.getNetworkState 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.
BaseEdgeView.drawBoom (cyclomatic 16) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:443— BaseEdgeView.drawBoom 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.
EdgeNubOverlay.onTouchEvent (cyclomatic 16) app/src/main/kotlin/com/ghost/api/ui/EdgeNubOverlay.kt:162— EdgeNubOverlay.onTouchEvent 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.
ChatScreenKt.CompactToolCard (cyclomatic 16) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1446— ChatScreenKt.CompactToolCard 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.
TodoComment app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1275— // TODO: Read location asynchronously and cache 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.
SettingsDialogKt.SettingsDialog (cognitive 399) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:48— SettingsDialogKt.SettingsDialog has cognitive complexity 399 (threshold 15). Drivers by points: if/else 188 (341 pts), loops 13 (26 pts), match/switch 7 (23 pts), boolean chains 8, error handling 1 (nesting depth added 182). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GhostAgent.processUserMessage (cognitive 298) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:392— GhostAgent.processUserMessage has cognitive complexity 298 (threshold 15). Drivers by points: if/else 118 (236 pts), boolean chains 45, error handling 6 (12 pts), loops 1 (5 pts) (nesting depth added 128). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GemmaService.initialize (cognitive 146) app/src/main/kotlin/com/ghost/api/GemmaService.kt:933— GemmaService.initialize has cognitive complexity 146 (threshold 15). Drivers by points: if/else 64 (104 pts), boolean chains 21, error handling 4 (8 pts), loops 4 (7 pts), match/switch 3 (6 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QrCodeGenerator.encodeMatrix (cognitive 112) app/src/main/kotlin/com/ghost/api/skills/QrCodeGenerator.kt:50— QrCodeGenerator.encodeMatrix has cognitive complexity 112 (threshold 15). Drivers by points: if/else 26 (55 pts), loops 33 (49 pts), boolean chains 8 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GemmaEngine.streamResponse (cognitive 96) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:243— GemmaEngine.streamResponse has cognitive complexity 96 (threshold 15). Drivers by points: if/else 38 (69 pts), error handling 8 (20 pts), boolean chains 6, loops 1 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemVisualizer.init (cognitive 89) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:434— SystemVisualizer.init has cognitive complexity 89 (threshold 15). Drivers by points: if/else 45 (74 pts), boolean chains 9, error handling 3 (5 pts), 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.
GhostDiaryAndCronManager.runDiaryCycleSuspend (cognitive 84) app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:249— GhostDiaryAndCronManager.runDiaryCycleSuspend has cognitive complexity 84 (threshold 15). Drivers by points: if/else 51 (67 pts), boolean chains 9, error handling 6 (7 pts), match/switch 1 (nesting depth added 17). 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.
GeminiDirectClient.generateContent (cognitive 83) app/src/main/kotlin/com/ghost/api/logic/GeminiDirectClient.kt:28— GeminiDirectClient.generateContent has cognitive complexity 83 (threshold 15). Drivers by points: if/else 19 (68 pts), loops 3 (9 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 57). 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.
ChatScreenKt.ChatMessageRow (cognitive 82) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:394— ChatScreenKt.ChatMessageRow has cognitive complexity 82 (threshold 15). Drivers by points: if/else 56 (68 pts), boolean chains 7, match/switch 3 (4 pts), error handling 1 (3 pts) (nesting depth added 15). 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.
SensorFusionManager.registerEnvironmentSensors (cognitive 80) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:617— SensorFusionManager.registerEnvironmentSensors has cognitive complexity 80 (threshold 15). Drivers by points: if/else 28 (63 pts), boolean chains 16, match/switch 1 (nesting depth added 35). 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.
ModelDownloader.startDownload (cognitive 63) app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:74— ModelDownloader.startDownload has cognitive complexity 63 (threshold 15). Drivers by points: if/else 29 (44 pts), boolean chains 11, error handling 5, loops 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.
FastPathRouter.route (cognitive 63) app/src/main/kotlin/com/ghost/api/logic/FastPathRouter.kt:88— FastPathRouter.route has cognitive complexity 63 (threshold 15). Drivers by points: if/else 25 (46 pts), error handling 3 (11 pts), boolean chains 5, match/switch 1 (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.
GemmaService.onStartCommand (cognitive 59) app/src/main/kotlin/com/ghost/api/GemmaService.kt:219— GemmaService.onStartCommand has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (45 pts), error handling 3 (10 pts), boolean chains 3, match/switch 1 (nesting depth added 29). 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.
ChatScreenKt.InputBar (cognitive 59) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1650— ChatScreenKt.InputBar has cognitive complexity 59 (threshold 15). Drivers by points: if/else 30 (41 pts), match/switch 5 (10 pts), boolean chains 8 (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.
GhostAgent.tryExecuteFallbackTool (cognitive 51) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1358— GhostAgent.tryExecuteFallbackTool has cognitive complexity 51 (threshold 15). Drivers by points: if/else 24 (40 pts), boolean chains 5, match/switch 3 (4 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.
IntentBagger.bagIntents (cognitive 49) app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:88— IntentBagger.bagIntents has cognitive complexity 49 (threshold 15). Drivers by points: if/else 32 (40 pts), boolean chains 9 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
BaseEdgeView.drawWireframe (cognitive 48) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:531— BaseEdgeView.drawWireframe has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 6, loops 2 (3 pts), match/switch 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.
SystemVisualizer.resolveAudioPlayingApp (cognitive 47) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:217— SystemVisualizer.resolveAudioPlayingApp has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (24 pts), error handling 5 (14 pts), loops 2 (5 pts), boolean chains 4 (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.
SystemVisualizer.setActivePeer (cognitive 44) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:908— SystemVisualizer.setActivePeer has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23 (34 pts), boolean chains 9, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimePreprocessor.parseTime (cognitive 44) app/src/main/kotlin/com/ghost/api/logic/TimePreprocessor.kt:38— TimePreprocessor.parseTime has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 19, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AvatarEngine.drawOptionBHexLattice (cognitive 44) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1024— AvatarEngine.drawOptionBHexLattice has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20 (31 pts), loops 5 (7 pts), match/switch 2 (5 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.
AvatarEngine.drawFrame (cognitive 42) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:496— AvatarEngine.drawFrame has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (20 pts), match/switch 5 (11 pts), boolean chains 9, error handling 1 (2 pts) (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.
GemmaEngine.initializeInternal (cognitive 40) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:117— GemmaEngine.initializeInternal has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (22 pts), error handling 6 (13 pts), boolean chains 3, loops 1, match/switch 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.
SystemToolSet.parseAlarmParams (cognitive 40) REDACTED:648— SystemToolSet.parseAlarmParams has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 13 (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.
SensorFusionManager.buildContextString (cognitive 39) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1424— SensorFusionManager.buildContextString has cognitive complexity 39 (threshold 15). Drivers by points: if/else 28 (35 pts), boolean chains 4 (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, 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.
BaseEdgeView.drawHex (cognitive 39) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:660— BaseEdgeView.drawHex has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 2, 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.
AvatarEngine.drawOptionDCubeLattice (cognitive 38) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1547— AvatarEngine.drawOptionDCubeLattice has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (26 pts), match/switch 3 (6 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
OverlayActionRegistry.executeAction (cognitive 38) app/src/main/kotlin/com/ghost/api/ui/OverlayActionRegistry.kt:229— OverlayActionRegistry.executeAction has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (30 pts), error handling 3 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelDownloader.findAnyLocalModel (cognitive 37) app/src/main/kotlin/com/ghost/api/ModelDownloader.kt:322— ModelDownloader.findAnyLocalModel has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 9, loops 2 (3 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GemmaNotificationListener.getActiveNotificationsContext (cognitive 35) app/src/main/kotlin/com/ghost/api/GemmaNotificationListener.kt:228— GemmaNotificationListener.getActiveNotificationsContext has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IntentHandler.handleAction (cognitive 35) app/src/main/kotlin/com/ghost/api/logic/IntentHandler.kt:16— IntentHandler.handleAction has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 3 (7 pts), loops 2 (5 pts), boolean chains 3, 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.
AvatarEngine.drawOptionCDeltaTunnel (cognitive 35) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1327— AvatarEngine.drawOptionCDeltaTunnel has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (28 pts), loops 3, boolean chains 2, match/switch 1 (2 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, 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.
FileToolSet.search_files (cognitive 34) app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:78— FileToolSet.search_files has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 2, error handling 2, 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.
AvatarEngine.drawOptionAOrbitalStar (cognitive 34) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:808— AvatarEngine.drawOptionAOrbitalStar has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (20 pts), match/switch 3 (9 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.
SystemToolSet.app (cognitive 33) REDACTED:66— SystemToolSet.app has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (6 pts), error handling 2 (4 pts), boolean chains 1, match/switch 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.
BaseEdgeView.drawBoom (cognitive 33) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:443— BaseEdgeView.drawBoom has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23 (30 pts), loops 3 (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, 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.
InputOverlay.setupRadialPuck (cognitive 32) app/src/main/kotlin/com/ghost/api/ui/InputOverlay.kt:332— InputOverlay.setupRadialPuck has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (31 pts), match/switch 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.
GemmaAccessibilityService.getSemanticScreenDump (cognitive 31) app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:48— GemmaAccessibilityService.getSemanticScreenDump has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 6, loops 3 (4 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.
ChatScreenKt.VoiceMessageBubble (cognitive 30) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:850— ChatScreenKt.VoiceMessageBubble has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (16 pts), error handling 5 (6 pts), boolean chains 5, 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, 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.
GhostMcpTool.run_js (cognitive 29) app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:170— GhostMcpTool.run_js has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 6, error handling 3 (5 pts), match/switch 1 (2 pts) (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.
SystemVisualizer.extractPaletteFromBitmap (cognitive 29) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:711— SystemVisualizer.extractPaletteFromBitmap has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, match/switch 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.
IntentBagger.matchAppLaunch (cognitive 29) app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:255— IntentBagger.matchAppLaunch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemVisualizer.onForegroundAppChanged (cognitive 28) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:758— SystemVisualizer.onForegroundAppChanged has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 4 (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.
TuiCommandEngine.status (cognitive 28) app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt:148— TuiCommandEngine.status has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 3, error handling 1, match/switch 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.
Constants.readMaxSocThermalCelsius (cognitive 27) app/src/main/kotlin/com/ghost/api/Constants.kt:31— Constants.readMaxSocThermalCelsius has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GemmaEngine.generateOneShot (cognitive 27) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:572— GemmaEngine.generateOneShot has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (13 pts), error handling 7 (12 pts), boolean chains 1, loops 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.
GemmaService.processQuery (cognitive 27) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1543— GemmaService.processQuery has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (24 pts), match/switch 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.
GhostMcpTool.parseParams (cognitive 26) app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:405— GhostMcpTool.parseParams has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 6, error handling 1 (2 pts), loops 1 (2 pts), match/switch 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.
GhostAgent.buildSystemPrompt (cognitive 25) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1316— GhostAgent.buildSystemPrompt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (22 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.
IntentBagger.matchVolume (cognitive 24) app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt:339— IntentBagger.matchVolume has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 11, match/switch 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.
EdgeNubOverlay.onTouchEvent (cognitive 24) app/src/main/kotlin/com/ghost/api/ui/EdgeNubOverlay.kt:162— EdgeNubOverlay.onTouchEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 1 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 11). 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.
GhostDiaryAndCronManager.scheduleNextDiaryAlarm (cognitive 22) app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:83— GhostDiaryAndCronManager.scheduleNextDiaryAlarm has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), match/switch 2 (3 pts), boolean chains 1, error handling 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.
TTSManager.doSmartSpeak (cognitive 21) app/src/main/kotlin/com/ghost/api/services/TTSManager.kt:554— TTSManager.doSmartSpeak has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EdgeLightsManager.isLandscape (cognitive 21) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:48— EdgeLightsManager.isLandscape has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 3 (7 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.
GemmaNotificationListener.onNotificationPosted (cognitive 20) app/src/main/kotlin/com/ghost/api/GemmaNotificationListener.kt:71— GemmaNotificationListener.onNotificationPosted has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, 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.
SystemVisualizer.extractColorsFromMetadata (cognitive 20) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:660— SystemVisualizer.extractColorsFromMetadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 1 (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.
SensorFusionManager.getNetworkState (cognitive 20) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1017— SensorFusionManager.getNetworkState has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, error handling 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SensorFusionManager.getConnectivityState (cognitive 20) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1175— SensorFusionManager.getConnectivityState has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 6 (9 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPServer.executeTool (cognitive 20) app/src/main/kotlin/com/ghost/api/mcp/MCPServer.kt:151— MCPServer.executeTool has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, error handling 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillManager.loadSkillsFromDir (cognitive 20) app/src/main/kotlin/com/ghost/api/skills/SkillManager.kt:115— SkillManager.loadSkillsFromDir has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AvatarEngine.onAudioData (cognitive 20) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:377— AvatarEngine.onAudioData has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseEdgeView.drawBars (cognitive 20) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:390— BaseEdgeView.drawBars has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 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.
BaseEdgeView.drawHexCell (cognitive 20) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:720— BaseEdgeView.drawHexCell has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MainActivity.checkAndRequestPermissions (cognitive 19) app/src/main/kotlin/com/ghost/api/MainActivity.kt:490— MainActivity.checkAndRequestPermissions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (19 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.
SessionMemoryCompactor.compactOldMessages (cognitive 19) app/src/main/kotlin/com/ghost/api/agent/SessionMemoryCompactor.kt:15— SessionMemoryCompactor.compactOldMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, match/switch 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.
SensorFusionManager.readThermalZoneByType (cognitive 19) app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt:1147— SensorFusionManager.readThermalZoneByType has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (5 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.
SystemToolSet.parseDurationSeconds (cognitive 19) REDACTED:530— SystemToolSet.parseDurationSeconds has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, match/switch 2 (4 pts), boolean chains 3, loops 2 (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.
GemmaAccessibilityService.performClick (cognitive 18) app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:174— GemmaAccessibilityService.performClick has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 2, 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.
GemmaEngine.truncateRepetition (cognitive 18) app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:661— GemmaEngine.truncateRepetition has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 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.
GemmaService.onCreate (cognitive 18) app/src/main/kotlin/com/ghost/api/GemmaService.kt:398— GemmaService.onCreate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, error handling 4 (5 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GhostAgent.getSanitizedRecentMessages (cognitive 18) app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:284— GhostAgent.getSanitizedRecentMessages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 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.
HardwarePropertiesManager.pollSysfsThermal (cognitive 18) app/src/main/kotlin/com/ghost/api/hardware/HardwarePropertiesManager.kt:72— HardwarePropertiesManager.pollSysfsThermal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (5 pts), boolean chains 1, 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.
TuiCommandEngine.volume (cognitive 18) app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt:52— TuiCommandEngine.volume has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 4, match/switch 3 (4 pts), error handling 1 (2 pts) (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.
TuiCommandEngine.dispatchMediaAction (cognitive 18) app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt:247— TuiCommandEngine.dispatchMediaAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (4 pts), match/switch 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.
AudioRecorder.record (cognitive 17) app/src/main/kotlin/com/ghost/api/hardware/AudioRecorder.kt:46— AudioRecorder.record has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 3 (4 pts), loops 2, boolean chains 1 (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.
FileToolSet.scoreCandidate (cognitive 17) app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:43— FileToolSet.scoreCandidate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AiPhonebook.queryPeer (cognitive 17) app/src/main/kotlin/com/ghost/api/logic/AiPhonebook.kt:218— AiPhonebook.queryPeer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 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.
ContextManager.buildSystemPrompt (cognitive 17) app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:70— ContextManager.buildSystemPrompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (17 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AvatarEngine.drawOscilloscopeFlower (cognitive 17) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:636— AvatarEngine.drawOscilloscopeFlower has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 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.
ChatScreenKt.buildMarkdownAnnotatedString (cognitive 17) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1559— ChatScreenKt.buildMarkdownAnnotatedString has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.fetchWikiFuzzyAndInfobox (cognitive 17) app/src/main/assets/skills/query-wikipedia/scripts/index.html:29— index.html.fetchWikiFuzzyAndInfobox has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 1, match/switch 1 (nesting depth added 3). Of this number, 13 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.
GemmaService.openUrl (cognitive 16) app/src/main/kotlin/com/ghost/api/GemmaService.kt:827— GemmaService.openUrl has cognitive complexity 16 (threshold 15). Drivers by points: error handling 5 (7 pts), if/else 7, boolean chains 2 (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.
MainActivity.handlePickedImages (cognitive 16) app/src/main/kotlin/com/ghost/api/MainActivity.kt:427— MainActivity.handlePickedImages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (2 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.
GhostMcpTool.executeMcpAction (cognitive 16) app/src/main/kotlin/com/ghost/api/agent/GhostMcpTool.kt:338— GhostMcpTool.executeMcpAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 4 (6 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.
GhostForegroundNotificationController.buildNotification (cognitive 16) app/src/main/kotlin/com/ghost/api/service/GhostForegroundNotificationController.kt:177— GhostForegroundNotificationController.buildNotification has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 4, error handling 1 (2 pts), match/switch 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.
TTSManager.smartSpeak (cognitive 16) app/src/main/kotlin/com/ghost/api/services/TTSManager.kt:504— TTSManager.smartSpeak has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 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.
OverlayActionRegistry.defaultActionForSlot (cognitive 16) app/src/main/kotlin/com/ghost/api/ui/OverlayActionRegistry.kt:123— OverlayActionRegistry.defaultActionForSlot has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 8 (15 pts), if/else 1 (nesting depth added 7). 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.
ChatScreenKt.CompactToolCard (cognitive 16) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:1446— ChatScreenKt.CompactToolCard has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Change coupling: AvatarWallpaperService.kt ↔ EdgeLightsManager.kt app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1— `app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt` and `app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt` change together 55% of the time (6 of the 11 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). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `aaa39e7d` perf(overlay): pause wallpaper render loop during overlay summon & ha…; `5b75cb09` feat: complete punch list of 8 dogfooding and visual audit items; `10a66d23` Refine edge lights chevrons (90-deg angle, 5-tier staircase) and Seve… — run `git show` on any of them.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:808— app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:808-1004 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1024-1307 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1327-1536 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1547-1769 — 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.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×1
Edited copy of a member (27 corresponding lines) REDACTED:178— REDACTED:178-205 | REDACTED:211-237 — 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· Edited copy of a member (21 corresponding lines) · ×1
Edited copy of a member (21 corresponding lines) app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:203— app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:203-233 | app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:239-259 — These two members are one piece of code written twice and then edited apart: 21 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 (15 corresponding lines) · ×1
Edited copy of a member (15 corresponding lines) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1356— app/src/main/kotlin/com/ghost/api/GemmaService.kt:1356-1376 | app/src/main/kotlin/com/ghost/api/MainActivity.kt:301-315 — These two members are one piece of code written twice and then edited apart: 15 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 (20 corresponding lines) · ×1
Edited copy of a member (20 corresponding lines) app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:58— app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:58-77 | app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt:155-174 — These two members are one piece of code written twice and then edited apart: 20 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 copies of one member (3 members, 11+ corresponding lines) · ×1
Edited copies of one member (3 members, 11+ corresponding lines) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1787— app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1787-1797 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1802-1812 | app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:764-774 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×1
Edited copy of a member (10 corresponding lines) app/src/main/kotlin/com/ghost/api/ui/InputOverlay.kt:577— app/src/main/kotlin/com/ghost/api/ui/InputOverlay.kt:577-589 | app/src/main/kotlin/com/ghost/api/ui/VoiceInputController.kt:240-249 — These two members are one piece of code written twice and then edited apart: 10 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 (9 corresponding lines) · ×1
Edited copy of a member (9 corresponding lines) app/src/main/kotlin/com/ghost/api/ui/OverlayManager.kt:316— app/src/main/kotlin/com/ghost/api/ui/OverlayManager.kt:316-324 | app/src/main/kotlin/com/ghost/api/ui/OverlayManager.kt:326-334 — These two members are one piece of code written twice and then edited apart: 9 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 copies of one member (3 members, 8+ corresponding lines) · ×1
Edited copies of one member (3 members, 8+ corresponding lines) app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:1022— app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:1022-1029 | app/src/main/kotlin/com/ghost/api/audio/SystemVisualizer.kt:1031-1038 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:624-634 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, 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 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. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (23 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2067— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2067-2089 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2159-2181 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2067` 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 (20 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1028— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1028-1047 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1140-1159 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1028` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–16 lines × 2) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1357— app/src/main/kotlin/com/ghost/api/GemmaService.kt:1357-1372 | app/src/main/kotlin/com/ghost/api/MainActivity.kt:302-311 — 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 `app/src/main/kotlin/com/ghost/api/GemmaService.kt:1357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–16 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:708— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:708-721 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1221-1236 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:708` 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 (15 lines × 3) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1923— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1923-1937 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2075-2089 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2167-2181 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1923` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–14 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:737— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:737-749 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1786-1799 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:737` 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–12 lines × 3) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1143— app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1143-1154 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1452-1462 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1610-1620 — 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 (10–11 lines × 3) app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:201— app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:201-211 | app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:234-243 | app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:286-295 — 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 `app/src/main/kotlin/com/ghost/api/GemmaAccessibilityService.kt:201` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (22–23 lines × 2) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1424— app/src/main/kotlin/com/ghost/api/GemmaService.kt:1424-1446 | app/src/main/kotlin/com/ghost/api/GemmaService.kt:1504-1525 — 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 `app/src/main/kotlin/com/ghost/api/GemmaService.kt:1424` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:919— app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:919-927 | app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:958-967 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/ChatScreen.kt:919` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:949— app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:949-956 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1143-1150 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1452-1459 | app/src/main/kotlin/com/ghost/api/ui/AvatarWallpaperService.kt:1610-1617 — 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 (3–7 lines × 3) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:463— app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:463-469 | app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:485-491 | app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:504-506 — 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 `app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:463` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:462` calls `coerceIn`, `toFloat` and `app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:504` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:204— app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:204-209 | app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:240-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. Read the line range as the matched WINDOW rather than a finished unit: at `app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:204` 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, `app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:211` calls `isProtectedModelFile`, `mapOf` and `app/src/main/kotlin/com/ghost/api/hardware/FileToolSet.kt:247` 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 (4–6 lines × 3) app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:453— app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:453-458 | app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:475-480 | app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:498-501 — 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 `app/src/main/kotlin/com/ghost/api/ui/EdgeLightsManager.kt:453` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) REDACTED:674— REDACTED:674-678 | REDACTED:689-693 | REDACTED:713-717 — 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 `REDACTED: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. 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 (14 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2094— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2094-2107 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2186-2199 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:2094` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1013— app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1013-1022 | app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1125-1134 — 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 `app/src/main/kotlin/com/ghost/api/ui/screens/SettingsDialog.kt:1013` 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) app/src/main/kotlin/com/ghost/api/GemmaService.kt:1465— app/src/main/kotlin/com/ghost/api/GemmaService.kt:1465-1473 | app/src/main/kotlin/com/ghost/api/MainActivity.kt:456-463 — 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 `app/src/main/kotlin/com/ghost/api/GemmaService.kt:1465` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) app/src/main/kotlin/com/ghost/api/GemmaService.kt:327— app/src/main/kotlin/com/ghost/api/GemmaService.kt:327-334 | app/src/main/kotlin/com/ghost/api/GemmaService.kt:1465-1472 | app/src/main/kotlin/com/ghost/api/MainActivity.kt:456-463 — 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 `app/src/main/kotlin/com/ghost/api/GemmaService.kt:327` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
No structured logging — No logging call was found in the 79 JavaScript/TypeScript, JVM production file(s) this check read across 2 module(s). Each was searched for its ecosystem's logging libraries (JVM: SLF4J, Log4j2, java.util.logging, Logback, kotlin-logging, scala-logging; JavaScript/TypeScript: pino, winston, bunyan, log4js, loglevel, consola, the NestJS Logger) and for a call on a receiver named `log`/`logger` (or ending in `Logger`/`_logger`) with a level verb. It cannot see logging through a repo-local wrapper named otherwise, or in source it did not read — this is 'no logging found by this walk', not a verdict that nothing here logs. If it is right, production issues will be hard to diagnose.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/Constants.kt:93— `getDeviceRamGb` swallows every exception into `8.0` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/GemmaEngine.kt:81— `getActiveTokenCount` swallows every exception into `0` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1609— `getBatteryLevel` swallows every exception into `100` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/database/MemoryManager.kt:100— `tailMemoryLog` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/database/MemoryManager.kt:116— `grepMemoryLog` swallows every exception into `emptyList()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/hardware/DeviceHardwareSpecs.kt:24— `getSystemProp` swallows every exception into `""` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:32— `buildContext` swallows every exception into `""` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:62— `buildHardwareBundle` swallows every exception into `"Device: Android Smartphone\nRuntime: GHOST On-Device Agentic Harness\nSensors: Battery, System, Environment, Network, Notifications, Motion, Media, Location"` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Silent fallback default in catch app/src/main/kotlin/com/ghost/api/logic/ContextManager.kt:152— `resolveDeviceCallSign` swallows every exception into `"Gemma"` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Duplicated predicate app/src/main/kotlin/com/ghost/api/GemmaService.kt:828— `!url.startsWith("http://", ignoreCase = true) && !url.startsWith("https://", ignoreCase = true)` appears character-identically in 2 files — app/src/main/kotlin/com/ghost/api/GemmaService.kt, app/src/main/kotlin/com/ghost/api/logic/IntentBagger.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate app/src/main/kotlin/com/ghost/api/GemmaService.kt:1080— `(name.endsWith(".litertlm", ignoreCase = true) || name.endsWith(".gguf", ignoreCase = true) || name.endsWith(".nexa", ignoreCase = true)) &&…` appears character-identically in 2 files — app/src/main/kotlin/com/ghost/api/GemmaService.kt, app/src/main/kotlin/com/ghost/api/ModelDownloader.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate app/src/main/kotlin/com/ghost/api/Constants.kt:34— `file.isDirectory && file.name.startsWith("thermal_zone")` appears character-identically in 2 files — app/src/main/kotlin/com/ghost/api/Constants.kt, app/src/main/kotlin/com/ghost/api/hardware/SensorFusionManager.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate app/src/main/kotlin/com/ghost/api/GemmaService.kt:767— `method == Constants.SUMMON_METHOD_EDGE_NUB || method == Constants.SUMMON_METHOD_BOTH` appears character-identically in 2 files — app/src/main/kotlin/com/ghost/api/GemmaService.kt, app/src/main/kotlin/com/ghost/api/ui/OverlayManager.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt:163— `status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL` appears character-identically in 2 files — app/src/main/kotlin/com/ghost/api/hardware/TuiCommandEngine.kt, app/src/main/kotlin/com/ghost/api/service/GhostDiaryAndCronManager.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Fat interface: AgentPlatformCallbacks (22 abstract methods) app/src/main/kotlin/com/ghost/api/agent/AgentPlatformCallbacks.kt:6— `AgentPlatformCallbacks` declares 22 abstract methods: `showThinking`, `cancelThinking`, `showResponse`, `onMessageAdded`, `onThoughtUpdated`, `onThoughtComplete`, `onEmotionSignal`, `updateNotification`, `showConfirmation`, `speak`, `stopSpeaking`, `storeConversationTurn`, `writeDiaryEntry`, `unloadEngine`, `reloadEngine`, `isEngineLoaded`, `getCurrentThermalState`, `getThermalDelayMs`, `broadcastMoodChange`, `getRecentConversationHistory`, `createCalendarEvent`, `getSkillsList`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
No ADRs found app/build.gradle.kts:6— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `app/build.gradle.kts` makes this repository a deployable product (line 6).
D21 · Naming Consistency· `cleanForTTS` spells `TTS` where 43 names in the project spell it `Tts` · ×1
`cleanForTTS` spells `TTS` where 43 names in the project spell it `Tts` app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1691— 43 of 44 names in project app spell the token `Tts` (43 of 44; unit: names in project app containing `Tts`). Peers: GhostAgent.toolSpokeFlavorTts (app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:121); GhostAgent.recordFastPathTurn(spokenTts) (app/src/main/kotlin/com/ghost/api/agent/GhostAgent.kt:1722); HandledFastPath.spokenTts (app/src/main/kotlin/com/ghost/api/logic/FastPathRouter.kt:27); ActionFlavorTexts.appLaunchTts (app/src/main/kotlin/com/ghost/api/logic/GenuinePeoplePersonality.kt:65); ActionFlavorTexts.browserLaunchTts (app/src/main/kotlin/com/ghost/api/logic/GenuinePeoplePersonality.kt:87). Rename to `cleanForTts`. [rule N6]
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
No SAST — No static application security testing detected. For this repository's stack, add spotbugs with find-sec-bugs (or `semgrep --config=auto`, which runs on any language) — this repository has no CI pipeline yet, so run it locally to clear the existing findings, then make it a step of the first workflow you add so a regression fails the build. What was searched, so you can tell an absence from a miss: the 0 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.
No dependency-update automation app/build.gradle.kts:143— `app/build.gradle.kts` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
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.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Gradle build (build.gradle/build.gradle.kts) — not scanned yet).
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
provenance: not applicable — No CI/build pipeline found (.github/.forgejo/.gitea workflows, .circleci, .buildkite, .woodpecker, .teamcity, .gitlab-ci.yml, .travis.yml, bitbucket-pipelines.yml, .drone.yml, .cirrus.yml, .woodpecker.yml, appveyor.yml, azure-pipelines*.yml, .pipelines/, .vsts-ci/, .azuredevops/, Jenkinsfile); there is no build to attest provenance for.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
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.
none (dependency manifest found, not scanned for vulnerabilities here)
—
none (dependency manifest found, not scanned for vulnerabilities here): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Gradle build (build.gradle/build.gradle.kts) — not scanned yet).
0
—
Run 01a1eb1c-1f23-72c5-a5eb-913e2856b833 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Warnings: 319 · Recommendations: 21 · Info: 120 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 20:04 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.