Public report of kellyvv/PhoneClaw, published 15 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 report Measured 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, 15 November 2026, 02:30 UTC · Survey ID cd_028b64432d4a487db20d4fe3a44eef00

kellyvv/PhoneClaw

Measured 15 November 2026, 02:29 UTC, at code version 31bf61d

CAI score 41out of 100 Weak
CriticalWeakAdequateStrongExemplary
Up 4 since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A medium codebase: 66,168 lines of product code in 8 projects, tests not counted · Estimated rebuild effort: about 0.4 person-years · Weakest lens: Event-Driven, 10

Findings by how serious they are

13 critical 715 serious 56 minor

24 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

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
15 November 2026, 02:29 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 ▸

42of 42 dimensions measured by tools.
768of 784 findings point to an exact file and line, so you can open each one in the code. The other 16 concern the repository as a whole, such as missing documentation.
42dimensions across 7 lenses, read from 66,168 lines of product code in 8 projects.
Chapters

Executive summary

kellyvv/PhoneClaw falls short of our standard for production because it has message handlers that wait for another service. It scores 41 out of 100 and is rated Weak, and five of its 13 critical findings are security problems.

Event-Driven, at 10, is the weakest lens and counts most in the score. The best first step is stopping the event handlers from waiting on other services, worth about 27 points. Raising Event-Driven to 70 would lift the score to about 67.

Four pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. One password or key is open to anyone who can read the repository, and five sets of files in separate parts keep changing together, which points to hidden dependencies. Pinning each tool to an exact version, replacing the exposed password or key and making the hidden dependencies explicit would close these risks. Letting the handler publish a message instead of waiting for the reply would take care of the two message handlers that wait for another service.

The product code is 66,168 lines, about €60,000 to rebuild. Two of our security checks couldn't finish, among them the one for known security holes in its packages, so those results are missing, not clean passes.

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 for The 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.
Event-Driven 10 · counts for 46%Production Readiness 62 · counts for 25%Code Health 68 · counts for 14%Performance 70 · counts for 8%Maturity 73 · counts for 4%Architecture 94 · counts for 2%Security and Compliance 95 · counts for 1%

If Event-Driven rose from 10 to 70, the lowest score rated Strong, the score would rise from 41 to about 67.

Code composition: what the lines of code are
Product code 94%Tests 6%
New since the last survey: 137 findings

These 137 critical or serious findings weren't in the previous survey, on 29 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Code Duplication · Edited copy of a member (110 corresponding lines) Live/Audio/LiveAudioIO.swift
  • Code Duplication · Edited copy of a member (146 corresponding lines) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift
  • Code Duplication · Edited copy of a member (57 corresponding lines) UI/AudioUI.swift
  • Code Duplication · Edited copy of a member (85 corresponding lines) LLM/Backends/LiteRT/LiteRTBackend.swift
  • Code Duplication · Edited copy of a member (55 corresponding lines) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift
  • Code Duplication · Edited copy of a member (92 corresponding lines) LLM/PromptBuilder.swift
  • Code Duplication · Edited copy of a member (21 corresponding lines) LLM/Installation/LiteRTModelStore.swift
  • Code Duplication · Edited copy of a member (48 corresponding lines) UI/ContentView.swift
  • Code Duplication · Edited copy of a member (28 corresponding lines) UI/ContentView.swift
  • Code Duplication · Edited copy of a member (31 corresponding lines) LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift
  • Code Duplication · Edited copy of a member (58 corresponding lines) LLM/PromptBuilder.swift
  • Code Duplication · Edited copy of a member (24 corresponding lines) UI/ConfigurationsView.swift
  • Code Duplication · Edited copies of one member (3 members, 74+ corresponding lines) LLM/PromptBuilder.swift
  • Code Duplication · Edited copy of a member (36 corresponding lines) UI/ResponseUI.swift
  • Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Edited copy of a member (27 corresponding lines) Live/VAD/VADService.swift
  • Code Duplication · Edited copy of a member (21 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copy of a member (26 corresponding lines) LLM/MLX/Gemma4/Gemma4Processor.swift
  • Code Duplication · Edited copy of a member (19 corresponding lines) UI/ResponseUI.swift
  • Code Duplication · Edited copy of a member (25 corresponding lines) Live/Audio/LiveAudioIO.swift
  • Code Duplication · Edited copy of a member (14 corresponding lines) LLM/MLX/Gemma4/Gemma4AudioFeatureExtractor.swift
  • Code Duplication · Edited copy of a member (17 corresponding lines) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift
  • Code Duplication · Edited copy of a member (24 corresponding lines) UI/RemoteMacSettingsView.swift
  • Code Duplication · Edited copy of a member (38 corresponding lines) LLM/PromptBuilder.swift
  • Code Duplication · Edited copy of a member (16 corresponding lines) UI/ConfigurationsView.swift
  • Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) LLM/Core/GenerationTransaction.swift
  • Code Duplication · Edited copy of a member (25 corresponding lines) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift
  • Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copy of a member (19 corresponding lines) LLM/MLX/Gemma4/Gemma4LanguageModel.swift
  • Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) LLM/MLX/MLXLocalLLMService.swift
  • Code Duplication · Edited copy of a member (15 corresponding lines) LLM/Core/ModelRuntimeCoordinator.swift
  • Code Duplication · Edited copies of one member (4 members, 21+ corresponding lines) Shared/Audio/SherpaOnnx.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) Skills/SkillLoader.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (19 corresponding lines) Live/Audio/LiveAudioIO.swift
  • Code Duplication · Edited copy of a member (22 corresponding lines) Agent/Engine/ConversationMemoryPolicy.swift
  • Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copy of a member (9 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copy of a member (12 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copy of a member (21 corresponding lines) LLM/Backends/LiteRT/LiteRTBackend.swift
  • Code Duplication · Edited copy of a member (21 corresponding lines) Agent/Engine/Router.swift
  • Code Duplication · Edited copy of a member (19 corresponding lines) LLM/MLX/Installation/LiveModelDefinition.swift
  • Code Duplication · Edited copy of a member (10 corresponding lines) LLM/MLX/Installation/LiveModelDefinition.swift
  • Code Duplication · Edited copy of a member (17 corresponding lines) Shared/Audio/SherpaOnnx.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) LLM/MLX/Installation/LiveDownloadPlanner.swift
  • Code Duplication · Edited copy of a member (10 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) Agent/Engine/EngineLifecycle.swift
  • Code Duplication · Edited copy of a member (12 corresponding lines) LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDToken.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (15 corresponding lines) Shared/Audio/SherpaOnnx.swift
  • Code Duplication · Edited copy of a member (12 corresponding lines) LLM/Backends/Remote/LANBinding.swift
  • Code Duplication · Edited copy of a member (7 corresponding lines) LLM/MLX/Installation/LiveDownloadPlanner.swift
  • Code Duplication · Edited copy of a member (11 corresponding lines) LiveLand/Widget/PhoneClawLiveActivityWidget.swift
  • Code Duplication · Edited copy of a member (6 corresponding lines) LLM/Backends/Remote/LANBinding.swift
  • Code Duplication · Edited copy of a member (11 corresponding lines) LLM/Core/LLMTypes.swift
  • Code Duplication · Edited copy of a member (17 corresponding lines) Shared/Audio/SherpaOnnx.swift
  • Code Duplication · Edited copy of a member (7 corresponding lines) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift
  • Code Duplication · Edited copy of a member (11 corresponding lines) LLM/Core/InferenceService.swift
  • Code Duplication · Edited copy of a member (7 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copy of a member (5 corresponding lines) LLM/MLX/Gemma4/Gemma4VisionModel.swift
  • Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) UI/Theme.swift
  • Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) Shared/Audio/SherpaOnnx.swift
  • Code Duplication · Edited copy of a member (11 corresponding lines) UI/ResponseUI.swift
  • Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) Agent/Engine/ChatAttachments.swift
  • Code Duplication · Edited copy of a member (7 corresponding lines) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift
  • Code Duplication · Edited copy of a member (8 corresponding lines) Agent/Engine/ToolChain.swift
  • Code Duplication · Edited copy of a member (6 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Edited copy of a member (9 corresponding lines) Shared/PCLog.swift
  • Code Duplication · Edited copy of a member (9 corresponding lines) LLM/Backends/LiteRT/LiteRTBackend.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) LLM/MLX/Installation/LiveModelStore.swift
  • Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (9 corresponding lines) LLM/MLX/Installation/LiveModelDownloader.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) LLM/Installation/Download/DownloadManifestStore.swift
  • Code Duplication · Edited copy of a member (6 corresponding lines) UI/ConfigurationsView.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (7 corresponding lines) LLM/Backends/BackendDispatcher.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Edited copies of one member (3 members, 3+ corresponding lines) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Edited copy of a member (5 corresponding lines) LLM/Backends/Remote/LANBinding.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Installation/LiteRTModelStore.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (1 corresponding lines) LLM/Backends/Remote/LANDiscovery.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) Agent/Engine/ToolChain.swift
  • Code Duplication · Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Installation/LiteRTModelStore.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/MLX/Installation/LiveModelDefinition.swift
  • Code Duplication · Edited copy of a member (6 corresponding lines) Live/UI/LiveModeUI.swift
  • Code Duplication · Edited copy of a member (1 corresponding lines) LLM/Backends/Remote/LANDiscovery.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/LLMEngine.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) Agent/Engine/GuardedSkillRouter.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Backends/BackendDispatcher.swift
  • Code Duplication · Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift

We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 142 findings

These 142 critical or serious findings were in the previous survey, on 29 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · HealthMetric.init (cyclomatic 48) Tools/Handlers/Health.swift
  • Cyclomatic Complexity · HealthTools.healthReportRangeCanonical (cyclomatic 41) Tools/Handlers/Health.swift
  • Cyclomatic Complexity · ToolRegistry.authorizationStatus (cyclomatic 36) Tools/AppPermissions.swift
  • Cyclomatic Complexity · Helpers.swift.parseEnglishTimeOnly (cyclomatic 29) Tools/Helpers.swift
  • Cyclomatic Complexity · HealthRange.init (cyclomatic 28) Tools/Handlers/Health.swift
  • Cyclomatic Complexity · HealthTools.healthQueryCanonical (cyclomatic 22) Tools/Handlers/Health.swift
  • Cyclomatic Complexity · CalendarTools.presetRange (cyclomatic 20) Tools/Handlers/Calendar.swift
  • Cyclomatic Complexity · ContactsTools.searchContacts (cyclomatic 20) Tools/Handlers/Contacts.swift
  • Cyclomatic Complexity · HealthTools.healthActivitySummaryCanonical (cyclomatic 20) Tools/Handlers/Health.swift
  • Cyclomatic Complexity · WebTools.searchSuccess (cyclomatic 20) Tools/Handlers/Web.swift
  • Cyclomatic Complexity · CalendarTools.parseCalendarQueryRange (cyclomatic 19) Tools/Handlers/Calendar.swift
  • Cyclomatic Complexity · ClipboardTools.register (cyclomatic 19) Tools/Handlers/Clipboard.swift
  • Cyclomatic Complexity · ContactsTools.upsertCanonical (cyclomatic 18) Tools/Handlers/Contacts.swift
  • Cyclomatic Complexity · MacContactsMock.search (cyclomatic 18) Tools/Handlers/Contacts.swift
  • Cyclomatic Complexity · HealthTools.fetchSleepAnalysisResult (cyclomatic 17) Tools/Handlers/Health.swift
  • Cyclomatic Complexity · WebTools.searchCanonical (cyclomatic 17) Tools/Handlers/Web.swift
  • Cyclomatic Complexity · CalendarTools.dayPartRange (cyclomatic 16) Tools/Handlers/Calendar.swift
  • Cyclomatic Complexity · skillkit.validate_manifest (cyclomatic 16) Tools/SkillKit/skillkit.py
  • Cognitive Complexity · HealthMetric.init (cognitive 48) Tools/Handlers/Health.swift
  • Cognitive Complexity · HealthTools.healthReportRangeCanonical (cognitive 35) Tools/Handlers/Health.swift
  • Cognitive Complexity · Helpers.swift.parseEnglishTimeOnly (cognitive 32) Tools/Helpers.swift
  • Cognitive Complexity · CalendarTools.parseCalendarQueryRange (cognitive 30) Tools/Handlers/Calendar.swift
  • Cognitive Complexity · WebTools.searchCanonical (cognitive 30) Tools/Handlers/Web.swift
  • Cognitive Complexity · HealthRange.init (cognitive 28) Tools/Handlers/Health.swift
  • Cognitive Complexity · ToolRegistry.authorizationStatus (cognitive 24) Tools/AppPermissions.swift
  • Cognitive Complexity · ContactsTools.searchContacts (cognitive 22) Tools/Handlers/Contacts.swift
  • Cognitive Complexity · ContactsTools.upsertCanonical (cognitive 22) Tools/Handlers/Contacts.swift
  • Cognitive Complexity · CalendarTools.presetRange (cognitive 21) Tools/Handlers/Calendar.swift
  • Cognitive Complexity · WebTools.searchSuccess (cognitive 20) Tools/Handlers/Web.swift
  • Cognitive Complexity · HealthTools.fetchSleepAnalysisResult (cognitive 19) Tools/Handlers/Health.swift
  • Cognitive Complexity · ToolRegistry.requestAccess (cognitive 18) Tools/AppPermissions.swift
  • Cognitive Complexity · ClipboardTools.register (cognitive 18) Tools/Handlers/Clipboard.swift
  • Cognitive Complexity · WebTools.splitIntoEvidenceWindows (cognitive 18) Tools/Handlers/Web.swift
  • Cognitive Complexity · Helpers.swift.nextEnglishTimeOnlyDate (cognitive 18) Tools/Helpers.swift
  • Cognitive Complexity · skillkit.validate_manifest (cognitive 18) Tools/SkillKit/skillkit.py
  • Cognitive Complexity · MacContactsMock.search (cognitive 17) Tools/Handlers/Contacts.swift
  • Cognitive Complexity · WebTools.significantQueryConcepts (cognitive 17) Tools/Handlers/Web.swift
  • Cognitive Complexity · Helpers.swift.parseChineseDayOfMonthToken (cognitive 17) Tools/Helpers.swift
  • Cognitive Complexity · HealthTools.healthActivitySummaryCanonical (cognitive 16) Tools/Handlers/Health.swift
  • Cognitive Complexity · Helpers.swift.nextDate (cognitive 16) Tools/Helpers.swift
  • God Classes · ClassTooLong: WebTools Tools/Handlers/Web.swift
  • God Classes · ClassTooLong: HealthTools Tools/Handlers/Health.swift
  • God Classes · FileTooLong: Handlers/Web.swift Tools/Handlers/Web.swift
  • God Classes · FileTooLong: Handlers/Health.swift Tools/Handlers/Health.swift
  • God Classes · MethodTooLong: HealthTools.healthReportRangeCanonical Tools/Handlers/Health.swift
  • God Classes · ClassTooLong: CalendarTools Tools/Handlers/Calendar.swift
  • God Classes · MethodTooLong: ContactsTools.deleteCanonical Tools/Handlers/Contacts.swift
  • God Classes · ClassTooLong: ContactsTools Tools/Handlers/Contacts.swift
  • God Classes · FileTooLong: Handlers/Calendar.swift Tools/Handlers/Calendar.swift
  • God Classes · FileTooLong: Handlers/Contacts.swift Tools/Handlers/Contacts.swift
  • God Classes · MethodTooLong: WebTools.searchSuccess Tools/Handlers/Web.swift
  • God Classes · MethodTooLong: CalendarTools.createEventCanonical Tools/Handlers/Calendar.swift
  • God Classes · MethodTooLong: HealthTools.healthActivitySummaryCanonical Tools/Handlers/Health.swift
  • God Classes · MethodTooLong: WebTools.searchCanonical Tools/Handlers/Web.swift
  • God Classes · FileTooLong: Tools/Helpers.swift Tools/Helpers.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift
  • Code Duplication · Duplicated block (56 lines × 2) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Duplicated block (42–45 lines × 2) LLM/PromptBuilder.swift
  • Code Duplication · Duplicated block (35 lines × 2) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Duplicated block (35 lines × 2) UI/ResponseUI.swift
  • Code Duplication · Duplicated block (21–33 lines × 2) UI/ConfigurationsView.swift
  • Code Duplication · Duplicated block (30 lines × 2) Live/VAD/VADService.swift
  • Code Duplication · Duplicated block (28 lines × 2) Live/VAD/VADService.swift
  • Code Duplication · Duplicated block (24–25 lines × 2) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift
  • Code Duplication · Duplicated block (23 lines × 3) LLM/PromptBuilder.swift
  • Code Duplication · Duplicated block (12–22 lines × 6) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Duplicated block (19 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
  • Code Duplication · Duplicated block (19 lines × 2) Tools/Handlers/Web.swift
  • Code Duplication · Duplicated block (17 lines × 2) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift
  • Code Duplication · Duplicated block (17 lines × 2) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Duplicated block (17 lines × 2) Tools/Handlers/Health.swift
  • Code Duplication · Duplicated block (16 lines × 2) Agent/Engine/ChatSessionStore.swift
  • Code Duplication · Duplicated block (16 lines × 2) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Duplicated block (8–16 lines × 2) Tools/Handlers/Calendar.swift
  • Code Duplication · Duplicated block (15 lines × 2) Agent/Engine/Router.swift
  • Code Duplication · Duplicated block (15 lines × 2) Agent/Engine/ToolChain.swift
  • Code Duplication · Duplicated block (13–15 lines × 2) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift
  • Code Duplication · Duplicated block (15 lines × 2) Tools/Handlers/Health.swift
  • Code Duplication · Duplicated block (14 lines × 4) Tools/Handlers/Health.swift
  • Code Duplication · Duplicated block (14 lines × 3) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift
  • Code Duplication · Duplicated block (14 lines × 2) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift
  • Code Duplication · Duplicated block (14 lines × 2) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Duplicated block (14 lines × 2) Tools/Handlers/Health.swift
  • Code Duplication · Duplicated block (13 lines × 5) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift
  • Code Duplication · Duplicated block (13 lines × 4) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift
  • Code Duplication · Duplicated block (12–13 lines × 3) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift
  • Code Duplication · Duplicated block (13 lines × 2) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift
  • Code Duplication · Duplicated block (13 lines × 2) Live/Audio/LiveAudioIO.swift
  • Code Duplication · Duplicated block (11–12 lines × 4) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Duplicated block (11–12 lines × 2) Agent/Engine/Router.swift
  • Code Duplication · Duplicated block (12 lines × 2) LLM/Backends/Remote/LANDiscovery.swift
  • Code Duplication · Duplicated block (12 lines × 2) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Duplicated block (12 lines × 2) LLM/Core/WebFreshness.swift
  • Code Duplication · Duplicated block (10–11 lines × 4) LLM/Backends/Remote/GatewayProviders.swift
  • Code Duplication · Duplicated block (11 lines × 3) Tools/AppPermissions.swift
  • Code Duplication · Duplicated block (11 lines × 2) LLM/Backends/Remote/MacGateway.swift
  • Code Duplication · Duplicated block (11 lines × 2) UI/ConfigurationsView.swift
  • Code Duplication · Duplicated block (10 lines × 2) LLM/Backends/Remote/MacGateway.swift
Rebuild cost: about €60,000 · Estimate
Cost to rebuild€20,000 to €100,000, for 332 to 1,052 hours of work, about 0.4 person-years for one engineer
Difficulty of the problemStandard, 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 41. 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.
SizeMedium: 66,168 lines of product code
What it is notNot 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
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
Raises the score by about 27 points · Medium effort · Handler temporal coupling
2
Resolve the 90 No assertions finding(s) in Test Quality — start with MLXArray+IndexingTests.swift (22), MLXRandomTests.swift (11), TransformTests.swift (11).
Raises the score by about 2 points · Medium effort · Test Quality
3
Make sure a person approves each release.
The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
Raises the score by about 2 points · Medium effort · Deployment & Rollback

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 €60,000 to build again, about 0.4 person-years of work. Its weakest lens is Event-Driven, at 10 (Critical). Event-Driven is about whether the parts of the system can rely on the messages they send each other. Because the weakest lens counts most in the score, work on Event-Driven also moves the score most.
Based on: the rebuild estimate · the Event-Driven grade · how much each lens counts
What to do: Start with the Event-Driven actions in Top priorities.
If you do one thing first · First action
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource. Of all the actions in this report, it raises the score most for the work it takes: about 27 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.7 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 6% to 13% on every change. The history of the code shows how much it changes: about 100,654 lines over the last 90 days, which is about 408,208 lines a year. At that pace, the extra work comes to an estimated 58.4 to 350.5 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 — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch CMTMDBridge CMTMDBridge IOS27CoreAIExperiment IOS27CoreAIExperiment MTMDEngine MTMDEngine MTMDEngine->CMTMDBridge PhoneClaw PhoneClaw PhoneClaw->MTMDEngine PhoneClawEngine PhoneClawEngine PhoneClaw->PhoneClawEngine PhoneClawGateway PhoneClawGateway PhoneClawLiveActivityWidget PhoneClawLiveActivityWidget iOS27CoreAIProbeApp iOS27CoreAIProbeApp

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.

56 modules, with 52 dependencies between them. One loop runs through 7 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 16 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.
uses →1 MacGateway.Assets2 Packages.mlx-swift.Source.Cmlx.fmt.doc3 Packages.mlx-swift.Source.Cmlx.fmt.support4 Packages.mlx-swift.Source.Cmlx.fmt.support.docopt5 Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers.cxx6 Packages.mlx-swift.Source.Cmlx.fmt.support.release7 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.base8 LocalPackages~PhoneClawEngine~MTMDEngine9 LocalPackages~PhoneClawEngine~PhoneClawEngine10 Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers11 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn12 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers13 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.activations14 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.containers15 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution16 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution_transpose17 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.distributed18 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.dropout19 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.embedding20 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.linear21 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.normalization22 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.pooling23 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.positional_encoding24 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.quantized25 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.recurrent26 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.transformer27 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.upsample28 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.optimizers.optimizers29 Packages~mlx-swift~MLXNN30 Packages~mlx-swift~MLXOptimizers31 repository32 Packages~FluidAudio~FluidAudio33 Packages~mlx-swift~MLX34 Experiments~iOS27CoreAIProbeApp35 Experiments~iOS27CoreAI~IOS27CoreAIExperiment36 MacGateway~PhoneClawGateway37 Packages~mlx-swift~MLXFFT38 Packages~mlx-swift~MLXFast39 Packages~mlx-swift~MLXLinalg40 Packages~mlx-swift~MLXRandom
1 MacGateway.Assets
2 Packages.mlx-swift.Source.Cmlx.fmt.doc
3 Packages.mlx-swift.Source.Cmlx.fmt.support
4 Packages.mlx-swift.Source.Cmlx.fmt.support.docopt
5 Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers.cxx
6 Packages.mlx-swift.Source.Cmlx.fmt.support.release
7 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.base
8 LocalPackages~PhoneClawEngine~MTMDEngine118
9 LocalPackages~PhoneClawEngine~PhoneClawEngine117
10 Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers2
11 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn1
12 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers2
13 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.activations25
14 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.containers1
15 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution3
16 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution_transpose3
17 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.distributed4
18 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.dropout3
19 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.embedding1
20 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.linear3
21 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.normalization5
22 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.pooling1
23 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.positional_encoding3
24 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.quantized3
25 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.recurrent3
26 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.transformer6
27 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.upsample1
28 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.optimizers.optimizers1
29 Packages~mlx-swift~MLXNN27166
30 Packages~mlx-swift~MLXOptimizers21020
31 repository111471123726
32 Packages~FluidAudio~FluidAudio12287
33 Packages~mlx-swift~MLX37
34 Experiments~iOS27CoreAIProbeApp11
35 Experiments~iOS27CoreAI~IOS27CoreAIExperiment14
36 MacGateway~PhoneClawGateway6439
37 Packages~mlx-swift~MLXFFT3
38 Packages~mlx-swift~MLXFast15
39 Packages~mlx-swift~MLXLinalg5
40 Packages~mlx-swift~MLXRandom17
Uses a module listed above itPart of a loopThe module itself
1 MacGateway.Assets2 Packages.mlx-swift.Source.Cmlx.fmt.doc3 Packages.mlx-swift.Source.Cmlx.fmt.support4 Packages.mlx-swift.Source.Cmlx.fmt.support.docopt5 Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers.cxx6 Packages.mlx-swift.Source.Cmlx.fmt.support.release7 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.base8 LocalPackages~PhoneClawEngine~MTMDEngine9 LocalPackages~PhoneClawEngine~PhoneClawEngine10 Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers11 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn12 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers13 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.activations14 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.containers15 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution16 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution_transpose17 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.distributed18 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.dropout19 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.embedding20 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.linear21 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.normalization22 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.pooling23 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.positional_encoding24 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.quantized25 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.recurrent26 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.transformer27 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.upsample28 Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.optimizers.optimizers29 Packages~mlx-swift~MLXNN30 Packages~mlx-swift~MLXOptimizers31 repository32 Packages~FluidAudio~FluidAudio33 Packages~mlx-swift~MLX34 Experiments~iOS27CoreAIProbeApp35 Experiments~iOS27CoreAI~IOS27CoreAIExperiment36 MacGateway~PhoneClawGateway37 Packages~mlx-swift~MLXFFT38 Packages~mlx-swift~MLXFast39 Packages~mlx-swift~MLXLinalg40 Packages~mlx-swift~MLXRandomMacGateway.Assets1Packages.mlx-swift.Source.Cmlx.fmt.doc2Packages.mlx-swift.Source.Cmlx.fmt.support3Packages.mlx-swift.Source.Cmlx.fmt.support.docopt4Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers.cxx5Packages.mlx-swift.Source.Cmlx.fmt.support.release6Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.base7LocalPackages~PhoneClawEngine~MTMDEngine8LocalPackages~PhoneClawEngine~PhoneClawEngine9Packages.mlx-swift.Source.Cmlx.fmt.support.python.mkdocstrings_handlers10Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn11Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers12Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.activations13Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.containers14Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution15Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.convolution_transpose16Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.distributed17Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.dropout18Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.embedding19Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.linear20Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.normalization21Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.pooling22Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.positional_encoding23Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.quantized24Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.recurrent25Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.transformer26Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.nn.layers.upsample27Packages.mlx-swift.Source.Cmlx.mlx.python.mlx.optimizers.optimizers28Packages~mlx-swift~MLXNN29Packages~mlx-swift~MLXOptimizers30repository31Packages~FluidAudio~FluidAudio32Packages~mlx-swift~MLX33Experiments~iOS27CoreAIProbeApp34Experiments~iOS27CoreAI~IOS27CoreAIExperiment35MacGateway~PhoneClawGateway36Packages~mlx-swift~MLXFFT37Packages~mlx-swift~MLXFast38Packages~mlx-swift~MLXLinalg39Packages~mlx-swift~MLXRandom40118117212251334313513336112716621020111471123726122873711146439315517+16 more modules (most-connected shown)

At a glance — Code Health · 68% · Adequate · gated by D4 ·

At a glance — Architecture · 94% · Exemplary ·

At a glance — Maturity · 73% · Strong ·

At a glance — Readiness · 62% · Adequate · gated by P3 ·

At a glance — Security · 95% · Checked 2 of 7 ·

At a glance — Event-Driven · 10% · Critical · gated by ED1 ·

At a glance — Performance · 70% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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 categoryFindingsSeverity
A05:2025 — Injection4High / Critical
A07:2025 — Authentication Failures2High / Critical

Roadmap

Top priorities: Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource; Resolve the 90 No assertions finding(s) in Test Quality — start with MLXArray+IndexingTests.swift (22), MLXRandomTests.swift (11), TransformTests.swift (11); Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.+26.7 ptsMediumHandler temporal coupling
Resolve the 90 No assertions finding(s) in Test Quality — start with MLXArray+IndexingTests.swift (22), MLXRandomTests.swift (11), TransformTests.swift (11).+1.7 ptsMediumTest Quality
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.+1.7 ptsMediumDeployment & Rollback
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.+1.4 ptsMediumObservability
Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.+1.2 ptsMediumAsync & latency hygiene
Resolve the 1 `Qwen3ASR` spells `ASR` where 13 names in the project spell it `Asr` finding(s) in Naming Consistency — start with ModelNames.swift.+0.6 ptsLowNaming Consistency
Resolve the 1 `voiceID` spells `ID` where 62 names in the project spell it `Id` finding(s) in Naming Consistency — start with KokoroSynthesizer+VoiceEmbeddings.swift.+0.6 ptsLowNaming Consistency
Swallowed exception (caught, then discarded)+0.8 ptsMediumException handling

File quality

Per-file score 0–10 — a quality signature. Of 116 files carrying findings, judged against the Production bar: 1% slop · 69% mixed · 30% near-clean.

FileScoreBandWorst signal
Agent/AgentEngine.swift3.6SlopChange Coupling: Boundary-crossing change coupling: AgentEngine.swift ↔ SkillLoader.swift
Agent/Engine/EngineLifecycle.swift4.2MixedChange Coupling: Boundary-crossing change coupling: EngineLifecycle.swift ↔ ConfigurationsView.swift
REDACTED4.6MixedSecrets (history): REDACTED: REDACTED
LLM/Backends/LiteRT/LiteRTBackend.swift5.0MixedChange Coupling: Boundary-crossing change coupling: LiteRTBackend.swift ↔ LiveTurnProcessor.swift
LLM/Installation/LiteRTModelStore.swift5.5MixedCognitive Complexity: LiteRTModelStore.performInstall (cognitive 23)
Agent/Engine/Planner.swift5.6MixedCyclomatic Complexity: AgentEngine.executePlannedSkillChainIfPossible (cyclomatic 80)
Live/Core/LiveModeEngine.swift6.0MixedExplicit Debt: TodoComment
LLM/MLX/MLXLocalLLMService.swift6.0MixedExplicit Debt: TodoComment
LLM/PromptBuilder.swift6.0MixedExplicit Debt: TodoComment
LLM/Core/ModelRuntimeCoordinator.swift6.5MixedChange Coupling: Boundary-crossing change coupling: ModelRuntimeCoordinator.swift ↔ ContentView.swift
Agent/Engine/ProcessInput.swift7.0MixedCyclomatic Complexity: AgentEngine.processInput (cyclomatic 163)
Agent/Engine/ToolChain.swift7.0MixedCyclomatic Complexity: AgentEngine.executeToolChain (cyclomatic 131)
UI/ResponseUI.swift7.0MixedCyclomatic Complexity: SkillCardView.statusTitle (cyclomatic 47)
LLM/Installation/Download/ResumableAssetDownloader.swift7.0MixedCyclomatic Complexity: ResumableAssetDownloader.transfer (cyclomatic 33)
LLM/Backends/MiniCPMV/MiniCPMVBackend.swift7.0MixedCyclomatic Complexity: MiniCPMVBackend.runLiveTransactionBody (cyclomatic 27)
Agent/Engine/Router.swift7.0MixedCyclomatic Complexity: AgentEngine.latestPriorContextArtifact (cyclomatic 25)
LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift7.0MixedCyclomatic Complexity: LiteRTLMEngine.conversationSendStreaming (cyclomatic 23)
UI/ContentView.swift7.0MixedCyclomatic Complexity: ContentView.handleImportedFile (cyclomatic 23)
LLM/Backends/Remote/GatewayProviders.swift7.0MixedCyclomatic Complexity: LocalCLIProvider.runCodexStreaming (cyclomatic 20)
MacGateway/Sources/PhoneClawGateway/GatewayApp.swift7.0MixedCyclomatic Complexity: GatewayModel.validateAndNormalizeConfigs (cyclomatic 17)

How the grades work

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 — 13

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 — 715

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 — 56

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 24

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 42 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, 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 — 42 dimensions across the health lenses
D1D2D3D4D5D6D7D8D10D11D12D13D15D16D17D21D26D27D28D29D34D35AX10AX3AX4AX8AX9ED1M1M2M3M4P1P10P2P3P4P6PF3X14X26X3

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
  1. 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, 768 of 784 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.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. 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.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic

Every finding is locatable in findings.md. Run 01a1dd09-c252-7896-876b-58e08892074c.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

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.

  • D4 Code Duplication — 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. The 248 duplicated block group(s) on this row were found in the languages this pass could tokenize, and they do NOT cover all of this repository's production source: .cc (27,606 lines, 29% of production source), .cpp (91 lines, 0% of production source) went unread, because no language model this pass could load exposed a clone-unit token stream for those file kinds. Duplication in that source is UNMEASURED — its absence from the count above is a gap in this analyzer's language coverage, not a finding that the code is free of duplication.
  • D14 License Compliance — scanner not present in this environment — The backing tool was not installed where this scan ran, so this dimension was not scored. Install the tool (or run in the hosted environment, where it is always present) for a graded result.
  • D19 Documentation Quality — 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 kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D20 ADR Quality — 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. The ADR lexicon (adr-lexicon-1) covers de, en, it, nl. A record identified as another language, or whose language could not be identified (fewer than 25 words of prose, or no clear winner), is never read with English rules: its missing-section, status, consequence-cost and same-question rules abstain, and only the structural rules (title, single option, dangling link, enforcement field) run.
  • 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's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • 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. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D26 Project Cohesion — 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. Project size and spread are measured over build units whose source a code model reads. This repository's .cc, .cpp source is a material share of its production lines and was read by none, so the score is a verdict about the units that were read. Not a finding that the unread source is cohesive — it is unmeasured.
  • D27 Navigability — 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. Tracing effort is measured over resolved call sites, and all 401 sampled here came from .swift files. This repository's .cc, .cpp source is a material share of its production lines and contributed none, so the score above is a verdict about the part that was read. Not a finding that the unread half navigates well — it is unmeasured.
  • D30 Dependency Vulnerabilities — 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. Osv: osv-scanner exited 1 with no findings — dependency CVEs were not measured. 'osv-scanner' exited 1 and produced no findings, and that exit code has no documented repo-side meaning — so this run measured nothing, and nothing here is a statement about the repository.
  • D32 Data Compliance (PII/GDPR) — 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. `Agent/Engine/GuardedSkillRouter.swift`, `Agent/Engine/OutputCleaner.swift`, `Agent/Engine/PromptPipelineHelpers.swift`, `Agent/Engine/ToolChain.swift`, `Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift`, … (+15 more) 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.
  • D43 Malicious Dependencies — 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. Osv: osv-scanner exited 1 with no findings — dependency CVEs were not measured. 'osv-scanner' exited 1 and produced no findings, and that exit code has no documented repo-side meaning — so this run measured nothing, and nothing here is a statement about the repository.
  • D44 Platform End-of-Life — 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 dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • AX6 Interface segregation — 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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXB1 Runtime evidence locked — no reproducible boot — 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. Subject: a native UI project (PhoneClaw.xcodeproj/project.pbxproj). The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • C1 Data Protection — 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 personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — 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.
  • C3 Audit Trail — 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 audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • 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 and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python, Swift, c, cpp 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 and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python, Swift, c, cpp 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.
  • X12 Unreachable branch — 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X14 Bypassable address classification — 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. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X16 Unfloored truncation loop — 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, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin 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.
  • X18 Disposal-pattern correctness — 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, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP 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.
  • X2 Cancellation propagation — 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, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch, got, undici, node:http; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, 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.
  • X26 Unsynchronised callback handoff — 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. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X27 Collection changed while being enumerated — 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 most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X29 Per-element action decided by a fixed element — 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 (Vue and Svelte components included), Java, Rust, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin 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. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X4 Structured logging — 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, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP make no call through a named logger, 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.
  • X5 Nullable reference types — 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 MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's C, Cpp, Python, Swift 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.

Repo exclusion declarations: 2 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

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.
  • D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • 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.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • 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.
  • 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.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • 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").
  • 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.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: 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.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • 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.

Dimensions

D1 · Cyclomatic Complexity5.5 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 5.5 / 10 · rule-coverage 100% · ceiling Prevented

50 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was AgentEngine.processInput at 163. A further 5 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being ProviderKind.title at 16 — they are counted neither in the figure above nor in this dimension's score.

LocalCLIProvider.runCodexStreaming (cyclomatic 20) · ×2MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:643
AgentEngine.processInput (cyclomatic 163)Agent/Engine/ProcessInput.swift:13
AgentEngine.executeToolChain (cyclomatic 131)Agent/Engine/ToolChain.swift:2521
AgentEngine.executePlannedSkillChainIfPossible (cyclomatic 80)Agent/Engine/Planner.swift:271
LiveModeEngine.processAudio (cyclomatic 53)Live/Core/LiveModeEngine.swift:863

+ 44 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 3 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with AgentEngine.processInput (cyclomatic 163), AgentEngine.executeToolChain (cyclomatic 131), AgentEngine.executePlannedSkillChainIfPossible (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 3 together lifts Cyclomatic Complexity from 5.5 to about 6.5/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.

D2 · Cognitive Complexity4.2 / 10Weak✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 4.2 / 10 · rule-coverage 100% · ceiling Prevented

80 method(s) exceeded the cognitive complexity threshold of 15; the worst was AgentEngine.executeToolChain at 293.

LocalCLIProvider.runCodexStreaming (cognitive 23) · ×2MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:643
AgentEngine.executeToolChain (cognitive 293)Agent/Engine/ToolChain.swift:2521
AgentEngine.processInput (cognitive 244)Agent/Engine/ProcessInput.swift:13
AgentEngine.executePlannedSkillChainIfPossible (cognitive 177)Agent/Engine/Planner.swift:271
LiveModeEngine.processAudio (cognitive 91)Live/Core/LiveModeEngine.swift:863

+ 74 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 3 bodies over 120 down to 120 or less in Cognitive Complexity — start with AgentEngine.executeToolChain (cognitive 293), AgentEngine.processInput (cognitive 244), AgentEngine.executePlannedSkillChainIfPossible (cognitive 177). — 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 3 together lifts Cognitive Complexity from 4.3 to about 5.4/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes7.9 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.9 / 10 · rule-coverage 100% · ceiling Prevented

61 god class(es) detected.

FileTooLong: PhoneClawGateway/GatewayApp.swift · ×22MacGateway/Sources/PhoneClawGateway/GatewayApp.swift
MethodTooLong: AgentEngine.executeToolChain · ×19Agent/Engine/ToolChain.swift:2521
ClassTooLong: PromptBuilder · ×11LLM/PromptBuilder.swift:10
TooManyMethods: AgentEngine · ×9Agent/AgentEngine.swift:65

What to do

  1. Resolve the 22 FileTooLong finding(s) in God Classes — start with GatewayProviders.swift (2), GatewayApp.swift, ToolChain.swift. — One of this dimension's main actionable groups (22 warning-level).
  2. Resolve the 19 MethodTooLong finding(s) in God Classes — start with PromptBuilder.swift (4), LiveModeEngine.swift (2), ResumableAssetDownloader.swift (2). — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 11 ClassTooLong finding(s) in God Classes — start with PromptBuilder.swift, ContentView.swift, ConfigurationsView.swift. — One of this dimension's main actionable groups (11 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication3.8 / 10Weak✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 3.8 / 10 · rule-coverage 100% · ceiling Verified

248 duplicated block group(s) detected. 15.5 % of the production lines (10,231 of 66,168) are in a reported copy. A further 129 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 33 of the 377 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population. Measured on part of this repository only: .cc, .cpp (30% of production source) was not exposed to the token comparison, so duplication there is unmeasured and is not in this count.

Duplicated block (8 lines × 2) · ×18Agent/Engine/GuardedSkillRouter.swift:182
Duplicated block (9 lines × 2) · ×17Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:185
Duplicated block (5 lines × 2) · ×16LLM/Backends/Remote/LANBinding.swift:110
Edited copy of a member (3 corresponding lines) · ×12LLM/Backends/Remote/GatewayProviders.swift:990
Duplicated block (14 lines × 2) · ×11LLM/Backends/Remote/GatewayProviders.swift:83

+ 144 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 18 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with MacGateway.swift (3), GatewayProviders.swift (3), ResumableAssetDownloader.swift (2). — One of this dimension's main actionable groups (18 warning-level).
  2. Resolve the 17 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with Health.swift (3), GatewayApp.swift (2), GatewayProviders.swift (2). — One of this dimension's main actionable groups (17 warning-level).
  3. Resolve the 16 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with GatewayProviders.swift (4), MacGateway.swift (3), LANBinding.swift. — One of this dimension's main actionable groups (16 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling9.0 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.0 / 10 · rule-coverage 100% · ceiling Prevented

8 production modules (SwiftPM+Xcode), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; a workspace's implicit (product-name) dependency is not visible there; 1 module(s) off the main sequence, with abstractness counted on 6 of the 8 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: PhoneClawEngine

What to do

  1. Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)9.3 / 10Stronggated by 12 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.3 / 10 · rule-coverage 100% · ceiling Verified

12 of 199 classes have LCOM4 above 3.

Low cohesion: MLMultiArray (LCOM4 6) · ×12Packages/FluidAudio/Sources/FluidAudio/Shared/ANEMemoryOptimizer.swift:184

What to do

  1. Resolve the 12 Low cohesion finding(s) in Cohesion (LCOM4) — start with KVCache.swift (2), ANEMemoryOptimizer.swift, AgentEngine.swift. — One of this dimension's main actionable groups (12 warning-level).

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D7 · Architectural Integrity6.0 / 10Adequate✓ Tool-verified

What it measures: Whether the code respects its intended layering / architecture rules.

Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Prevented

No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).

Detailed fixes: d7_recommendation.md.

D8 · Code Coverage9.8 / 10Stronggated by 2 serious findings✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Verified

Line coverage 73.9% — 2 file(s) below 50%. Measured from the Swift suite (MacGateway: no coverage export; Tests: no coverage export; Experiments/iOS27CoreAI: `swift test --enable-code-coverage` over 6 production file(s); Packages/mlx-swift: no coverage export; Tests/AudioTest: no coverage export).

Low coverage: Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/BenchmarkRecord.swift · ×2Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/BenchmarkRecord.swift:1

What to do

  1. Resolve the 2 Low coverage finding(s) in Code Coverage — start with BenchmarkRecord.swift, CoreAIProbe.swift. — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.

D10 · Test Quality7.6 / 10Strong✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.6 / 10 · rule-coverage 100% · ceiling Prevented

7 skipped, 90 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 634 tests.

No assertions: testParsesChineseRelativePhrases · ×90Tests/Tests/PhoneClawCoreTests/WebFreshnessTests.swift:73
Skipped test: testWiredMemoryPolicyStackingAndCustomPolicies · ×7Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:43
Test project verifies nothing: CmlxTestsPackages/mlx-swift/Tests/CmlxTests/CmlxTests.swift:14

What to do

  1. Resolve the 90 No assertions finding(s) in Test Quality — start with MLXArray+IndexingTests.swift (22), MLXRandomTests.swift (11), TransformTests.swift (11). — One of this dimension's main actionable groups (90 warning-level).
  2. Resolve the 7 Skipped test finding(s) in Test Quality — start with WiredMemoryTests.swift (7). — One of this dimension's main actionable groups (7 warning-level).
  3. Resolve the 1 Test project verifies nothing finding(s) in Test Quality — start with CmlxTests.swift. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.

D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests pass reliably, with no flakiness.

Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 flaky across 1 measured tier(s). Swift (5 packages): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D12 · Dependency Hygiene9.2 8.2 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 8.2 / 10 · rule-coverage 89% · ceiling Verified

16 outdated direct SwiftPM dependencies, 0 pinning defect(s). 25 of 28 direct dependencies had their releases listed (0 naming no readable repository, 3 pinned to a branch or a revision rather than a version). SwiftPM has no package registry: a dependency is a repository URL and its releases are that repository's semver tags, so currency is answered by listing tags rather than by querying an index. Only a newer tag on the SAME MAJOR is reported — a `from:` requirement admits everything below the next major and nothing above it, so a major crossing needs a Package.swift edit rather than an update, and naming the update as its remedy would be wrong. Whether any dependency is DEPRECATED or ABANDONED is not graded and cannot be: a repository publishes no such marker, and there is no registry that could carry one. Known CVEs in this dependency graph are D30's question. 1 third-party CocoaPods resolved by a committed Podfile.lock were graded against the CocoaPods trunk (cdn.cocoapods.org): a pod is behind only when the trunk lists a newer release on the same major, which `pod update` reaches under a `~>` requirement. A pod sourced from a path, git URL or local podspec has no trunk release to compare and is not asked about. Carthage dependencies are not graded.

Outdated: swift-argument-parser · ×8

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · REDACTED Scanning10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

REDACTED scan ran and found no leaked secrets. 1 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D15 · Churn × Complexity Hotspots8.8 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 8.8 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: Agent/Engine/ProcessInput.swift (12×163=1956); Agent/Engine/ToolChain.swift (14×131=1834); UI/ContentView.swift (39×17=663) Repeated repair below the complexity floor: UI/UIScale.swift (3 of 5 changes were fixes)

Hotspot: Agent/Engine/ProcessInput.swift · ×24Agent/Engine/ProcessInput.swift:13
Repeated repair: UI/UIScale.swiftUI/UIScale.swift:45

What to do

  1. Resolve the 24 Hotspot finding(s) in Churn × Complexity Hotspots — start with ProcessInput.swift, ToolChain.swift, ContentView.swift. — One of this dimension's main actionable groups (24 warning-level).
  2. Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with UIScale.swift. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor8.3 / 10Strong✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 8.3 / 10 · rule-coverage 100% · ceiling Documented

94 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is LLM/PromptBuilder.swift. Counted over 137 of the 175 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Small-team knowledge concentration

What to do

  1. Resolve the 1 Small-team knowledge concentration finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt10.0 / 10Stronggated by 3 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

3 deducted task-comment markers across 66168 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.

TodoComment · ×3Live/Core/LiveModeEngine.swift:923

What to do

  1. Resolve the 3 TodoComment finding(s) in Explicit Debt — start with LiveModeEngine.swift, PromptBuilder.swift, MLXLocalLLMService.swift. — One of this dimension's main actionable groups (3 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D21 · Naming Consistency7.3 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 7.3 / 10 · rule-coverage 100% · ceiling Verified

2 naming inconsistencies among 74 declarations measured against a convention their peers follow.

`Qwen3ASR` spells `ASR` where 13 names in the project spell it `Asr`Packages/FluidAudio/Sources/FluidAudio/ModelNames.swift:530
`voiceID` spells `ID` where 62 names in the project spell it `Id`Packages/FluidAudio/Sources/FluidAudio/TTS/Kokoro/Pipeline/Synthesize/KokoroSynthesizer+VoiceEmbeddings.swift:158

What to do

  1. Resolve the 1 `Qwen3ASR` spells `ASR` where 13 names in the project spell it `Asr` finding(s) in Naming Consistency — start with ModelNames.swift. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 `voiceID` spells `ID` where 62 names in the project spell it `Id` finding(s) in Naming Consistency — start with KokoroSynthesizer+VoiceEmbeddings.swift. — 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.

D26 · Project Cohesion6.0 / 10Adequate✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 5 build units (SwiftPM, Xcode) flagged as possibly oversized/incoherent. This repository's .cc, .cpp source was read by no build unit, so this covers part of the tree, not all of it.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D27 · Navigability10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 % of calls cross a namespace and 0 % 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. Measured over the .swift source only — this repository's .cc, .cpp was not sampled for call sites, so this score covers part of the tree, not all of it.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md.

D28 · Secrets (history)9.0 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged 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.

Maturity: Documented → Verified → Prevented · effective 9.0 / 10 · rule-coverage 100% · ceiling Documented

1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.

D29 · Static Analysis (SAST)10.0 / 10Adequategated by 4 critical findings○ Nothing flagged

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).

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

4 finding(s): 0 critical, 4 high, 0 medium, 0 low. 4 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 27 file(s) — `App/OrbWebAssets/three/examples/jsm/libs/fflate.module.js`, `Frameworks/onnxruntime.xcframework/Headers/onnxruntime_c_api.h`, `Frameworks/onnxruntime.xcframework/Headers/onnxruntime_cxx_api.h` (lines 47–2372), `Frameworks/onnxruntime.xcframework/Headers/onnxruntime_cxx_inline.h` (line 470, line 488, line 498), `Frameworks/piper_plus.xcframework/ios-arm64/Headers/piper_plus.h`, … (+22 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 4 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED

What to do

  1. No action in Static Analysis (SAST) — all 4 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (4 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 137 of the 175 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling9.8 / 10Adequategated by 5 critical findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: AgentEngine.swift↔SkillLoader.swift 60%; EngineLifecycle.swift↔ConfigurationsView.swift 60%; EngineLifecycle.swift↔ContentView.swift 60%

Boundary-crossing change coupling: AgentEngine.swift ↔ SkillLoader.swift · ×5Agent/AgentEngine.swift:1
Change coupling: Planner.swift ↔ ToolChain.swift · ×2Agent/Engine/Planner.swift:1

What to do

  1. Resolve the 5 Boundary-crossing change coupling finding(s) in Change Coupling — start with EngineLifecycle.swift (2), AgentEngine.swift, LiteRTBackend.swift. — One of this dimension's main actionable groups (5 issue-level).
  2. Resolve the 2 Change coupling finding(s) in Change Coupling — start with Planner.swift, LiveTurnProcessor.swift. — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AX10 · Code composition9.8 / 10Exemplary✓ Tool-verified

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.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

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.

AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

AX9 · CQS / query purity9.9 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

  • `LANConnectionManager.resolveEndpoint` is a read-named query yet it performs a durable write on the read path (a persist to a store/client). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command. — LLM/Backends/Remote/LANBinding.swift:194

What to do

  • Keep query handlers read-only — move the writes/event-publishes into a command handler so reads stay safe to retry, cache, and route to a read replica.
ED1 · Handler temporal coupling1.0 / 10Critical✓ Tool-verified

Other · Event-Driven — Whether event/message handlers avoid synchronous blocking waits — a blocking wait inside a handler stalls throughput and risks deadlock.

Method: Roslyn semantic scan (event-driven gated): event-handler bodies scanned for HTTP/gRPC invocations by resolved symbol type, not substring. Deterministic, semantic-resolved.

  • `VADService.handleAudioInput` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — Live/VAD/VADService.swift:167
  • `LiveLandVADService.handleAudioInput` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — LiveLand/VAD/LiveLandVADService.swift:169

What to do

  • Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
M1 · Documentation (README)9.6 / 10Exemplary✓ Tool-verified

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.

M2 · Architecture documentation4.0 / 10Weak✓ Tool-verified

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.

  • 1 ADR-shaped document(s) detected by content — `Docs/architecture-decisions.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.

What to do

  • Move ADRs under docs/adr/ (or docs/adrs/) and name them NNNN-title.md so they're easy to find.
M3 · Folder & project structure8.0 / 10Strong✓ Tool-verified

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.

  • Most of the production code is in directories of its own, but 1 application file(s) sit at the repository root beside the build and tooling files (`PhoneClaw-Bridging-Header.h`).
M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

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.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability5.8 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 3/5 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `Experiments/iOS27CoreAIProbeApp`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
P3 · Security & performance tooling3.0 / 10Weak✓ Tool-verified

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 CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 1 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.
  • `Packages/mlx-swift/Source/Cmlx/mlx/.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, `gradle`, `gitsubmodule`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list. — Packages/mlx-swift/Source/Cmlx/mlx/.github/dependabot.yml:2

What to do

  • Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
  • Dependabot is configured but does not watch `pip`, `gradle`, `gitsubmodule` — add those `package-ecosystem` entries to .github/dependabot.yml so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback5.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

What to do

  • Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

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.

PF3 · Async & latency hygiene7.0 / 10Strong✓ Tool-verified

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.

  • `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. (×2) — Live/Core/VoiceTurnController.swift:12, LiveLand/Core/LiveLandTurnController.swift:12

What to do

  • Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.
X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

X3 · Exception handling6.4 / 10Adequate✓ Tool-verified

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` 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. (×9) — UI/ContentView.swift:2290, MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1916, LiveLand/Core/LiveLandTurnController.swift:105, …
  • 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. — Live/Core/LiveModeEngine.swift:463

What to do

  • Swallowed exception (caught, then discarded)

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.

LensScoreRatingImpact
Code Health68%Adequate — gated by D4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture94%ExemplarySolid.
Maturity73%StrongSolid.
Readiness62%Adequate — gated by P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security95%Checked 2 of 7Strongest area.
Event-Driven10%Critical — gated by ED1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance70%StrongSolid.
Unscored — 4 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • X10 Duplicated predicate — 24 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 11 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 2 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.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 69 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 JavaScript 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; this repository's Python 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; this repository's Swift 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 function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. 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
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, 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 property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D14 License Compliance — Package licences not graded — dependencies declared to CocoaPods
  • 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.
  • D19 Documentation Quality — D19 withholds "Documentation: empty section": 3 candidate(s) were measured and not published.
  • D20 ADR Quality — 1 ADR(s) are written in a language our ADR lexicon does not cover, or are too short to tell (undetermined); their sections and statuses were not judged.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Swift surface was not measured.
  • 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; comments in this repository's .py, .swift source were not judged.
  • D25 ADR Conformance — None of 0 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
  • D30 Dependency Vulnerabilities — Scanner failed to run — not a clean result
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 20 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D36 Supply-chain Provenance & Signing — The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files).
  • 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 — Scanner failed to run — not a clean result
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (2 value object(s))
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • 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 and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python, Swift source, so there is no service whose uptime a failing dependency could take down
  • 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 data present for 6 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `Benchmark("…")` in a file importing package-benchmark, or package-benchmark in Package.swift, 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.
  • X1 Async correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X12 Unreachable branch — X12 reached only 6% of this repository's production lines — swift (65,838 lines), c (26,788 lines), cpp (909 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • 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
  • 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
  • X16 Unfloored truncation loop — 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
  • 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
  • X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • 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 — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X21 Side-effecting pattern 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
  • X23 Unguarded diagnostic materialisation — 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 applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X27 Collection changed while being enumerated — X27 reached only 0% of this repository's production lines — swift (65,838 lines), c (26,788 lines), javascript (5,544 lines), cpp (909 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • 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 analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X30 Support guard that admits what it rejects — 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 — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository

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.

Critical — 13 finding(s)
D35 · Change Coupling · Boundary-crossing change coupling · ×5
  • Boundary-crossing change coupling: AgentEngine.swift ↔ SkillLoader.swift Agent/AgentEngine.swift:1 — `Agent/AgentEngine.swift` (context Agent) and `Skills/SkillLoader.swift` (context Skills) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `f6186185` Improve skill routing slot generalization; `48e84a34` feat: add free web search skill; `b53c31c8` WIP backup: Live mode V2 + 跨平台守卫 + Skill chip decoupled + 持久化修复 — run `git show` on any of them.
  • Boundary-crossing change coupling: EngineLifecycle.swift ↔ ConfigurationsView.swift Agent/Engine/EngineLifecycle.swift:1 — `Agent/Engine/EngineLifecycle.swift` (context Agent) and `UI/ConfigurationsView.swift` (context UI) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `1b12513a` Prevent Foundation Models auto-selection; `ed9f3a8a` Add Foundation Models runtime adapter; `09726729` feat: optimize live downloads and model autoload — run `git show` on any of them.
  • Boundary-crossing change coupling: EngineLifecycle.swift ↔ ContentView.swift Agent/Engine/EngineLifecycle.swift:1 — `Agent/Engine/EngineLifecycle.swift` (context Agent) and `UI/ContentView.swift` (context UI) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `ed9f3a8a` Add Foundation Models runtime adapter; `09726729` feat: optimize live downloads and model autoload; `15e972f1` Save LiveLand expanded result recovery state — run `git show` on any of them.
  • Boundary-crossing change coupling: LiteRTBackend.swift ↔ LiveTurnProcessor.swift LLM/Backends/LiteRT/LiteRTBackend.swift:1 — `LLM/Backends/LiteRT/LiteRTBackend.swift` (context LLM) and `Live/Turn/LiveTurnProcessor.swift` (context Live) sit in DIFFERENT parts of the tree yet change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `1eaa9b5f` fix: embed system prompt in first user message for Live; `00ceb24b` fix: use sessionHasContext to trigger delta instead of history.isEmpty; `b25f81ff` feat: enable KV cache delta for Live mode — run `git show` on any of them.
  • Boundary-crossing change coupling: ModelRuntimeCoordinator.swift ↔ ContentView.swift LLM/Core/ModelRuntimeCoordinator.swift:1 — `LLM/Core/ModelRuntimeCoordinator.swift` (context LLM) and `UI/ContentView.swift` (context UI) sit in DIFFERENT parts of the tree yet change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `ed9f3a8a` Add Foundation Models runtime adapter; `d0d3f625` fix: stabilize model autoload for TestFlight; `52bcfc3c` Fix generation cancellation and model status hints — run `git show` on any of them.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
ED1 · Handler temporal coupling · Blocking wait inside a handler · ×2
  • Blocking wait inside a handler: VADService.handleAudioInput Live/VAD/VADService.swift:167 — `VADService.handleAudioInput` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
  • Blocking wait inside a handler: LiveLandVADService.handleAudioInput LiveLand/VAD/LiveLandVADService.swift:169 — `LiveLandVADService.handleAudioInput` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
AX9 · CQS / query purity · Query writes persistent state on the read path · ×1
  • Query writes persistent state on the read path: LANConnectionManager.resolveEndpoint LLM/Backends/Remote/LANBinding.swift:194 — `LANConnectionManager.resolveEndpoint` is a read-named query yet it performs a durable write on the read path (a persist to a store/client). A query must stay side-effect-free so reads are safe to retry, cache, and route to a read replica; move the write into a command.
D28 · Secrets (history) · REDACTED · ×1
  • REDACTED
Serious — 715 finding(s)
D10 · Test Quality · No assertions · ×90
  • No assertions: testParsesChineseRelativePhrases Tests/Tests/PhoneClawCoreTests/WebFreshnessTests.swift:73 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testParsesEnglishRelativePhrases Tests/Tests/PhoneClawCoreTests/WebFreshnessTests.swift:81 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testMinimal Packages/mlx-swift/Tests/CmlxTests/CmlxTests.swift:14 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testArrayAt Packages/mlx-swift/Tests/MLXTests/ArrayAtTests.swift:9 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testExportFunction Packages/mlx-swift/Tests/MLXTests/ExportTests.swift:25 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testExportFunctions Packages/mlx-swift/Tests/MLXTests/ExportTests.swift:48 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testNormAxis Packages/mlx-swift/Tests/MLXTests/LinalgTests.swift:36 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testNormAxes Packages/mlx-swift/Tests/MLXTests/LinalgTests.swift:43 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testQR Packages/mlx-swift/Tests/MLXTests/LinalgTests.swift:49 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testArraySubscriptAdvanced2 Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:128 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testArraySubscriptAdvanced2d Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:138 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testArraySubscriptAdvanced2d2 Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:150 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testArrayMutateSingleIndex Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:164 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testArrayMutateBroadcastMultiIndex Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:172 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testArrayMutateBroadcastSlice Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:190 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testCollection Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:215 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testReversed Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:249 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedBy2 Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:261 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedBy2Offset Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:269 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedByNegative1Last Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:277 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedByNegative1First Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:285 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedByNegative1SecondOffset Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:293 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedByNegative1LastOffset Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:302 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedByNegative2SecondOffset Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:310 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testStridedByNegative2Last Packages/mlx-swift/Tests/MLXTests/MLXArray+IndexingTests.swift:318 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 65 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×24
  • Hotspot: Agent/Engine/ProcessInput.swift Agent/Engine/ProcessInput.swift:13 — Agent/Engine/ProcessInput.swift changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 163 in AgentEngine.processInput at line 13. 3 of those changes were fix/bug commits, and the other 9 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Agent/Engine/ProcessInput.swift`: 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: Agent/Engine/ToolChain.swift Agent/Engine/ToolChain.swift:2521 — Agent/Engine/ToolChain.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 131 in AgentEngine.executeToolChain at line 2521. 3 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Agent/Engine/ToolChain.swift`: 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: UI/ContentView.swift UI/ContentView.swift:251 — UI/ContentView.swift changed 39 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in ContentView.body at line 251. 17 of those changes were fix/bug commits, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- UI/ContentView.swift`: 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: Agent/Engine/Planner.swift Agent/Engine/Planner.swift:271 — Agent/Engine/Planner.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in AgentEngine.executePlannedSkillChainIfPossible at line 271. 2 of those changes were fix/bug commits, and the other 6 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Agent/Engine/Planner.swift`: 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: Agent/AgentEngine.swift Agent/AgentEngine.swift:455 — Agent/AgentEngine.swift changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in AgentEngine.init at line 455. 3 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Agent/AgentEngine.swift`: 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: Live/Core/LiveModeEngine.swift Live/Core/LiveModeEngine.swift:863 — Live/Core/LiveModeEngine.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in LiveModeEngine.processAudio at line 863. 1 of those changes was a fix/bug commit, and the other 7 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Live/Core/LiveModeEngine.swift`: 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: UI/ResponseUI.swift UI/ResponseUI.swift:1417 — UI/ResponseUI.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in SkillCardView.statusTitle at line 1417. 1 of those changes was a fix/bug commit, and the other 8 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- UI/ResponseUI.swift`: 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: LLM/Backends/MiniCPMV/MiniCPMVBackend.swift LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:980 — LLM/Backends/MiniCPMV/MiniCPMVBackend.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in MiniCPMVBackend.runLiveTransactionBody at line 980. 6 of those changes were fix/bug commits, and the other 7 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- LLM/Backends/MiniCPMV/MiniCPMVBackend.swift`: 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: Agent/Engine/EngineLifecycle.swift Agent/Engine/EngineLifecycle.swift:148 — Agent/Engine/EngineLifecycle.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in AgentEngine.loadSystemPrompt at line 148. 4 of those changes were fix/bug commits, and the other 10 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Agent/Engine/EngineLifecycle.swift`: 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: LLM/PromptBuilder.swift LLM/PromptBuilder.swift:304 — LLM/PromptBuilder.swift changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in PromptBuilder.build at line 304. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- LLM/PromptBuilder.swift`: 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: Tools/Handlers/Health.swift Tools/Handlers/Health.swift:767 — Tools/Handlers/Health.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in HealthTools.healthReportRangeCanonical at line 767. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Tools/Handlers/Health.swift`: 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: Agent/Engine/Router.swift Agent/Engine/Router.swift:249 — Agent/Engine/Router.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in AgentEngine.recentActiveSkillId at line 249. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Agent/Engine/Router.swift`: 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: LLM/Installation/Download/ResumableAssetDownloader.swift LLM/Installation/Download/ResumableAssetDownloader.swift:244 — LLM/Installation/Download/ResumableAssetDownloader.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in ResumableAssetDownloader.transfer at line 244. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- LLM/Installation/Download/ResumableAssetDownloader.swift`: 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: LLM/Backends/LiteRT/LiteRTBackend.swift LLM/Backends/LiteRT/LiteRTBackend.swift:582 — LLM/Backends/LiteRT/LiteRTBackend.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in LiteRTBackend.generate at line 582. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- LLM/Backends/LiteRT/LiteRTBackend.swift`: 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: Agent/Engine/ConversationMemoryPolicy.swift Agent/Engine/ConversationMemoryPolicy.swift:140 — Agent/Engine/ConversationMemoryPolicy.swift changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in ConversationMemoryPolicy.nextTrimmedPriorHistory at line 140. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Agent/Engine/ConversationMemoryPolicy.swift`: 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: Live/Audio/LiveAudioIO.swift Live/Audio/LiveAudioIO.swift:70 — Live/Audio/LiveAudioIO.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in LiveAudioIO.start at line 70. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Live/Audio/LiveAudioIO.swift`: 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: UI/SkillsManagerView.swift UI/SkillsManagerView.swift:277 — UI/SkillsManagerView.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in SkillDetailCard.body at line 277. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- UI/SkillsManagerView.swift`: 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: Tools/Handlers/Calendar.swift Tools/Handlers/Calendar.swift:416 — Tools/Handlers/Calendar.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in CalendarTools.presetRange at line 416. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Tools/Handlers/Calendar.swift`: 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: Tools/Handlers/Web.swift Tools/Handlers/Web.swift:1171 — Tools/Handlers/Web.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in WebTools.searchSuccess at line 1171. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Tools/Handlers/Web.swift`: 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: LLM/MLX/MLXLocalLLMService.swift LLM/MLX/MLXLocalLLMService.swift:637 — LLM/MLX/MLXLocalLLMService.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in MLXLocalLLMService.generateStream at line 637. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- LLM/MLX/MLXLocalLLMService.swift`: 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: Tools/AppPermissions.swift Tools/AppPermissions.swift:92 — Tools/AppPermissions.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in ToolRegistry.authorizationStatus at line 92. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Tools/AppPermissions.swift`: 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: Tools/Handlers/Clipboard.swift Tools/Handlers/Clipboard.swift:11 — Tools/Handlers/Clipboard.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in ClipboardTools.register at line 11. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Tools/Handlers/Clipboard.swift`: 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: Tools/Handlers/Contacts.swift Tools/Handlers/Contacts.swift:351 — Tools/Handlers/Contacts.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in ContactsTools.upsertCanonical at line 351. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- Tools/Handlers/Contacts.swift`: 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: LLM/MLX/Installation/LiveModelDownloader.swift LLM/MLX/Installation/LiveModelDownloader.swift:41 — LLM/MLX/Installation/LiveModelDownloader.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in LiveModelDownloader.downloadAll at line 41. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- LLM/MLX/Installation/LiveModelDownloader.swift`: 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.
D3 · God Classes · FileTooLong · ×22
  • FileTooLong: PhoneClawGateway/GatewayApp.swift MacGateway/Sources/PhoneClawGateway/GatewayApp.swift — FileTooLong — 2832 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2332 over it, 5.66× 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: Engine/ToolChain.swift Agent/Engine/ToolChain.swift — FileTooLong — 2391 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1891 over it, 4.78× 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: LLM/PromptBuilder.swift LLM/PromptBuilder.swift — FileTooLong — 2201 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: PromptBuilder (10-2856). The bar is 500 significant lines; this is 1701 over it, 4.40× 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/ContentView.swift UI/ContentView.swift — FileTooLong — 1860 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: ContentView (73-2250). The bar is 500 significant lines; this is 1360 over it, 3.72× 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/SherpaOnnx.swift Shared/Audio/SherpaOnnx.swift — FileTooLong — 1570 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1070 over it, 3.14× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: UI/ConfigurationsView.swift UI/ConfigurationsView.swift — FileTooLong — 1510 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: ConfigurationsView (8-1731). The bar is 500 significant lines; this is 1010 over it, 3.02× 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: Download/ResumableAssetDownloader.swift LLM/Installation/Download/ResumableAssetDownloader.swift — FileTooLong — 1228 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 728 over it, 2.46× 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: UI/ResponseUI.swift UI/ResponseUI.swift — FileTooLong — 1163 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 663 over it, 2.33× 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: PhoneClawEngine/PhoneClawEngine.swift LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift — FileTooLong — 1137 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: LiteRTLMEngine (161-1959). The bar is 500 significant lines; this is 637 over it, 2.27× 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: Engine/ProcessInput.swift Agent/Engine/ProcessInput.swift — FileTooLong — 815 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 315 over it, 1.63× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Core/LiveModeEngine.swift Live/Core/LiveModeEngine.swift — FileTooLong — 798 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: LiveModeEngine (115-1274). The bar is 500 significant lines; this is 298 over it, 1.60× 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: Engine/Router.swift Agent/Engine/Router.swift — FileTooLong — 764 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 264 over it, 1.53× 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: Remote/GatewayProviders.swift LLM/Backends/Remote/GatewayProviders.swift — FileTooLong — 689 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 189 over it, 1.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: PhoneClawGateway/GatewayProviders.swift MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift — FileTooLong — 689 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 189 over it, 1.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: MiniCPMV/MiniCPMVBackend.swift LLM/Backends/MiniCPMV/MiniCPMVBackend.swift — FileTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: MiniCPMVBackend (53-1268). The bar is 500 significant lines; this is 114 over it, 1.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: MLX/MLXLocalLLMService.swift LLM/MLX/MLXLocalLLMService.swift — FileTooLong — 606 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: MLXLocalLLMService (40-1006). The bar is 500 significant lines; this is 106 over it, 1.21× 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: Runtime/LiveLandVoiceRuntime.swift LiveLand/Runtime/LiveLandVoiceRuntime.swift — FileTooLong — 598 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: LiveLandVoiceRuntime (4-793). The bar is 500 significant lines; this is 98 over it, 1.20× 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: LiteRT/LiteRTBackend.swift LLM/Backends/LiteRT/LiteRTBackend.swift — FileTooLong — 572 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: LiteRTBackend (22-1006). The bar is 500 significant lines; this is 72 over it, 1.14× 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: Engine/Planner.swift Agent/Engine/Planner.swift — FileTooLong — 565 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 65 over it, 1.13× 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: TTS/TTSService.swift Live/TTS/TTSService.swift — FileTooLong — 522 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: TTSService (21-566). The bar is 500 significant lines; this is 22 over it, 1.04× 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: FoundationModels/IOS27FoundationModelsInferenceService.swift LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift — FileTooLong — 512 significant lines (blank, comment-only and punctuation-only lines excluded), about 63% of them inside a single declaration: FoundationModelsInferenceService (9-459). The bar is 500 significant lines; this is 12 over it, 1.02× 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: Widget/PhoneClawLiveActivityWidget.swift LiveLand/Widget/PhoneClawLiveActivityWidget.swift — FileTooLong — 503 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3 over it, 1.01× 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.
D3 · God Classes · MethodTooLong · ×19
  • MethodTooLong: AgentEngine.executeToolChain Agent/Engine/ToolChain.swift:2521 — MethodTooLong — executeToolChain runs 589 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 489 over it, 5.89× 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: AgentEngine.processInput Agent/Engine/ProcessInput.swift:13 — MethodTooLong — processInput runs 556 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 456 over it, 5.56× 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: AgentEngine.executePlannedSkillChainIfPossible Agent/Engine/Planner.swift:271 — MethodTooLong — executePlannedSkillChainIfPossible runs 386 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 286 over it, 3.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SkillDetailCard.body UI/SkillsManagerView.swift:277 — MethodTooLong — body runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× 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: LiveModeEngine.startLegacy Live/Core/LiveModeEngine.swift:243 — MethodTooLong — startLegacy runs 187 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 87 over it, 1.87× 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: ResumableAssetDownloader.transfer LLM/Installation/Download/ResumableAssetDownloader.swift:244 — MethodTooLong — transfer runs 184 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 84 over it, 1.84× 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: MLXLocalLLMService.generateStream LLM/MLX/MLXLocalLLMService.swift:637 — MethodTooLong — generateStream runs 184 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 84 over it, 1.84× 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: LiveModeEngine.processAudio Live/Core/LiveModeEngine.swift:863 — MethodTooLong — processAudio runs 180 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× 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: PromptBuilder.buildDialogueActPrompt LLM/PromptBuilder.swift:836 — MethodTooLong — buildDialogueActPrompt runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× 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: PromptBuilder.build LLM/PromptBuilder.swift:304 — MethodTooLong — build 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: MiniCPMVBackend.runLiveTransactionBody LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:980 — MethodTooLong — runLiveTransactionBody runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× 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: PromptBuilder.buildPreviousContextArtifactReplyPrompt LLM/PromptBuilder.swift:1011 — MethodTooLong — buildPreviousContextArtifactReplyPrompt 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: PromptBuilder.buildCompactToolAnswerPrompt LLM/PromptBuilder.swift:1523 — MethodTooLong — buildCompactToolAnswerPrompt 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: AgentEngine.latestPriorContextArtifact Agent/Engine/Router.swift:322 — MethodTooLong — latestPriorContextArtifact runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LiveModelDownloader.downloadAll LLM/MLX/Installation/LiveModelDownloader.swift:41 — MethodTooLong — downloadAll 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: ResumableAssetDownloader.downloadFile LLM/Installation/Download/ResumableAssetDownloader.swift:99 — MethodTooLong — downloadFile runs 114 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 14 over it, 1.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: LiteRTLMEngine.conversationSendStreaming LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1166 — MethodTooLong — conversationSendStreaming runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× 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: LiteRTBackend.load LLM/Backends/LiteRT/LiteRTBackend.swift:167 — MethodTooLong — load runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MLXLocalLLMService.downloadModel LLM/MLX/Installation/ModelDownloader.swift:151 — MethodTooLong — downloadModel runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×18
  • Duplicated block (8 lines × 2) Agent/Engine/GuardedSkillRouter.swift:182 — Agent/Engine/GuardedSkillRouter.swift:182-189 | Agent/Engine/GuardedSkillRouter.swift:198-205 — both copies are in the same file, so extract the 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 `Agent/Engine/GuardedSkillRouter.swift:182` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) LLM/Backends/Remote/MacGateway.swift:98 — LLM/Backends/Remote/MacGateway.swift:98-105 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:98-105 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) LLM/Backends/Remote/MacGateway.swift:155 — LLM/Backends/Remote/MacGateway.swift:155-162 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:155-162 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) LLM/Installation/Download/ResumableAssetDownloader.swift:838 — LLM/Installation/Download/ResumableAssetDownloader.swift:838-845 | LLM/Installation/Download/ResumableAssetDownloader.swift:1721-1728 — both copies are in the same file, so extract the 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 `LLM/Installation/Download/ResumableAssetDownloader.swift:838` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2145 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2145-2152 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3170-3177 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2153` calls `disabled`, `opacity` and `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3178` 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 (8 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3494 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3494-3501 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3514-3521 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3494` 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) UI/ConfigurationsView.swift:1140 — UI/ConfigurationsView.swift:1140-1147 | UI/ConfigurationsView.swift:1405-1412 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:1140` 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) UI/ResponseUI.swift:663 — UI/ResponseUI.swift:663-670 | UI/ResponseUI.swift:683-690 — both copies are in the same file, so extract the 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 `UI/ResponseUI.swift:663` 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 (8 lines × 2) LLM/Backends/Remote/LANDiscovery.swift:117 — LLM/Backends/Remote/LANDiscovery.swift:117-124 | MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift:117-124 — before extracting anything, compare `LLM/Backends/Remote/LANDiscovery.swift` and `MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) LLM/Installation/Download/ResumableAssetDownloader.swift:192 — LLM/Installation/Download/ResumableAssetDownloader.swift:192-199 | LLM/Installation/Download/ResumableAssetDownloader.swift:220-227 — both copies are in the same file, so extract the 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 `LLM/Installation/Download/ResumableAssetDownloader.swift:192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:219 — LLM/Backends/Remote/GatewayProviders.swift:219-226 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:219-226 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:408 — LLM/Backends/Remote/GatewayProviders.swift:408-415 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:408-415 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:960 — LLM/Backends/Remote/GatewayProviders.swift:960-967 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:960-967 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) LLM/Backends/Remote/MacGateway.swift:531 — LLM/Backends/Remote/MacGateway.swift:531-538 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:531-538 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) Live/Core/VoiceTurnController.swift:129 — Live/Core/VoiceTurnController.swift:129-136 | LiveLand/Core/LiveLandTurnController.swift:129-136 — before extracting anything, compare `Live/Core/VoiceTurnController.swift` and `LiveLand/Core/LiveLandTurnController.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) Tools/Handlers/Calendar.swift:662 — Tools/Handlers/Calendar.swift:662-669 | Tools/Helpers.swift:150-157 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) Tools/Handlers/Web.swift:535 — Tools/Handlers/Web.swift:535-542 | Tools/Handlers/Web.swift:553-560 — both copies are in the same file, so extract the 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 `Tools/Handlers/Web.swift:535` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) Tools/Handlers/Contacts.swift:377 — Tools/Handlers/Contacts.swift:377-384 | Tools/Handlers/Contacts.swift:458-465 — both copies are in the same file, so extract the 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 `Tools/Handlers/Contacts.swift:377` 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.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×17
  • Duplicated block (9 lines × 2) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:185 — Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:185-193 | Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:241-249 — both copies are in the same file, so extract the 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 `Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:185` 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) LLM/Installation/LiteRTModelStore.swift:789 — LLM/Installation/LiteRTModelStore.swift:789-797 | LLM/MLX/Installation/LiveModelStore.swift:406-414 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Installation/LiteRTModelStore.swift:789` 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) LiveLand/Widget/PhoneClawLiveActivityWidget.swift:584 — LiveLand/Widget/PhoneClawLiveActivityWidget.swift:584-592 | LiveLand/Widget/PhoneClawLiveActivityWidget.swift:595-603 — both copies are in the same file, so extract the 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 `LiveLand/Widget/PhoneClawLiveActivityWidget.swift:584` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1003 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1003-1011 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1663-1671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1014` calls `buildConversationTextMessageJSON` and `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1674` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2160 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2160-2168 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2773-2781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `10` in one and `8` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) UI/ConfigurationsView.swift:1381 — UI/ConfigurationsView.swift:1381-1389 | UI/ConfigurationsView.swift:1430-1438 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:1381` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) UI/RemoteMacSettingsView.swift:175 — UI/RemoteMacSettingsView.swift:175-183 | UI/RemoteMacSettingsView.swift:196-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `UI/RemoteMacSettingsView.swift:175` 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) UI/ResponseUI.swift:588 — UI/ResponseUI.swift:588-596 | UI/ResponseUI.swift:601-609 — both copies are in the same file, so extract the 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 `UI/ResponseUI.swift:588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) LLM/Backends/Remote/MacGateway.swift:369 — LLM/Backends/Remote/MacGateway.swift:369-377 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:369-377 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) LLM/Backends/Remote/LANDiscovery.swift:25 — LLM/Backends/Remote/LANDiscovery.swift:25-33 | MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift:25-33 — before extracting anything, compare `LLM/Backends/Remote/LANDiscovery.swift` and `MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2520 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2520-2528 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2784-2792 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2520` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:949 — LLM/Backends/Remote/GatewayProviders.swift:949-957 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:949-957 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:918 — LLM/Backends/Remote/GatewayProviders.swift:918-926 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:918-926 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) Live/VAD/VADService.swift:144 — Live/VAD/VADService.swift:144-152 | LiveLand/VAD/LiveLandVADService.swift:146-154 — before extracting anything, compare `Live/VAD/VADService.swift` and `LiveLand/VAD/LiveLandVADService.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 2) Tools/Handlers/Health.swift:380 — Tools/Handlers/Health.swift:380-388 | Tools/Handlers/Health.swift:984-992 — both copies are in the same file, so extract the 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 `Tools/Handlers/Health.swift:380` 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 (9 lines × 2) Tools/Handlers/Health.swift:1237 — Tools/Handlers/Health.swift:1237-1245 | Tools/Handlers/Health.swift:1359-1367 — both copies are in the same file, so extract the 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 `Tools/Handlers/Health.swift:1237` 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) Tools/Handlers/Health.swift:323 — Tools/Handlers/Health.swift:323-331 | Tools/Handlers/Health.swift:885-893 — both copies are in the same file, so extract the 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 `Tools/Handlers/Health.swift:323` 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.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×16
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/LANBinding.swift:110 — LLM/Backends/Remote/LANBinding.swift:110-114 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:440-444 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/RemoteInferenceService.swift:249 — LLM/Backends/Remote/RemoteInferenceService.swift:249-253 | LLM/Backends/Remote/RemoteInferenceService.swift:471-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) LLM/Core/GenerationTransaction.swift:140 — LLM/Core/GenerationTransaction.swift:140-144 | LLM/Core/GenerationTransaction.swift:178-182 — both copies are in the same file, so extract the 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 `LLM/Core/GenerationTransaction.swift:140` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:313 — LLM/Backends/Remote/GatewayProviders.swift:313-317 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:313-317 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:928 — LLM/Backends/Remote/GatewayProviders.swift:928-932 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:928-932 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/MacGateway.swift:130 — LLM/Backends/Remote/MacGateway.swift:130-134 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:130-134 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/MacGateway.swift:404 — LLM/Backends/Remote/MacGateway.swift:404-408 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:404-408 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/MacGateway.swift:510 — LLM/Backends/Remote/MacGateway.swift:510-514 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:510-514 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) LiveLand/Activity/LiveLandActivityBridge.swift:319 — LiveLand/Activity/LiveLandActivityBridge.swift:319-323 | LiveLand/Runtime/LiveLandVoiceRuntime.swift:788-792 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) LLM/Installation/Download/DownloadManifestStore.swift:172 — LLM/Installation/Download/DownloadManifestStore.swift:172-176 | LLM/Installation/Download/ResumableAssetDownloader.swift:1658-1662 — 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 (5 lines × 2) Agent/Engine/ToolChain.swift:2282 — Agent/Engine/ToolChain.swift:2282-2286 | Agent/Engine/ToolChain.swift:2322-2326 — both copies are in the same file, so extract the 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 `Agent/Engine/ToolChain.swift:2282` 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) LLM/Backends/Remote/GatewayProviders.swift:977 — LLM/Backends/Remote/GatewayProviders.swift:977-981 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:977-981 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:983 — LLM/Backends/Remote/GatewayProviders.swift:983-987 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:983-987 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) Skills/SkillLoader.swift:300 — Skills/SkillLoader.swift:300-304 | UI/SkillsManagerView.swift:262-266 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) UI/AudioUI.swift:283 — UI/AudioUI.swift:283-287 | UI/AudioUI.swift:385-389 — both copies are in the same file, so extract the 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 `UI/AudioUI.swift:283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Tools/Handlers/Health.swift:1066 — Tools/Handlers/Health.swift:1066-1070 | Tools/Handlers/Health.swift:1174-1178 — both copies are in the same file, so extract the 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 `Tools/Handlers/Health.swift:1066` 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, `Tools/Handlers/Health.swift:1179` calls `Date`, `date` and `Tools/Handlers/Health.swift:1071` 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.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×12
  • Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:990 — LLM/Backends/Remote/GatewayProviders.swift:990-992 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:990-992 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/MacGateway.swift:381 — LLM/Backends/Remote/MacGateway.swift:381-383 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:381-383 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/MacGateway.swift:84 — LLM/Backends/Remote/MacGateway.swift:84-86 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:84-86 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:914 — LLM/Backends/Remote/GatewayProviders.swift:914-916 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:914-916 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/MacGateway.swift:385 — LLM/Backends/Remote/MacGateway.swift:385-387 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:385-387 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) Agent/Engine/ToolChain.swift:2515 — Agent/Engine/ToolChain.swift:2515-2517 | Tools/Handlers/Web.swift:1743-1745 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/Installation/LiteRTModelStore.swift:804 — LLM/Installation/LiteRTModelStore.swift:804-806 | LLM/MLX/Installation/LiveModelStore.swift:421-423 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/MLX/Installation/LiveModelDefinition.swift:559 — LLM/MLX/Installation/LiveModelDefinition.swift:559-561 | LLM/MLX/Installation/ModelPaths.swift:31-33 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/LLMEngine.swift:24 — LLM/LLMEngine.swift:24-26 | LLM/MLX/MLXLocalLLMService.swift:514-516 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) Agent/Engine/GuardedSkillRouter.swift:207 — Agent/Engine/GuardedSkillRouter.swift:207-211 | Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:531-533 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/Backends/BackendDispatcher.swift:123 — LLM/Backends/BackendDispatcher.swift:123-125 | LLM/MLX/MLXLocalLLMService.swift:547-549 — These two members are one piece of code written twice and then edited apart: 3 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.
  • Edited copy of a member (3 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:373 — LLM/Backends/Remote/GatewayProviders.swift:373-375 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:373-375 — These two members are one piece of code written twice and then edited apart: 3 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×12
  • Low cohesion: MLMultiArray (LCOM4 6) Packages/FluidAudio/Sources/FluidAudio/Shared/ANEMemoryOptimizer.swift:184 — MLMultiArray's methods fall into 6 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 6 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: AgentEngine (LCOM4 6) Agent/AgentEngine.swift:65 — AgentEngine's methods fall into 6 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 6 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: MLXArray (LCOM4 5) Packages/mlx-swift/Source/MLX/MLXArray.swift:7 — MLXArray'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: ChatSession (LCOM4 5) Packages/InferenceKit/Libraries/MLXLMCommon/ChatSession.swift:21 — ChatSession'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: TextNormalizer (LCOM4 4) Packages/FluidAudio/Sources/FluidAudio/ITN/TextNormalizer.swift:20 — TextNormalizer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Module (LCOM4 4) Packages/mlx-swift/Source/MLXNN/Module.swift:97 — Module's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ToolRegistry (LCOM4 4) Tools/ToolRegistry.swift:177 — ToolRegistry's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LiteRTDownloadObserver (LCOM4 4) LLM/Installation/LiteRTModelStore.swift:768 — LiteRTDownloadObserver's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LiveDownloadObserver (LCOM4 4) LLM/MLX/Installation/LiveModelStore.swift:385 — LiveDownloadObserver's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: BaseKVCache (LCOM4 4) Packages/InferenceKit/Libraries/MLXLMCommon/KVCache.swift:122 — BaseKVCache's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: QuantizedKVCache (LCOM4 4) Packages/InferenceKit/Libraries/MLXLMCommon/KVCache.swift:728 — QuantizedKVCache's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ModelContainer (LCOM4 4) Packages/InferenceKit/Libraries/MLXLMCommon/ModelContainer.swift:32 — ModelContainer'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.
D3 · God Classes · ClassTooLong · ×11
  • ClassTooLong: PromptBuilder LLM/PromptBuilder.swift:10 — ClassTooLong — 2200 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 1800 over it, 5.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: ContentView UI/ContentView.swift:73 — ClassTooLong — 1494 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods. The bar is 400 significant lines; this is 1094 over it, 3.74× 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: ConfigurationsView UI/ConfigurationsView.swift:8 — ClassTooLong — 1204 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 804 over it, 3.01× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LiteRTLMEngine LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:160 — ClassTooLong — 1066 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 666 over it, 2.67× 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: LiveModeEngine Live/Core/LiveModeEngine.swift:114 — ClassTooLong — 733 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 333 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LiveLandVoiceRuntime LiveLand/Runtime/LiveLandVoiceRuntime.swift:3 — ClassTooLong — 596 significant lines (blank, comment-only and punctuation-only lines excluded), 43 methods. The bar is 400 significant lines; this is 196 over it, 1.49× 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: MLXLocalLLMService LLM/MLX/MLXLocalLLMService.swift:39 — ClassTooLong — 584 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 184 over it, 1.46× 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: MiniCPMVBackend LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:52 — ClassTooLong — 580 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 180 over it, 1.45× 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: LiteRTBackend LLM/Backends/LiteRT/LiteRTBackend.swift:21 — ClassTooLong — 568 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 168 over it, 1.42× 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: LiteRTModelStore LLM/Installation/LiteRTModelStore.swift:15 — ClassTooLong — 432 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 32 over it, 1.08× 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: ProbeView Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:31 — ClassTooLong — 423 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 23 over it, 1.06× 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×11
  • Duplicated block (14 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:83 — LLM/Backends/Remote/GatewayProviders.swift:83-96 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:83-96 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:565 — LLM/Backends/Remote/GatewayProviders.swift:565-578 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:565-578 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) LLM/Backends/Remote/MacGateway.swift:183 — LLM/Backends/Remote/MacGateway.swift:183-196 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:183-196 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:158 — LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:158-171 | LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:190-203 — both copies are in the same file, so extract the 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 `LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:158` 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 (14 lines × 2) LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:174 — LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:174-187 | LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:206-219 — both copies are in the same file, so extract the 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 `LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:174` 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 (14 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3398 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3398-3411 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3429-3442 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3398` 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 (14 lines × 2) UI/ConfigurationsView.swift:771 — UI/ConfigurationsView.swift:771-784 | UI/ConfigurationsView.swift:821-834 — both copies are in the same file, so extract the 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, `UI/ConfigurationsView.swift:770` calls `modelInstallLabel` and `UI/ConfigurationsView.swift:819` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) UI/ConfigurationsView.swift:1207 — UI/ConfigurationsView.swift:1207-1220 | UI/ConfigurationsView.swift:1505-1518 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:1207` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) UI/ResponseUI.swift:910 — UI/ResponseUI.swift:910-923 | UI/ResponseUI.swift:1092-1105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) LLM/Backends/Remote/MacGateway.swift:240 — LLM/Backends/Remote/MacGateway.swift:240-253 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:240-253 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) Tools/Handlers/Contacts.swift:616 — Tools/Handlers/Contacts.swift:616-629 | Tools/Handlers/Contacts.swift:700-713 — both copies are in the same file, so extract the 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 `Tools/Handlers/Contacts.swift:616` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×11
  • Duplicated block (6 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2588 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2588-2593 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2842-2847 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) LLM/Backends/Remote/MacGateway.swift:107 — LLM/Backends/Remote/MacGateway.swift:107-112 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:107-112 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) UI/ConfigurationsView.swift:298 — UI/ConfigurationsView.swift:298-303 | UI/ConfigurationsView.swift:438-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `UI/ConfigurationsView.swift:298` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:306 — LLM/Backends/Remote/GatewayProviders.swift:306-311 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:306-311 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:599 — LLM/Backends/Remote/GatewayProviders.swift:599-604 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:599-604 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) LLM/Backends/Remote/MacGateway.swift:410 — LLM/Backends/Remote/MacGateway.swift:410-415 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:410-415 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) LLM/Installation/LiteRTModelStore.swift:455 — LLM/Installation/LiteRTModelStore.swift:455-460 | LLM/MLX/Installation/LiveModelStore.swift:356-361 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) UI/ContentView.swift:2682 — UI/ContentView.swift:2682-2687 | UI/RemoteMacSettingsView.swift:266-271 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `UI/ContentView.swift:2678` calls `buttonStyle` and `UI/RemoteMacSettingsView.swift:262` 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 × 2) Agent/Engine/ToolChain.swift:1218 — Agent/Engine/ToolChain.swift:1218-1223 | Agent/Engine/ToolChain.swift:1428-1433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:934 — LLM/Backends/Remote/GatewayProviders.swift:934-939 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:934-939 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 2) Tools/Handlers/Web.swift:527 — Tools/Handlers/Web.swift:527-532 | Tools/Handlers/Web.swift:545-550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Tools/Handlers/Web.swift:527` 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.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×10
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift:394 — LLM/Backends/Remote/MacGateway.swift:394-397 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:394-397 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift:399 — LLM/Backends/Remote/MacGateway.swift:399-402 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:399-402 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:301 — LLM/Backends/Remote/GatewayProviders.swift:301-304 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:301-304 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift:389 — LLM/Backends/Remote/MacGateway.swift:389-392 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:389-392 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift:436 — LLM/Backends/Remote/MacGateway.swift:436-439 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:436-439 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift:88 — LLM/Backends/Remote/MacGateway.swift:88-91 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:88-91 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:319 — LLM/Backends/Remote/GatewayProviders.swift:319-322 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:319-322 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift:93 — LLM/Backends/Remote/MacGateway.swift:93-96 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:93-96 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Installation/LiteRTModelStore.swift:33 — LLM/Installation/LiteRTModelStore.swift:33-36 | LLM/MLX/Installation/ModelPaths.swift:19-25 — These two members are one piece of code written twice and then edited apart: 4 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.
  • Edited copy of a member (4 corresponding lines) LLM/Backends/Remote/MacGateway.swift:235 — LLM/Backends/Remote/MacGateway.swift:235-238 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:235-238 — These two members are one piece of code written twice and then edited apart: 4 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.
D3 · God Classes · TooManyMethods · ×9
  • TooManyMethods: AgentEngine Agent/AgentEngine.swift:65 — TooManyMethods — 255 methods, declared across 10 files: Engine/ToolChain.swift (102), Engine/EngineLifecycle.swift (37), Engine/Router.swift (32), Engine/ProcessInput.swift (18), +6 more file(s). The bar is 30 methods; this is 225 over it, 8.50× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MLXLocalLLMService LLM/MLX/MLXLocalLLMService.swift:39 — TooManyMethods — 51 methods, declared across 5 files: MLX/MLXLocalLLMService.swift (30), MLX/MLXLocalLLMService+KVReuse.swift (6), Core/GPULifecycle.swift (5), Installation/ModelDownloader.swift (5), +1 more file(s). The bar is 30 methods; this is 21 over it, 1.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PromptBuilder LLM/PromptBuilder.swift:10 — TooManyMethods — 45 methods, declared across 2 files: LLM/PromptBuilder.swift (43), LiveVoice/PromptBuilder+LiveVoice.swift (2). The bar is 30 methods; this is 15 over it, 1.50× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ConfigurationsView UI/ConfigurationsView.swift:8 — TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.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.
  • TooManyMethods: LiveLandVoiceRuntime LiveLand/Runtime/LiveLandVoiceRuntime.swift:3 — TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× 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: ContentView UI/ContentView.swift:73 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LiteRTLMEngine LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:160 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LiteRTModelStore LLM/Installation/LiteRTModelStore.swift:15 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× 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: GatewayModel MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:484 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×9
  • Duplicated block (13 lines × 2) Agent/Engine/ConversationMemoryPolicy.swift:29 — Agent/Engine/ConversationMemoryPolicy.swift:29-41 | Agent/Engine/ConversationMemoryPolicy.swift:54-66 — both copies are in the same file, so extract the 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 `Agent/Engine/ConversationMemoryPolicy.swift:29` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) LLM/MLX/Gemma4/Gemma4TextModel.swift:157 — LLM/MLX/Gemma4/Gemma4TextModel.swift:157-169 | LLM/MLX/Gemma4/Gemma4TextModel.swift:201-213 — both copies are in the same file, so extract the 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 `LLM/MLX/Gemma4/Gemma4TextModel.swift:201` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (13 lines × 2) LLM/PromptBuilder.swift:1192 — LLM/PromptBuilder.swift:1192-1204 | LLM/PromptBuilder.swift:1280-1292 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:1192` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `LLM/PromptBuilder.swift:1294` calls `sanitizedAssistantHistoryContent`, `trimmingCharacters` and `LLM/PromptBuilder.swift:1206` 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 (13 lines × 2) Live/Audio/LiveAudioIO.swift:243 — Live/Audio/LiveAudioIO.swift:243-255 | LiveLand/Audio/LiveLandAudioIO.swift:217-229 — before extracting anything, compare `Live/Audio/LiveAudioIO.swift` and `LiveLand/Audio/LiveLandAudioIO.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Live/Audio/LiveAudioIO.swift:243` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2550 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2550-2562 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2805-2817 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2550` 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 lines × 2) UI/AudioUI.swift:296 — UI/AudioUI.swift:296-308 | UI/AudioUI.swift:392-404 — both copies are in the same file, so extract the 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 `UI/AudioUI.swift:296` 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 lines × 2) UI/ConfigurationsView.swift:69 — UI/ConfigurationsView.swift:69-81 | UI/SkillsManagerView.swift:33-45 — 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 `UI/ConfigurationsView.swift:69` 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 (13 lines × 2) UI/ConfigurationsView.swift:570 — UI/ConfigurationsView.swift:570-582 | UI/ConfigurationsView.swift:588-600 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:570` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:843 — LLM/Backends/Remote/GatewayProviders.swift:843-855 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:843-855 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×9
  • Swallowed exception (caught, then discarded) UI/ContentView.swift:2290 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1916 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) LiveLand/Core/LiveLandTurnController.swift:105 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) LiveLand/Core/LiveLandTurnController.swift:118 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Live/Core/LiveModeEngine.swift:716 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Live/Core/VoiceTurnController.swift:105 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Live/Core/VoiceTurnController.swift:118 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) LLM/Backends/Remote/LANBinding.swift:343 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift:31 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×8
  • Duplicated block (12 lines × 2) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:239 — LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:239-250 | LLM/Backends/Remote/RemoteInferenceService.swift:258-269 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:251` calls `detach` and `LLM/Backends/Remote/RemoteInferenceService.swift:270` 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 (12 lines × 2) LLM/Backends/Remote/MacGateway.swift:136 — LLM/Backends/Remote/MacGateway.swift:136-147 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:136-147 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) LLM/Installation/Download/ResumableAssetDownloader.swift:765 — LLM/Installation/Download/ResumableAssetDownloader.swift:765-776 | LLM/Installation/Download/ResumableAssetDownloader.swift:1496-1507 — both copies are in the same file, so extract the 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 `LLM/Installation/Download/ResumableAssetDownloader.swift:765` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (12 lines × 2) Live/TTS/TTSService.swift:125 — Live/TTS/TTSService.swift:125-136 | Live/TTS/TTSService.swift:187-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) UI/AudioUI.swift:53 — UI/AudioUI.swift:53-64 | UI/AudioUI.swift:305-316 — both copies are in the same file, so extract the 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 `UI/AudioUI.swift:53` 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) UI/ConfigurationsView.swift:1223 — UI/ConfigurationsView.swift:1223-1234 | UI/ConfigurationsView.swift:1521-1532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:506 — LLM/Backends/Remote/GatewayProviders.swift:506-517 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:506-517 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) Tools/Handlers/Clipboard.swift:170 — Tools/Handlers/Clipboard.swift:170-181 | Tools/Handlers/Clipboard.swift:191-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Tools/Handlers/Clipboard.swift:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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.
D10 · Test Quality · Skipped test · ×7
  • Skipped test: testWiredMemoryPolicyStackingAndCustomPolicies Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:43 — Skipped — throws XCTSkip
  • Skipped test: testReservationOnlyKeepsLimitAtBaseline Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:146 — Skipped — throws XCTSkip
  • Skipped test: testReservationPlusActiveRaisesAndRestoresBaseline Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:189 — Skipped — throws XCTSkip
  • Skipped test: testHysteresisPreventsSmallShrinkWhileActive Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:248 — Skipped — throws XCTSkip
  • Skipped test: testCooldownPreventsRapidOscillationWhileActive Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:316 — Skipped — throws XCTSkip
  • Skipped test: testAdmissionUsesReservationSizesAndActiveSizes Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:391 — Skipped — throws XCTSkip
  • Skipped test: testPolicyOnlyModeEnforcesAdmissionOnCPU Packages/mlx-swift/Tests/MLXTests/WiredMemoryTests.swift:455 — Skipped — throws XCTSkip
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×7
  • Members sharing a duplicated core (4 members, 50+ identical tokens) LLM/Backends/Remote/GatewayProviders.swift:228 — LLM/Backends/Remote/GatewayProviders.swift:228-252 | LLM/Backends/Remote/GatewayProviders.swift:258-276 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:228-252 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:258-276 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) LLM/Backends/Remote/LANBinding.swift:116 — LLM/Backends/Remote/LANBinding.swift:116-130 | LLM/Backends/Remote/MacGateway.swift:114-128 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:446-460 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:114-128 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) LLM/Backends/Remote/MacGateway.swift:310 — LLM/Backends/Remote/MacGateway.swift:310-335 | LLM/Backends/Remote/MacGateway.swift:338-367 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:310-335 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:338-367 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1166 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1166-1317 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1356-1426 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1474-1557 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1712-1825 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1093 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1093-1120 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1505-1573 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3373-3390 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3695-3711 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) UI/ConfigurationsView.swift:1552 — UI/ConfigurationsView.swift:1552-1569 | UI/ConfigurationsView.swift:1571-1588 | UI/ConfigurationsView.swift:2019-2036 | UI/ConfigurationsView.swift:2038-2055 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Tools/Handlers/Health.swift:656 — Tools/Handlers/Health.swift:656-680 | Tools/Handlers/Health.swift:682-707 | Tools/Handlers/Health.swift:709-734 | Tools/Handlers/Health.swift:736-761 — 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 · Duplicated block (19 lines × 2) · ×7
  • Duplicated block (19 lines × 2) Agent/Engine/IOS27FoundationSkillRouter.swift:423 — Agent/Engine/IOS27FoundationSkillRouter.swift:423-441 | LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:440-458 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:258 — LLM/Backends/Remote/GatewayProviders.swift:258-276 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:258-276 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:468 — LLM/Backends/Remote/GatewayProviders.swift:468-486 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:468-486 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) LLM/MLX/Gemma4/Gemma4Model.swift:96 — LLM/MLX/Gemma4/Gemma4Model.swift:96-114 | LLM/MLX/Gemma4/Gemma4Model.swift:131-149 — both copies are in the same file, so extract the 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 `LLM/MLX/Gemma4/Gemma4Model.swift:96` 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 (19 lines × 2) LLM/Backends/Remote/LANDiscovery.swift:133 — LLM/Backends/Remote/LANDiscovery.swift:133-151 | MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift:133-151 — before extracting anything, compare `LLM/Backends/Remote/LANDiscovery.swift` and `MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) LLM/Backends/Remote/MacGateway.swift:289 — LLM/Backends/Remote/MacGateway.swift:289-307 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:289-307 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 2) LLM/Backends/Remote/MacGateway.swift:454 — LLM/Backends/Remote/MacGateway.swift:454-472 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:454-472 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×6
  • Edited copy of a member (7 corresponding lines) LLM/MLX/Installation/LiveDownloadPlanner.swift:133 — LLM/MLX/Installation/LiveDownloadPlanner.swift:133-139 | LLM/MLX/Installation/LiveDownloadPlanner.swift:242-248 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:522 — LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:522-531 | LLM/Backends/Remote/RemoteInferenceService.swift:575-581 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1340 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1340-1349 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2271-2277 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:595 — LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:595-601 | LLM/Installation/Download/DownloadManifestStore.swift:198-205 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) LLM/Backends/BackendDispatcher.swift:127 — LLM/Backends/BackendDispatcher.swift:127-133 | LLM/MLX/MLXLocalLLMService.swift:551-562 — These two members are one piece of code written twice and then edited apart: 7 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.
  • Edited copy of a member (7 corresponding lines) Tools/Handlers/Health.swift:1601 — Tools/Handlers/Health.swift:1601-1607 | Tools/Handlers/Health.swift:1609-1615 — These two members are one piece of code written twice and then edited apart: 7 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 · Duplicated block (24 lines × 2) · ×6
  • Duplicated block (24 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:128 — LLM/Backends/Remote/GatewayProviders.swift:128-151 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:128-151 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (24 lines × 2) LLM/PromptBuilder.swift:1710 — LLM/PromptBuilder.swift:1710-1733 | LLM/PromptBuilder.swift:1735-1758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) LLM/PromptBuilder.swift:1816 — LLM/PromptBuilder.swift:1816-1839 | LLM/PromptBuilder.swift:1904-1927 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:1816` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `currentImageCount` to `Int = 0` in one and `Int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (24 lines × 2) LLM/PromptBuilder.swift:1840 — LLM/PromptBuilder.swift:1840-1863 | LLM/PromptBuilder.swift:1930-1953 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:1840` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `currentImageCount` to `Int = 0` in one and `Int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (24 lines × 2) LLM/PromptBuilder.swift:2611 — LLM/PromptBuilder.swift:2611-2634 | LLM/PromptBuilder.swift:2638-2661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (24 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:439 — LLM/Backends/Remote/GatewayProviders.swift:439-462 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:439-462 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×6
  • Duplicated block (17 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:110 — LLM/Backends/Remote/GatewayProviders.swift:110-126 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:110-126 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) LLM/Backends/Remote/MacGateway.swift:417 — LLM/Backends/Remote/MacGateway.swift:417-433 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:417-433 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) LLM/MLX/MLXLocalLLMService.swift:265 — LLM/MLX/MLXLocalLLMService.swift:265-281 | LLM/MLX/MLXLocalLLMService.swift:322-338 — both copies are in the same file, so extract the 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 `LLM/MLX/MLXLocalLLMService.swift:265` 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 (17 lines × 2) Live/VAD/VADService.swift:165 — Live/VAD/VADService.swift:165-181 | LiveLand/VAD/LiveLandVADService.swift:167-183 — before extracting anything, compare `Live/VAD/VADService.swift` and `LiveLand/VAD/LiveLandVADService.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) Live/Core/VoiceTurnController.swift:78 — Live/Core/VoiceTurnController.swift:78-94 | LiveLand/Core/LiveLandTurnController.swift:78-94 — before extracting anything, compare `Live/Core/VoiceTurnController.swift` and `LiveLand/Core/LiveLandTurnController.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (17 lines × 2) Tools/Handlers/Contacts.swift:35 — Tools/Handlers/Contacts.swift:35-51 | Tools/Handlers/Contacts.swift:59-75 — both copies are in the same file, so extract the 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 `Tools/Handlers/Contacts.swift:35` 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.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×6
  • Duplicated block (15 lines × 2) Agent/Engine/Router.swift:430 — Agent/Engine/Router.swift:430-444 | Agent/Engine/Router.swift:446-460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) Agent/Engine/ToolChain.swift:737 — Agent/Engine/ToolChain.swift:737-751 | Agent/Engine/ToolChain.swift:754-768 — both copies are in the same file, so extract the 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 `Agent/Engine/ToolChain.swift: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15 lines × 2) LiveLand/Widget/PhoneClawLiveActivityWidget.swift:428 — LiveLand/Widget/PhoneClawLiveActivityWidget.swift:428-442 | LiveLand/Widget/PhoneClawLiveActivityWidget.swift:485-499 — both copies are in the same file, so extract the 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 `LiveLand/Widget/PhoneClawLiveActivityWidget.swift:428` 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) UI/SkillsManagerView.swift:52 — UI/SkillsManagerView.swift:52-66 | UI/SkillsManagerView.swift:78-92 — both copies are in the same file, so extract the 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 `UI/SkillsManagerView.swift:52` 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) Tools/Handlers/Health.swift:452 — Tools/Handlers/Health.swift:452-466 | Tools/Handlers/Health.swift:476-490 — both copies are in the same file, so extract the 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 `Tools/Handlers/Health.swift:452` 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 (15 lines × 2) Tools/Handlers/Health.swift:1286 — Tools/Handlers/Health.swift:1286-1300 | Tools/Handlers/Health.swift:1360-1374 — both copies are in the same file, so extract the 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 `Tools/Handlers/Health.swift:1286` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×6
  • Duplicated block (11 lines × 2) Agent/Engine/ProcessInput.swift:356 — Agent/Engine/ProcessInput.swift:356-366 | Agent/Engine/ProcessInput.swift:748-758 — both copies are in the same file, so extract the 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 `Agent/Engine/ProcessInput.swift:356` 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, `Agent/Engine/ProcessInput.swift:355` calls `log` and `Agent/Engine/ProcessInput.swift:747` 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) Agent/Engine/Router.swift:583 — Agent/Engine/Router.swift:583-593 | Agent/Engine/Router.swift:777-787 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Agent/Engine/ToolChain.swift:429 — Agent/Engine/ToolChain.swift:429-439 | Agent/Engine/ToolChain.swift:459-469 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Agent/Engine/ToolChain.swift:429` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:324 — LLM/Backends/Remote/GatewayProviders.swift:324-334 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:324-334 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) LLM/Backends/Remote/MacGateway.swift:442 — LLM/Backends/Remote/MacGateway.swift:442-452 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:442-452 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (11 lines × 2) LLM/Backends/Remote/MacGateway.swift:518 — LLM/Backends/Remote/MacGateway.swift:518-528 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:518-528 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×6
  • Duplicated block (7 lines × 2) LLM/PromptBuilder.swift:843 — LLM/PromptBuilder.swift:843-849 | LLM/PromptBuilder.swift:1023-1029 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:843` 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) UI/ConfigurationsView.swift:1118 — UI/ConfigurationsView.swift:1118-1124 | UI/ConfigurationsView.swift:1149-1155 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:1118` 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 (7 lines × 2) UI/ConfigurationsView.swift:1131 — UI/ConfigurationsView.swift:1131-1137 | UI/ConfigurationsView.swift:1396-1402 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:1131` 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) Agent/Engine/ToolChain.swift:2461 — Agent/Engine/ToolChain.swift:2461-2467 | Tools/Handlers/Web.swift:1691-1697 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Agent/Engine/ToolChain.swift:2461` 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) LLM/Backends/Remote/MacGateway.swift:68 — LLM/Backends/Remote/MacGateway.swift:68-74 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:68-74 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) Tools/Handlers/Reminders.swift:196 — Tools/Handlers/Reminders.swift:196-202 | Tools/Handlers/Reminders.swift:251-257 — both copies are in the same file, so extract the 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 `Tools/Handlers/Reminders.swift:196` 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.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×5
  • Duplicated block (10 lines × 2) Agent/Engine/ToolChain.swift:2495 — Agent/Engine/ToolChain.swift:2495-2504 | Tools/Handlers/Web.swift:1723-1732 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Agent/Engine/ToolChain.swift:2495` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:424 — LLM/Backends/Remote/GatewayProviders.swift:424-433 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:424-433 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2945 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2945-2954 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2964-2973 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2945` 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) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3543 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3543-3552 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3561-3570 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3543` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Agent/Engine/ToolChain.swift:202 — Agent/Engine/ToolChain.swift:202-211 | Agent/Engine/ToolChain.swift:213-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Agent/Engine/ToolChain.swift:213` 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.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×4
  • Edited copy of a member (21 corresponding lines) LLM/Installation/LiteRTModelStore.swift:419 — LLM/Installation/LiteRTModelStore.swift:419-453 | LLM/MLX/Installation/LiveModelStore.swift:334-354 — 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.
  • Edited copy of a member (21 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2208 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2208-2228 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3450-3471 — 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.
  • Edited copy of a member (21 corresponding lines) LLM/Backends/LiteRT/LiteRTBackend.swift:418 — LLM/Backends/LiteRT/LiteRTBackend.swift:418-438 | LLM/Backends/LiteRT/LiteRTBackend.swift:475-506 — 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.
  • Edited copy of a member (21 corresponding lines) Agent/Engine/Router.swift:579 — Agent/Engine/Router.swift:579-599 | Agent/Engine/Router.swift:679-702 — 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 (19 corresponding lines) · ×4
  • Edited copy of a member (19 corresponding lines) UI/ResponseUI.swift:661 — UI/ResponseUI.swift:661-679 | UI/ResponseUI.swift:681-702 — These two members are one piece of code written twice and then edited apart: 19 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.
  • Edited copy of a member (19 corresponding lines) LLM/MLX/Gemma4/Gemma4LanguageModel.swift:329 — LLM/MLX/Gemma4/Gemma4LanguageModel.swift:329-347 | LLM/MLX/Gemma4/Gemma4Model.swift:264-289 — These two members are one piece of code written twice and then edited apart: 19 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.
  • Edited copy of a member (19 corresponding lines) Live/Audio/LiveAudioIO.swift:214 — Live/Audio/LiveAudioIO.swift:214-239 | LiveLand/Audio/LiveLandAudioIO.swift:195-213 — These two members are one piece of code written twice and then edited apart: 19 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.
  • Edited copy of a member (19 corresponding lines) LLM/MLX/Installation/LiveModelDefinition.swift:53 — LLM/MLX/Installation/LiveModelDefinition.swift:53-73 | Tools/ToolRegistry.swift:156-174 — These two members are one piece of code written twice and then edited apart: 19 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 (17 corresponding lines) · ×4
  • Edited copy of a member (17 corresponding lines) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:840 — LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:840-858 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:1232-1248 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) Shared/Audio/SherpaOnnx.swift:1015 — Shared/Audio/SherpaOnnx.swift:1015-1031 | Shared/Audio/SherpaOnnx.swift:1033-1049 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) Shared/Audio/SherpaOnnx.swift:1051 — Shared/Audio/SherpaOnnx.swift:1051-1067 | Shared/Audio/SherpaOnnx.swift:2104-2120 — These two members are one piece of code written twice and then edited apart: 17 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.
  • Edited copy of a member (17 corresponding lines) Tools/Handlers/Web.swift:526 — Tools/Handlers/Web.swift:526-542 | Tools/Handlers/Web.swift:544-560 — These two members are one piece of code written twice and then edited apart: 17 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) · ×4
  • Edited copy of a member (9 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2453 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2453-2461 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3359-3367 — 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.
  • Edited copy of a member (9 corresponding lines) Shared/PCLog.swift:187 — Shared/PCLog.swift:187-196 | Agent/Engine/PromptObservation.swift:45-53 — 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.
  • Edited copy of a member (9 corresponding lines) LLM/Backends/LiteRT/LiteRTBackend.swift:109 — LLM/Backends/LiteRT/LiteRTBackend.swift:109-118 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:140-148 — 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.
  • Edited copy of a member (9 corresponding lines) LLM/MLX/Installation/LiveModelDownloader.swift:323 — LLM/MLX/Installation/LiveModelDownloader.swift:323-331 | LLM/MLX/Installation/ModelDownloader.swift:107-115 — 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 copy of a member (12 corresponding lines) · ×4
  • Edited copy of a member (12 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3475 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3475-3486 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3528-3539 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDToken.swift:69 — LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDToken.swift:69-81 | LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDToken.swift:98-109 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) LLM/Backends/Remote/LANBinding.swift:138 — LLM/Backends/Remote/LANBinding.swift:138-149 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:468-479 — These two members are one piece of code written twice and then edited apart: 12 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.
  • Edited copy of a member (12 corresponding lines) Tools/Handlers/Calendar.swift:661 — Tools/Handlers/Calendar.swift:661-672 | Tools/Helpers.swift:149-160 — These two members are one piece of code written twice and then edited apart: 12 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 (11 corresponding lines) · ×4
  • Edited copy of a member (11 corresponding lines) LiveLand/Widget/PhoneClawLiveActivityWidget.swift:558 — LiveLand/Widget/PhoneClawLiveActivityWidget.swift:558-568 | LiveLand/Widget/PhoneClawLiveActivityWidget.swift:625-636 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) LLM/Core/LLMTypes.swift:287 — LLM/Core/LLMTypes.swift:287-297 | Tools/Handlers/Web.swift:1747-1757 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) LLM/Core/InferenceService.swift:362 — LLM/Core/InferenceService.swift:362-372 | LLM/Core/InferenceService.swift:374-385 — These two members are one piece of code written twice and then edited apart: 11 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.
  • Edited copy of a member (11 corresponding lines) UI/ResponseUI.swift:342 — UI/ResponseUI.swift:342-352 | UI/ResponseUI.swift:464-474 — These two members are one piece of code written twice and then edited apart: 11 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 (6 corresponding lines) · ×4
  • Edited copy of a member (6 corresponding lines) LLM/Backends/Remote/LANBinding.swift:109 — LLM/Backends/Remote/LANBinding.swift:109-114 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:439-444 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:305 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:305-310 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:312-317 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) UI/ConfigurationsView.swift:154 — UI/ConfigurationsView.swift:154-159 | UI/RemoteMacSettingsView.swift:280-285 — These two members are one piece of code written twice and then edited apart: 6 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.
  • Edited copy of a member (6 corresponding lines) Live/UI/LiveModeUI.swift:536 — Live/UI/LiveModeUI.swift:536-541 | UI/ConfigurationsView.swift:1725-1730 — These two members are one piece of code written twice and then edited apart: 6 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 · Duplicated block (30 lines × 2) · ×4
  • Duplicated block (30 lines × 2) Agent/Engine/ProcessInput.swift:441 — Agent/Engine/ProcessInput.swift:441-470 | Agent/Engine/ProcessInput.swift:512-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (30 lines × 2) LLM/MLX/Installation/LiveModelDownloader.swift:150 — LLM/MLX/Installation/LiveModelDownloader.swift:150-179 | LLM/MLX/Installation/ModelDownloader.swift:234-263 — 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 `LLM/MLX/Installation/LiveModelDownloader.swift:150` 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 (30 lines × 2) Live/VAD/VADService.swift:212 — Live/VAD/VADService.swift:212-241 | LiveLand/VAD/LiveLandVADService.swift:214-243 — before extracting anything, compare `Live/VAD/VADService.swift` and `LiveLand/VAD/LiveLandVADService.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (30 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:773 — LLM/Backends/Remote/GatewayProviders.swift:773-802 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:773-802 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D17 · Explicit Debt · TodoComment · ×3
  • TodoComment Live/Core/LiveModeEngine.swift:923 — // TODO: per-model tuning via catalog — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment LLM/PromptBuilder.swift:2112 — /// 污染 R1 cache 的方案缓解 (TODO: cache snapshot/restore around R2). — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment LLM/MLX/MLXLocalLLMService.swift:734 — // TODO: 抽出 ModelAdapter 协议后移除 Gemma 专属耦合 — 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.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×3
  • Edited copy of a member (24 corresponding lines) UI/ConfigurationsView.swift:204 — UI/ConfigurationsView.swift:204-244 | UI/ConfigurationsView.swift:474-505 — These two members are one piece of code written twice and then edited apart: 24 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.
  • Edited copy of a member (24 corresponding lines) UI/ConfigurationsView.swift:1192 — UI/ConfigurationsView.swift:1192-1220 | UI/ConfigurationsView.swift:1495-1518 — These two members are one piece of code written twice and then edited apart: 24 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.
  • Edited copy of a member (24 corresponding lines) UI/RemoteMacSettingsView.swift:80 — UI/RemoteMacSettingsView.swift:80-103 | UI/SkillsManagerView.swift:180-204 — These two members are one piece of code written twice and then edited apart: 24 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 (10 corresponding lines) · ×3
  • Edited copy of a member (10 corresponding lines) LLM/MLX/Installation/LiveModelDefinition.swift:583 — LLM/MLX/Installation/LiveModelDefinition.swift:583-592 | LLM/MLX/Installation/ModelPaths.swift:56-66 — 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.
  • Edited copy of a member (10 corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2627 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2627-2636 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2898-2907 — 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.
  • Edited copy of a member (10 corresponding lines) Tools/Handlers/Health.swift:1543 — Tools/Handlers/Health.swift:1543-1552 | Tools/Handlers/Web.swift:1396-1405 — 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 copies of one member (3 members, 4+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 4+ corresponding lines) UI/Theme.swift:82 — UI/Theme.swift:82-85 | UI/Theme.swift:104-112 | UI/Theme.swift:116-124 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 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.
  • Edited copies of one member (3 members, 4+ corresponding lines) LLM/Installation/Download/DownloadManifestStore.swift:165 — LLM/Installation/Download/DownloadManifestStore.swift:165-170 | LLM/Installation/Download/ResumableAssetDownloader.swift:1509-1512 | LLM/MLX/Installation/LiveModelInstallFinalizer.swift:74-77 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 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.
  • Edited copies of one member (3 members, 4+ corresponding lines) LLM/MLX/Gemma4/Gemma4AudioModel.swift:37 — LLM/MLX/Gemma4/Gemma4AudioModel.swift:37-40 | LLM/MLX/Gemma4/Gemma4TextModel.swift:26-29 | LLM/MLX/Gemma4/Gemma4VisionModel.swift:135-138 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 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 · Duplicated block (31 lines × 2) · ×3
  • Duplicated block (31 lines × 2) Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift:63 — Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift:63-93 | Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:544-574 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (31 lines × 2) UI/AudioUI.swift:12 — UI/AudioUI.swift:12-42 | UI/AudioUI.swift:350-380 — both copies are in the same file, so extract the 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 `UI/AudioUI.swift:12` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `UI/AudioUI.swift:381` calls `frame` and `UI/AudioUI.swift:45` 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 (31 lines × 2) LLM/Backends/Remote/MacGateway.swift:25 — LLM/Backends/Remote/MacGateway.swift:25-55 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:25-55 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×3
  • Duplicated block (28 lines × 2) LLM/Backends/Remote/MacGateway.swift:198 — LLM/Backends/Remote/MacGateway.swift:198-225 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:198-225 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/MacGateway.swift:198` 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 (28 lines × 2) Live/VAD/VADService.swift:114 — Live/VAD/VADService.swift:114-141 | LiveLand/VAD/LiveLandVADService.swift:116-143 — before extracting anything, compare `Live/VAD/VADService.swift` and `LiveLand/VAD/LiveLandVADService.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (28 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:536 — LLM/Backends/Remote/GatewayProviders.swift:536-563 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:536-563 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×3
  • Duplicated block (25 lines × 2) LLM/Backends/LiteRT/LiteRTBackend.swift:660 — LLM/Backends/LiteRT/LiteRTBackend.swift:660-684 | LLM/Backends/LiteRT/LiteRTBackend.swift:917-941 — both copies are in the same file, so extract the 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 `LLM/Backends/LiteRT/LiteRTBackend.swift:660` 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 (25 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:228 — LLM/Backends/Remote/GatewayProviders.swift:228-252 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:228-252 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (25 lines × 2) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:799 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:799-823 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1177-1201 — both copies are in the same file, so extract the 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:799` 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.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) LLM/PromptBuilder.swift:1793 — LLM/PromptBuilder.swift:1793-1815 | LLM/PromptBuilder.swift:1879-1901 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:1793` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `currentImageCount` to `Int = 0` in one and `Int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (23 lines × 2) UI/ResponseUI.swift:387 — UI/ResponseUI.swift:387-409 | UI/ResponseUI.swift:520-542 — both copies are in the same file, so extract the 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 `UI/ResponseUI.swift:387` 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 (23 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:153 — LLM/Backends/Remote/GatewayProviders.swift:153-175 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:153-175 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×3
  • Duplicated block (22 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:278 — LLM/Backends/Remote/GatewayProviders.swift:278-299 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:278-299 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (22 lines × 2) LLM/Backends/Remote/MacGateway.swift:314 — LLM/Backends/Remote/MacGateway.swift:314-335 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:314-335 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/MacGateway.swift:314` 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 (22 lines × 2) LLM/PromptBuilder.swift:2435 — LLM/PromptBuilder.swift:2435-2456 | LLM/PromptBuilder.swift:2539-2560 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:2435` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×3
  • Duplicated block (21 lines × 2) Live/Audio/LiveAudioIO.swift:178 — Live/Audio/LiveAudioIO.swift:178-198 | LiveLand/Audio/LiveLandAudioIO.swift:170-190 — before extracting anything, compare `Live/Audio/LiveAudioIO.swift` and `LiveLand/Audio/LiveLandAudioIO.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Live/Audio/LiveAudioIO.swift:178` 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 (21 lines × 2) UI/ContentView.swift:2657 — UI/ContentView.swift:2657-2677 | UI/RemoteMacSettingsView.swift:243-263 — 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 `UI/ContentView.swift:2657` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `UI/ContentView.swift:2678` calls `buttonStyle` and `UI/RemoteMacSettingsView.swift:266` 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 (21 lines × 2) Tools/Handlers/Contacts.swift:485 — Tools/Handlers/Contacts.swift:485-505 | Tools/Handlers/Contacts.swift:584-604 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Tools/Handlers/Contacts.swift:583` calls `trimmingCharacters`, `CharacterSet` and `Tools/Handlers/Contacts.swift:483` 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.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×3
  • Duplicated block (12 lines × 3) Agent/Engine/ToolChain.swift:2629 — Agent/Engine/ToolChain.swift:2629-2640 | Agent/Engine/ToolChain.swift:2710-2721 | Agent/Engine/ToolChain.swift:2862-2873 — 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 `Agent/Engine/ToolChain.swift:2629` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Agent/Engine/ToolChain.swift:2722` calls `log` and `Agent/Engine/ToolChain.swift:2641` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) scripts/test-resumable-downloader.swift:123 — scripts/test-resumable-downloader.swift:123-135 | scripts/test-resumable-downloader.swift:177-188 | scripts/test-resumable-downloader.swift:225-236 — 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 `scripts/test-resumable-downloader.swift:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/test-resumable-downloader.swift:176` calls `prefix`, `write`, `writeManifest` and `scripts/test-resumable-downloader.swift:123` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) Tools/Handlers/Calendar.swift:848 — Tools/Handlers/Calendar.swift:848-859 | Tools/Handlers/Contacts.swift:760-771 | Tools/Handlers/Reminders.swift:268-279 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) Agent/AgentEngine.swift:492 — Agent/AgentEngine.swift:492-502 | Agent/AgentEngine.swift:540-551 — both copies are in the same file, so extract the 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 `Agent/AgentEngine.swift:492` 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 × 2) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1364 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1364-1375 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1753-1763 — both copies are in the same file, so extract the 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1364` 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 × 2) UI/ContentView.swift:843 — UI/ContentView.swift:843-854 | UI/ContentView.swift:878-888 — both copies are in the same file, so extract the 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 `UI/ContentView.swift:843` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) UI/AudioUI.swift:17 — UI/AudioUI.swift:17-27 | UI/AudioUI.swift:235-245 | UI/AudioUI.swift:355-365 — 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 `UI/AudioUI.swift:17` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `UI/AudioUI.swift:246` calls `shadow`, `opacity` and `UI/AudioUI.swift:28` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) UI/AudioUI.swift:297 — UI/AudioUI.swift:297-307 | UI/AudioUI.swift:393-403 | UI/AudioUI.swift:436-446 — 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 `UI/AudioUI.swift:297` 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 × 3) LLM/Backends/Remote/GatewayProviders.swift:338 — LLM/Backends/Remote/GatewayProviders.swift:338-348 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3022-3032 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:338-348 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/GatewayProviders.swift:338` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×3
  • Duplicated block (7 lines × 3) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:596 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:596-602 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:744-750 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1113-1119 — 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:596` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) UI/ResponseUI.swift:635 — UI/ResponseUI.swift:635-641 | UI/ResponseUI.swift:662-668 | UI/ResponseUI.swift:682-688 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) Tools/Handlers/Calendar.swift:647 — Tools/Handlers/Calendar.swift:647-653 | Tools/Handlers/Calendar.swift:662-668 | Tools/Helpers.swift:150-156 — 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.
D1 · Cyclomatic Complexity · LocalCLIProvider.runCodexStreaming (cyclomatic 20) · ×2
  • LocalCLIProvider.runCodexStreaming (cyclomatic 20) MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:643 — LocalCLIProvider.runCodexStreaming has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
  • LocalCLIProvider.runCodexStreaming (cyclomatic 20) LLM/Backends/Remote/GatewayProviders.swift:643 — LocalCLIProvider.runCodexStreaming has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · LocalCLIProvider.runCodexStreaming (cognitive 23) · ×2
  • LocalCLIProvider.runCodexStreaming (cognitive 23) MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:643 — LocalCLIProvider.runCodexStreaming has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, loops 3, ternaries 2 (3 pts) (nesting depth added 4). Of this number, 21 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
  • LocalCLIProvider.runCodexStreaming (cognitive 23) LLM/Backends/Remote/GatewayProviders.swift:643 — LocalCLIProvider.runCodexStreaming has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, loops 3, ternaries 2 (3 pts) (nesting depth added 4). Of this number, 21 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: Planner.swift ↔ ToolChain.swift Agent/Engine/Planner.swift:1 — `Agent/Engine/Planner.swift` and `Agent/Engine/ToolChain.swift` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). 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 `15e972f1` Save LiveLand expanded result recovery state; `26d683c7` Web search recency rework + retrieval quality & CLI/app parity; `c79a13ee` Polish skill UI and responses — run `git show` on any of them.
  • Change coupling: LiveTurnProcessor.swift ↔ LiveModeUI.swift Live/Turn/LiveTurnProcessor.swift:1 — `Live/Turn/LiveTurnProcessor.swift` and `Live/UI/LiveModeUI.swift` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `bcbb8671` Recover Live Activity and LIVE skill runtime; `4b868b3c` Fix live camera flow for build 22; `1eaa9b5f` fix: embed system prompt in first user message for Live — run `git show` on any of them.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 13+ corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:336 — LLM/Backends/Remote/GatewayProviders.swift:336-348 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3020-3032 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:336-348 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 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.
  • Edited copies of one member (3 members, 13+ corresponding lines) Shared/Audio/SherpaOnnx.swift:1815 — Shared/Audio/SherpaOnnx.swift:1815-1827 | Shared/Audio/SherpaOnnx.swift:1862-1875 | Shared/Audio/SherpaOnnx.swift:1934-1946 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 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 (25 corresponding lines) · ×2
  • Edited copy of a member (25 corresponding lines) Live/Audio/LiveAudioIO.swift:243 — Live/Audio/LiveAudioIO.swift:243-267 | LiveLand/Audio/LiveLandAudioIO.swift:217-244 — These two members are one piece of code written twice and then edited apart: 25 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.
  • Edited copy of a member (25 corresponding lines) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:546 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:546-571 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:639-663 — These two members are one piece of code written twice and then edited apart: 25 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) · ×2
  • Edited copy of a member (15 corresponding lines) LLM/Core/ModelRuntimeCoordinator.swift:192 — LLM/Core/ModelRuntimeCoordinator.swift:192-206 | LLM/Core/ModelRuntimeCoordinator.swift:213-228 — 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.
  • Edited copy of a member (15 corresponding lines) Shared/Audio/SherpaOnnx.swift:604 — Shared/Audio/SherpaOnnx.swift:604-618 | Shared/Audio/SherpaOnnx.swift:620-634 — 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 (13 corresponding lines) · ×2
  • Edited copy of a member (13 corresponding lines) Skills/SkillLoader.swift:279 — Skills/SkillLoader.swift:279-292 | Skills/SkillLoader.swift:294-306 — These two members are one piece of code written twice and then edited apart: 13 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.
  • Edited copy of a member (13 corresponding lines) LLM/MLX/Installation/LiveDownloadPlanner.swift:118 — LLM/MLX/Installation/LiveDownloadPlanner.swift:118-131 | LLM/MLX/Installation/LiveDownloadPlanner.swift:228-240 — These two members are one piece of code written twice and then edited apart: 13 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 (5 corresponding lines) · ×2
  • Edited copy of a member (5 corresponding lines) LLM/MLX/Gemma4/Gemma4VisionModel.swift:140 — LLM/MLX/Gemma4/Gemma4VisionModel.swift:140-145 | LLM/MLX/Gemma4/Gemma4VisionModel.swift:155-159 — These two members are one piece of code written twice and then edited apart: 5 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.
  • Edited copy of a member (5 corresponding lines) LLM/Backends/Remote/LANBinding.swift:132 — LLM/Backends/Remote/LANBinding.swift:132-136 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:462-466 — These two members are one piece of code written twice and then edited apart: 5 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 (1 corresponding lines) · ×2
  • Edited copy of a member (1 corresponding lines) LLM/Backends/Remote/LANDiscovery.swift:163 — LLM/Backends/Remote/LANDiscovery.swift:163-163 | MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift:163-163 — These two members are one piece of code written twice and then edited apart: 1 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.
  • Edited copy of a member (1 corresponding lines) LLM/Backends/Remote/LANDiscovery.swift:43 — LLM/Backends/Remote/LANDiscovery.swift:43-43 | MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift:43-43 — These two members are one piece of code written twice and then edited apart: 1 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 · Duplicated block (39–40 lines × 2) · ×2
  • Duplicated block (39–40 lines × 2) LLM/PromptBuilder.swift:727 — LLM/PromptBuilder.swift:727-766 | LLM/PromptBuilder.swift:786-824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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 (39–40 lines × 2) Tools/Handlers/Clipboard.swift:22 — Tools/Handlers/Clipboard.swift:22-60 | Tools/Handlers/Clipboard.swift:64-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×2
  • Duplicated block (38 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:804 — LLM/Backends/Remote/GatewayProviders.swift:804-841 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:804-841 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (38 lines × 2) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1369 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1369-1406 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1493-1530 — both copies are in the same file, so extract the 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1369` 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.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) LLM/Backends/Remote/MacGateway.swift:342 — LLM/Backends/Remote/MacGateway.swift:342-367 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:342-367 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/MacGateway.swift:342` 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 (26 lines × 2) Live/VAD/VADService.swift:84 — Live/VAD/VADService.swift:84-109 | LiveLand/VAD/LiveLandVADService.swift:86-111 — before extracting anything, compare `Live/VAD/VADService.swift` and `LiveLand/VAD/LiveLandVADService.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `LiveLand/VAD/LiveLandVADService.swift:86` 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.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×2
  • Duplicated block (18 lines × 2) LLM/Backends/LiteRT/LiteRTBackend.swift:587 — LLM/Backends/LiteRT/LiteRTBackend.swift:587-604 | LLM/Backends/LiteRT/LiteRTBackend.swift:866-883 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/LiteRT/LiteRTBackend.swift:587` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2491 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2491-2508 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2733-2750 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2491` 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.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×2
  • Duplicated block (17–18 lines × 2) LLM/PromptBuilder.swift:1733 — LLM/PromptBuilder.swift:1733-1750 | LLM/PromptBuilder.swift:1816-1832 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:1733` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17–18 lines × 2) LLM/PromptBuilder.swift:1758 — LLM/PromptBuilder.swift:1758-1775 | LLM/PromptBuilder.swift:1840-1856 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:1758` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×2
  • Duplicated block (16 lines × 3) LLM/Backends/Remote/GatewayProviders.swift:352 — LLM/Backends/Remote/GatewayProviders.swift:352-367 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3036-3051 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:352-367 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/GatewayProviders.swift:352` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 3) LLM/Backends/Remote/GatewayProviders.swift:580 — LLM/Backends/Remote/GatewayProviders.swift:580-595 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1928-1943 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:580-595 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/GatewayProviders.swift:580` 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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×2
  • Duplicated block (16 lines × 2) Live/VAD/VADService.swift:193 — Live/VAD/VADService.swift:193-208 | LiveLand/VAD/LiveLandVADService.swift:195-210 — before extracting anything, compare `Live/VAD/VADService.swift` and `LiveLand/VAD/LiveLandVADService.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) Agent/Engine/ToolChain.swift:2471 — Agent/Engine/ToolChain.swift:2471-2486 | Tools/Handlers/Web.swift:1699-1714 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Agent/Engine/ToolChain.swift:2471` 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.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×2
  • Duplicated block (13 lines × 4) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1269 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1269-1281 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1385-1397 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1509-1521 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1770-1782 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1269` 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, `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1282` calls `extractTextFromConversationResponse` and `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1398` 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 (13 lines × 4) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1288 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1288-1300 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1402-1414 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1526-1538 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1790-1802 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1288` 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.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×2
  • Duplicated block (12–13 lines × 2) Agent/Engine/ProcessInput.swift:322 — Agent/Engine/ProcessInput.swift:322-333 | Agent/Engine/ProcessInput.swift:651-663 — both copies are in the same file, so extract the 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 `Agent/Engine/ProcessInput.swift:322` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–13 lines × 2) Agent/Engine/Router.swift:375 — Agent/Engine/Router.swift:375-386 | Agent/Engine/Router.swift:551-563 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×2
  • Duplicated block (10 lines × 3) UI/ConfigurationsView.swift:1330 — UI/ConfigurationsView.swift:1330-1339 | UI/ConfigurationsView.swift:1368-1377 | UI/ConfigurationsView.swift:1418-1427 — 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 `UI/ConfigurationsView.swift:1330` 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 × 3) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2082 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2082-2091 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2638-2647 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2909-2918 — 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.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×2
  • Duplicated block (9–10 lines × 2) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:127 — LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:127-135 | LLM/Backends/Remote/RemoteInferenceService.swift:178-187 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:127` 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–10 lines × 2) Tools/Handlers/Contacts.swift:654 — Tools/Handlers/Contacts.swift:654-662 | Tools/Handlers/Contacts.swift:744-753 — both copies are in the same file, so extract the 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 `Tools/Handlers/Contacts.swift:654` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×2
  • Duplicated block (9 lines × 4) LLM/Backends/Remote/LANBinding.swift:122 — LLM/Backends/Remote/LANBinding.swift:122-130 | LLM/Backends/Remote/MacGateway.swift:120-128 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:452-460 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:120-128 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/LANBinding.swift:122` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) LLM/Backends/Remote/MacGateway.swift:311 — LLM/Backends/Remote/MacGateway.swift:311-319 | LLM/Backends/Remote/MacGateway.swift:339-347 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:311-319 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:339-347 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×2
  • Duplicated block (9 lines × 3) LLM/Backends/Remote/GatewayProviders.swift:378 — LLM/Backends/Remote/GatewayProviders.swift:378-386 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3054-3062 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:378-386 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 3) UI/ContentView.swift:615 — UI/ContentView.swift:615-623 | UI/ContentView.swift:625-633 | UI/SkillsManagerView.swift:228-236 — 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) LLM/Installation/Download/ResumableAssetDownloader.swift:1323 — LLM/Installation/Download/ResumableAssetDownloader.swift:1323-1329 | LLM/Installation/Download/ResumableAssetDownloader.swift:1345-1352 — both copies are in the same file, so extract the 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 `LLM/Installation/Download/ResumableAssetDownloader.swift:1345` 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 (7–8 lines × 2) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1967 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1967-1973 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2167-2174 — both copies are in the same file, so extract the 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 `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1967` 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.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×2
  • Duplicated block (14 lines × 4) Tools/Handlers/Health.swift:667 — Tools/Handlers/Health.swift:667-680 | Tools/Handlers/Health.swift:694-707 | Tools/Handlers/Health.swift:721-734 | Tools/Handlers/Health.swift:748-761 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Tools/Handlers/Health.swift:667` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 4) Tools/Handlers/Health.swift:1079 — Tools/Handlers/Health.swift:1079-1092 | Tools/Handlers/Health.swift:1135-1148 | Tools/Handlers/Health.swift:1189-1202 | Tools/Handlers/Health.swift:1239-1252 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D8 · Code Coverage · Low coverage · ×2
  • Low coverage: Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/BenchmarkRecord.swift Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/BenchmarkRecord.swift:1 — 0.0% line coverage (0/13).
  • Low coverage: Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/CoreAIProbe.swift Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/CoreAIProbe.swift:1 — 37.9% line coverage (11/29).
PF3 · Async & latency hygiene · Sync-over-async blocking · ×2
  • Sync-over-async blocking Live/Core/VoiceTurnController.swift:12 — `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking LiveLand/Core/LiveLandTurnController.swift:12 — `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
D1 · Cyclomatic Complexity · AgentEngine.processInput (cyclomatic 163) · ×1
  • AgentEngine.processInput (cyclomatic 163) Agent/Engine/ProcessInput.swift:13 — AgentEngine.processInput has cyclomatic complexity 163 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentEngine.executeToolChain (cyclomatic 131) · ×1
  • AgentEngine.executeToolChain (cyclomatic 131) Agent/Engine/ToolChain.swift:2521 — AgentEngine.executeToolChain has cyclomatic complexity 131 (threshold 15). Of this number, 124 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentEngine.executePlannedSkillChainIfPossible (cyclomatic 80) · ×1
  • AgentEngine.executePlannedSkillChainIfPossible (cyclomatic 80) Agent/Engine/Planner.swift:271 — AgentEngine.executePlannedSkillChainIfPossible has cyclomatic complexity 80 (threshold 15). Of this number, 70 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LiveModeEngine.processAudio (cyclomatic 53) · ×1
  • LiveModeEngine.processAudio (cyclomatic 53) Live/Core/LiveModeEngine.swift:863 — LiveModeEngine.processAudio has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SkillCardView.statusTitle (cyclomatic 47) · ×1
  • SkillCardView.statusTitle (cyclomatic 47) UI/ResponseUI.swift:1417 — SkillCardView.statusTitle 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.
D1 · Cyclomatic Complexity · JapaneseFallbackLocalization.dynamicText (cyclomatic 38) · ×1
  • JapaneseFallbackLocalization.dynamicText (cyclomatic 38) Shared/LanguageService.swift:389 — JapaneseFallbackLocalization.dynamicText has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LiveModeEngine.startLegacy (cyclomatic 38) · ×1
  • LiveModeEngine.startLegacy (cyclomatic 38) Live/Core/LiveModeEngine.swift:243 — LiveModeEngine.startLegacy has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MLXLocalLLMService.generateStream (cyclomatic 36) · ×1
  • MLXLocalLLMService.generateStream (cyclomatic 36) LLM/MLX/MLXLocalLLMService.swift:637 — MLXLocalLLMService.generateStream 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.
D1 · Cyclomatic Complexity · PromptBuilder.build (cyclomatic 34) · ×1
  • PromptBuilder.build (cyclomatic 34) LLM/PromptBuilder.swift:304 — PromptBuilder.build has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AssistantTextBlock.parseStablePrefix (cyclomatic 34) · ×1
  • AssistantTextBlock.parseStablePrefix (cyclomatic 34) UI/ResponseUI.swift:1063 — AssistantTextBlock.parseStablePrefix has cyclomatic complexity 34 (threshold 15). Of this number, 26 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ResumableAssetDownloader.transfer (cyclomatic 33) · ×1
  • ResumableAssetDownloader.transfer (cyclomatic 33) LLM/Installation/Download/ResumableAssetDownloader.swift:244 — ResumableAssetDownloader.transfer has cyclomatic complexity 33 (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.
D1 · Cyclomatic Complexity · ChatModels.swift.buildDisplayItems (cyclomatic 30) · ×1
  • ChatModels.swift.buildDisplayItems (cyclomatic 30) UI/ChatModels.swift:75 — ChatModels.swift.buildDisplayItems has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SkillDetailCard.body (cyclomatic 28) · ×1
  • SkillDetailCard.body (cyclomatic 28) UI/SkillsManagerView.swift:277 — SkillDetailCard.body has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MiniCPMVBackend.runLiveTransactionBody (cyclomatic 27) · ×1
  • MiniCPMVBackend.runLiveTransactionBody (cyclomatic 27) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:980 — MiniCPMVBackend.runLiveTransactionBody has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentEngine.latestPriorContextArtifact (cyclomatic 25) · ×1
  • AgentEngine.latestPriorContextArtifact (cyclomatic 25) Agent/Engine/Router.swift:322 — AgentEngine.latestPriorContextArtifact 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.
D1 · Cyclomatic Complexity · LiveModelDownloader.downloadAll (cyclomatic 24) · ×1
  • LiveModelDownloader.downloadAll (cyclomatic 24) LLM/MLX/Installation/LiveModelDownloader.swift:41 — LiveModelDownloader.downloadAll 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.
D1 · Cyclomatic Complexity · LiteRTLMEngine.conversationSendStreaming (cyclomatic 23) · ×1
  • LiteRTLMEngine.conversationSendStreaming (cyclomatic 23) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1166 — LiteRTLMEngine.conversationSendStreaming has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContentView.handleImportedFile (cyclomatic 23) · ×1
  • ContentView.handleImportedFile (cyclomatic 23) UI/ContentView.swift:2107 — ContentView.handleImportedFile has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentEngine.streamLLM (cyclomatic 22) · ×1
  • AgentEngine.streamLLM (cyclomatic 22) Agent/Engine/ProcessInput.swift:810 — AgentEngine.streamLLM 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.
D1 · Cyclomatic Complexity · LiteRTBackend._generateMultimodalUnchecked (cyclomatic 22) · ×1
  • LiteRTBackend._generateMultimodalUnchecked (cyclomatic 22) LLM/Backends/LiteRT/LiteRTBackend.swift:736 — LiteRTBackend._generateMultimodalUnchecked 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.
D1 · Cyclomatic Complexity · RemoteInferenceService.streamChat (cyclomatic 21) · ×1
  • RemoteInferenceService.streamChat (cyclomatic 21) LLM/Backends/Remote/RemoteInferenceService.swift:206 — RemoteInferenceService.streamChat 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.
D1 · Cyclomatic Complexity · AssistantTextBlock.parseLines (cyclomatic 20) · ×1
  • AssistantTextBlock.parseLines (cyclomatic 20) UI/ResponseUI.swift:889 — AssistantTextBlock.parseLines has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MLXLocalLLMService.downloadModel (cyclomatic 20) · ×1
  • MLXLocalLLMService.downloadModel (cyclomatic 20) LLM/MLX/Installation/ModelDownloader.swift:151 — MLXLocalLLMService.downloadModel 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.
D1 · Cyclomatic Complexity · ASRService.initialize (cyclomatic 20) · ×1
  • ASRService.initialize (cyclomatic 20) Shared/Audio/ASRService.swift:49 — ASRService.initialize 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.
D1 · Cyclomatic Complexity · LiteRTBackend.generate (cyclomatic 20) · ×1
  • LiteRTBackend.generate (cyclomatic 20) LLM/Backends/LiteRT/LiteRTBackend.swift:582 — LiteRTBackend.generate 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.
D1 · Cyclomatic Complexity · AgentEngine.executingSkillActivityDetail (cyclomatic 19) · ×1
  • AgentEngine.executingSkillActivityDetail (cyclomatic 19) Agent/AgentEngine.swift:356 — AgentEngine.executingSkillActivityDetail has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AgentEngine.extractToolCallForLoadedSkills (cyclomatic 19) · ×1
  • AgentEngine.extractToolCallForLoadedSkills (cyclomatic 19) Agent/Engine/ToolChain.swift:402 — AgentEngine.extractToolCallForLoadedSkills 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.
D1 · Cyclomatic Complexity · AgentEngine.sourceURLs (cyclomatic 19) · ×1
  • AgentEngine.sourceURLs (cyclomatic 19) Agent/Engine/ToolChain.swift:1413 — AgentEngine.sourceURLs 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.
D1 · Cyclomatic Complexity · LiveCameraService.start (cyclomatic 19) · ×1
  • LiveCameraService.start (cyclomatic 19) Live/Camera/LiveCameraService.swift:56 — LiveCameraService.start has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LiteRTBackend.load (cyclomatic 19) · ×1
  • LiteRTBackend.load (cyclomatic 19) LLM/Backends/LiteRT/LiteRTBackend.swift:167 — LiteRTBackend.load 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.
D1 · Cyclomatic Complexity · AgentEngine.loadSystemPrompt (cyclomatic 18) · ×1
  • AgentEngine.loadSystemPrompt (cyclomatic 18) Agent/Engine/EngineLifecycle.swift:148 — AgentEngine.loadSystemPrompt has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AgentEngine.validateExecutionPlan (cyclomatic 18) · ×1
  • AgentEngine.validateExecutionPlan (cyclomatic 18) Agent/Engine/Planner.swift:176 — AgentEngine.validateExecutionPlan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentEngine.validatePhoneGroundPayload (cyclomatic 18) · ×1
  • AgentEngine.validatePhoneGroundPayload (cyclomatic 18) Agent/Engine/ToolChain.swift:1974 — AgentEngine.validatePhoneGroundPayload has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LiveAudioIO.start (cyclomatic 18) · ×1
  • LiveAudioIO.start (cyclomatic 18) Live/Audio/LiveAudioIO.swift:70 — LiveAudioIO.start 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.
D1 · Cyclomatic Complexity · GatewayModel.validateAndNormalizeConfigs (cyclomatic 17) · ×1
  • GatewayModel.validateAndNormalizeConfigs (cyclomatic 17) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:789 — GatewayModel.validateAndNormalizeConfigs 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.
D1 · Cyclomatic Complexity · AgentEngine.init (cyclomatic 17) · ×1
  • AgentEngine.init (cyclomatic 17) Agent/AgentEngine.swift:455 — AgentEngine.init 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.
D1 · Cyclomatic Complexity · ContentView.body (cyclomatic 17) · ×1
  • ContentView.body (cyclomatic 17) UI/ContentView.swift:251 — ContentView.body 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.
D1 · Cyclomatic Complexity · SkillCardView.skillKind (cyclomatic 17) · ×1
  • SkillCardView.skillKind (cyclomatic 17) UI/ResponseUI.swift:1354 — SkillCardView.skillKind has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SkillCardView.iconName (cyclomatic 17) · ×1
  • SkillCardView.iconName (cyclomatic 17) UI/ResponseUI.swift:1377 — SkillCardView.iconName 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.
D1 · Cyclomatic Complexity · ConversationMemoryPolicy.nextTrimmedPriorHistory (cyclomatic 17) · ×1
  • ConversationMemoryPolicy.nextTrimmedPriorHistory (cyclomatic 17) Agent/Engine/ConversationMemoryPolicy.swift:140 — ConversationMemoryPolicy.nextTrimmedPriorHistory 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.
D1 · Cyclomatic Complexity · MiniCPMVBackend.generate (cyclomatic 17) · ×1
  • MiniCPMVBackend.generate (cyclomatic 17) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:469 — MiniCPMVBackend.generate 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.
D1 · Cyclomatic Complexity · MiniCPMVBackend._runMultimodalStream (cyclomatic 17) · ×1
  • MiniCPMVBackend._runMultimodalStream (cyclomatic 17) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:689 — MiniCPMVBackend._runMultimodalStream 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.
D1 · Cyclomatic Complexity · LiteRTLMEngine.runConversationInferenceStreaming (cyclomatic 16) · ×1
  • LiteRTLMEngine.runConversationInferenceStreaming (cyclomatic 16) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1712 — LiteRTLMEngine.runConversationInferenceStreaming 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.
D1 · Cyclomatic Complexity · AgentEngine.recentActiveSkillId (cyclomatic 16) · ×1
  • AgentEngine.recentActiveSkillId (cyclomatic 16) Agent/Engine/Router.swift:249 — AgentEngine.recentActiveSkillId 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.
D1 · Cyclomatic Complexity · AgentEngine.validateGroundedWebAnswer (cyclomatic 16) · ×1
  • AgentEngine.validateGroundedWebAnswer (cyclomatic 16) Agent/Engine/ToolChain.swift:1696 — AgentEngine.validateGroundedWebAnswer 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.
D1 · Cyclomatic Complexity · PromptBuilder.buildCompactToolAnswerPrompt (cyclomatic 16) · ×1
  • PromptBuilder.buildCompactToolAnswerPrompt (cyclomatic 16) LLM/PromptBuilder.swift:1523 — PromptBuilder.buildCompactToolAnswerPrompt 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.
D1 · Cyclomatic Complexity · LiveLandAudioIO.startEngine (cyclomatic 16) · ×1
  • LiveLandAudioIO.startEngine (cyclomatic 16) LiveLand/Audio/LiveLandAudioIO.swift:84 — LiveLandAudioIO.startEngine 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.
D1 · Cyclomatic Complexity · LiteRTBackend.generateLive (cyclomatic 16) · ×1
  • LiteRTBackend.generateLive (cyclomatic 16) LLM/Backends/LiteRT/LiteRTBackend.swift:857 — LiteRTBackend.generateLive 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.
D10 · Test Quality · Test project verifies nothing · ×1
  • Test project verifies nothing: CmlxTests Packages/mlx-swift/Tests/CmlxTests/CmlxTests.swift:14 — No conventional assertion call was detected in 1 of 1 tests in `CmlxTests` — the project as a whole, not one method. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a suite that genuinely checks nothing. If it is the latter, this project passes unconditionally and cannot fail.
D15 · Churn × Complexity Hotspots · Repeated repair · ×1
  • Repeated repair: UI/UIScale.swift UI/UIScale.swift:45 — UI/UIScale.swift changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is UIScale.pillHeight at line 45), 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(ui): tighten orb→LIVE rhythm, lift main visual to upper third”; “fix(ui): "icons floating in air" — sized as signs not buttons”; “fix(ui): refine icon sizes for proper "premium minimal" feel”. 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-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 16:01:17 +08:00' --until='2026-08-06 16:01:17 +08:00' --full-history --no-merges -- UI/UIScale.swift`: 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.
D2 · Cognitive Complexity · AgentEngine.executeToolChain (cognitive 293) · ×1
  • AgentEngine.executeToolChain (cognitive 293) Agent/Engine/ToolChain.swift:2521 — AgentEngine.executeToolChain has cognitive complexity 293 (threshold 15). Drivers by points: if/else 101 (235 pts), ternaries 10 (26 pts), boolean chains 22, loops 3 (7 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 155). Of this number, 286 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AgentEngine.processInput (cognitive 244) · ×1
  • AgentEngine.processInput (cognitive 244) Agent/Engine/ProcessInput.swift:13 — AgentEngine.processInput has cognitive complexity 244 (threshold 15). Drivers by points: if/else 80 (139 pts), boolean chains 62, ternaries 17 (31 pts), match/switch 4 (10 pts), loops 1 (2 pts) (nesting depth added 80). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.executePlannedSkillChainIfPossible (cognitive 177) · ×1
  • AgentEngine.executePlannedSkillChainIfPossible (cognitive 177) Agent/Engine/Planner.swift:271 — AgentEngine.executePlannedSkillChainIfPossible has cognitive complexity 177 (threshold 15). Drivers by points: if/else 62 (144 pts), boolean chains 14, ternaries 4 (13 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 94). Of this number, 167 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveModeEngine.processAudio (cognitive 91) · ×1
  • LiveModeEngine.processAudio (cognitive 91) Live/Core/LiveModeEngine.swift:863 — LiveModeEngine.processAudio has cognitive complexity 91 (threshold 15). Drivers by points: if/else 28 (60 pts), boolean chains 14, match/switch 2 (7 pts), loops 2 (6 pts), error handling 2, ternaries 1 (2 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ContentView.handleImportedFile (cognitive 73) · ×1
  • ContentView.handleImportedFile (cognitive 73) UI/ContentView.swift:2107 — ContentView.handleImportedFile has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 8 (34 pts), if/else 12 (28 pts), error handling 2 (6 pts), loops 1 (4 pts), match/switch 1 (nesting depth added 49). 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.
D2 · Cognitive Complexity · MLXLocalLLMService.generateStream (cognitive 69) · ×1
  • MLXLocalLLMService.generateStream (cognitive 69) LLM/MLX/MLXLocalLLMService.swift:637 — MLXLocalLLMService.generateStream has cognitive complexity 69 (threshold 15). Drivers by points: if/else 27 (43 pts), ternaries 7 (21 pts), error handling 3, boolean chains 2 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveModelDownloader.downloadAll (cognitive 69) · ×1
  • LiveModelDownloader.downloadAll (cognitive 69) LLM/MLX/Installation/LiveModelDownloader.swift:41 — LiveModelDownloader.downloadAll has cognitive complexity 69 (threshold 15). Drivers by points: if/else 13 (42 pts), loops 6 (15 pts), error handling 4 (12 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatModels.swift.buildDisplayItems (cognitive 61) · ×1
  • ChatModels.swift.buildDisplayItems (cognitive 61) UI/ChatModels.swift:75 — ChatModels.swift.buildDisplayItems has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (50 pts), boolean chains 8, match/switch 1 (2 pts), loops 1 (nesting depth added 32). Of this number, 60 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SkillDetailCard.body (cognitive 58) · ×1
  • SkillDetailCard.body (cognitive 58) UI/SkillsManagerView.swift:277 — SkillDetailCard.body has cognitive complexity 58 (threshold 15). Drivers by points: if/else 13 (26 pts), ternaries 12 (26 pts), boolean chains 3, error handling 1 (3 pts) (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.
D2 · Cognitive Complexity · SkillCardView.statusTitle (cognitive 51) · ×1
  • SkillCardView.statusTitle (cognitive 51) UI/ResponseUI.swift:1417 — SkillCardView.statusTitle has cognitive complexity 51 (threshold 15). Drivers by points: if/else 32 (48 pts), match/switch 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssistantTextBlock.parseStablePrefix (cognitive 49) · ×1
  • AssistantTextBlock.parseStablePrefix (cognitive 49) UI/ResponseUI.swift:1063 — AssistantTextBlock.parseStablePrefix has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (31 pts), ternaries 7 (12 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 16). Of this number, 43 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.latestPriorContextArtifact (cognitive 48) · ×1
  • AgentEngine.latestPriorContextArtifact (cognitive 48) Agent/Engine/Router.swift:322 — AgentEngine.latestPriorContextArtifact has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (31 pts), ternaries 2 (8 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PromptBuilder.build (cognitive 48) · ×1
  • PromptBuilder.build (cognitive 48) LLM/PromptBuilder.swift:304 — PromptBuilder.build has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (34 pts), boolean chains 7, loops 3 (4 pts), match/switch 1 (2 pts), ternaries 1 (nesting depth added 14). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MLXLocalLLMService.downloadModel (cognitive 47) · ×1
  • MLXLocalLLMService.downloadModel (cognitive 47) LLM/MLX/Installation/ModelDownloader.swift:151 — MLXLocalLLMService.downloadModel has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (32 pts), error handling 4 (10 pts), loops 2 (5 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveModeEngine.startLegacy (cognitive 47) · ×1
  • LiveModeEngine.startLegacy (cognitive 47) Live/Core/LiveModeEngine.swift:243 — LiveModeEngine.startLegacy has cognitive complexity 47 (threshold 15). Drivers by points: if/else 32 (37 pts), loops 2 (4 pts), error handling 3, boolean chains 2, match/switch 1 (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.
D2 · Cognitive Complexity · LiteRTBackend._generateMultimodalUnchecked (cognitive 43) · ×1
  • LiteRTBackend._generateMultimodalUnchecked (cognitive 43) LLM/Backends/LiteRT/LiteRTBackend.swift:736 — LiteRTBackend._generateMultimodalUnchecked has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 4 (11 pts), loops 3 (7 pts), boolean chains 3, error handling 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JapaneseFallbackLocalization.dynamicText (cognitive 38) · ×1
  • JapaneseFallbackLocalization.dynamicText (cognitive 38) Shared/LanguageService.swift:389 — JapaneseFallbackLocalization.dynamicText has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (24 pts), boolean chains 14 (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.
D2 · Cognitive Complexity · MiniCPMVBackend.runLiveTransactionBody (cognitive 37) · ×1
  • MiniCPMVBackend.runLiveTransactionBody (cognitive 37) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:980 — MiniCPMVBackend.runLiveTransactionBody has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 4, error handling 2 (4 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 11). Of this number, 35 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResumableAssetDownloader.transfer (cognitive 37) · ×1
  • ResumableAssetDownloader.transfer (cognitive 37) LLM/Installation/Download/ResumableAssetDownloader.swift:244 — ResumableAssetDownloader.transfer has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 13, ternaries 4, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
D2 · Cognitive Complexity · RemoteInferenceService.streamChat (cognitive 36) · ×1
  • RemoteInferenceService.streamChat (cognitive 36) LLM/Backends/Remote/RemoteInferenceService.swift:206 — RemoteInferenceService.streamChat has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 6, loops 1 (2 pts), error handling 1, ternaries 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.
D2 · Cognitive Complexity · AgentEngine.extractToolCallForLoadedSkills (cognitive 35) · ×1
  • AgentEngine.extractToolCallForLoadedSkills (cognitive 35) Agent/Engine/ToolChain.swift:402 — AgentEngine.extractToolCallForLoadedSkills has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 6 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LiteRTLMEngine.conversationSendStreaming (cognitive 34) · ×1
  • LiteRTLMEngine.conversationSendStreaming (cognitive 34) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1166 — LiteRTLMEngine.conversationSendStreaming has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), loops 2 (4 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PromptBuilder.buildCompactToolAnswerPrompt (cognitive 34) · ×1
  • PromptBuilder.buildCompactToolAnswerPrompt (cognitive 34) LLM/PromptBuilder.swift:1523 — PromptBuilder.buildCompactToolAnswerPrompt has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 10 (22 pts), if/else 9 (12 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BackgroundDownloadSession.storeColdDownloadedFile (cognitive 32) · ×1
  • BackgroundDownloadSession.storeColdDownloadedFile (cognitive 32) LLM/Installation/Download/ResumableAssetDownloader.swift:1310 — BackgroundDownloadSession.storeColdDownloadedFile has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (23 pts), error handling 3 (8 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · LiteRTLMEngine.runConversationInferenceStreaming (cognitive 30) · ×1
  • LiteRTLMEngine.runConversationInferenceStreaming (cognitive 30) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1712 — LiteRTLMEngine.runConversationInferenceStreaming has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.sourceURLs (cognitive 30) · ×1
  • AgentEngine.sourceURLs (cognitive 30) Agent/Engine/ToolChain.swift:1413 — AgentEngine.sourceURLs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiteRTBackend.generate (cognitive 29) · ×1
  • LiteRTBackend.generate (cognitive 29) LLM/Backends/LiteRT/LiteRTBackend.swift:582 — LiteRTBackend.generate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssistantTextBlock.parseLines (cognitive 28) · ×1
  • AssistantTextBlock.parseLines (cognitive 28) UI/ResponseUI.swift:889 — AssistantTextBlock.parseLines has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 10). Of this number, 22 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiteRTBackend.load (cognitive 28) · ×1
  • LiteRTBackend.load (cognitive 28) LLM/Backends/LiteRT/LiteRTBackend.swift:167 — LiteRTBackend.load has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 3 (5 pts), boolean chains 4, match/switch 1 (2 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GatewayModel.validateAndNormalizeConfigs (cognitive 27) · ×1
  • GatewayModel.validateAndNormalizeConfigs (cognitive 27) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:789 — GatewayModel.validateAndNormalizeConfigs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 5, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.init (cognitive 27) · ×1
  • AgentEngine.init (cognitive 27) Agent/AgentEngine.swift:455 — AgentEngine.init has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.streamLLM (cognitive 27) · ×1
  • AgentEngine.streamLLM (cognitive 27) Agent/Engine/ProcessInput.swift:810 — AgentEngine.streamLLM has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · ProbeView.runGuardedMatrixTest (cognitive 26) · ×1
  • ProbeView.runGuardedMatrixTest (cognitive 26) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:336 — ProbeView.runGuardedMatrixTest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 1 (4 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.validatePhoneGroundPayload (cognitive 26) · ×1
  • AgentEngine.validatePhoneGroundPayload (cognitive 26) Agent/Engine/ToolChain.swift:1974 — AgentEngine.validatePhoneGroundPayload has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiteRTLMEngine.runSessionInferenceStreaming (cognitive 24) · ×1
  • LiteRTLMEngine.runSessionInferenceStreaming (cognitive 24) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1474 — LiteRTLMEngine.runSessionInferenceStreaming has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, ternaries 1 (2 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.
D2 · Cognitive Complexity · LiteRTBackend.generateLive (cognitive 24) · ×1
  • LiteRTBackend.generateLive (cognitive 24) LLM/Backends/LiteRT/LiteRTBackend.swift:857 — LiteRTBackend.generateLive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniCPMVBackend._runMultimodalStream (cognitive 24) · ×1
  • MiniCPMVBackend._runMultimodalStream (cognitive 24) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:689 — MiniCPMVBackend._runMultimodalStream has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (4 pts), ternaries 2 (4 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.
D2 · Cognitive Complexity · LiteRTModelStore.performInstall (cognitive 23) · ×1
  • LiteRTModelStore.performInstall (cognitive 23) LLM/Installation/LiteRTModelStore.swift:257 — LiteRTModelStore.performInstall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 1 (3 pts), ternaries 2 (3 pts), error handling 1 (2 pts), loops 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemma4Processor.prepare (cognitive 23) · ×1
  • Gemma4Processor.prepare (cognitive 23) LLM/MLX/Gemma4/Gemma4Processor.swift:293 — Gemma4Processor.prepare has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (23 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.
D2 · Cognitive Complexity · LiteRTLMEngine.load (cognitive 22) · ×1
  • LiteRTLMEngine.load (cognitive 22) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:299 — LiteRTLMEngine.load has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.validateExecutionPlan (cognitive 22) · ×1
  • AgentEngine.validateExecutionPlan (cognitive 22) Agent/Engine/Planner.swift:176 — AgentEngine.validateExecutionPlan has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.latestPriorToolObservation (cognitive 22) · ×1
  • AgentEngine.latestPriorToolObservation (cognitive 22) Agent/Engine/Router.swift:533 — AgentEngine.latestPriorToolObservation has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (4 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · LiveAudioIO.start (cognitive 22) · ×1
  • LiveAudioIO.start (cognitive 22) Live/Audio/LiveAudioIO.swift:70 — LiveAudioIO.start has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, error handling 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MiniCPMVBackend.generate (cognitive 22) · ×1
  • MiniCPMVBackend.generate (cognitive 22) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:469 — MiniCPMVBackend.generate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProbeView.runRouteMatrixTest (cognitive 21) · ×1
  • ProbeView.runRouteMatrixTest (cognitive 21) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:279 — ProbeView.runRouteMatrixTest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (4 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PlanningPromptBuilder.extractFirstJSONObject (cognitive 21) · ×1
  • PlanningPromptBuilder.extractFirstJSONObject (cognitive 21) Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift:53 — PlanningPromptBuilder.extractFirstJSONObject has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiteRTLMEngine.openConversation (cognitive 21) · ×1
  • LiteRTLMEngine.openConversation (cognitive 21) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:977 — LiteRTLMEngine.openConversation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.recentActiveSkillId (cognitive 21) · ×1
  • AgentEngine.recentActiveSkillId (cognitive 21) Agent/Engine/Router.swift:249 — AgentEngine.recentActiveSkillId has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 9, 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.
D2 · Cognitive Complexity · ConversationMemoryPolicy.nextTrimmedPriorHistory (cognitive 21) · ×1
  • ConversationMemoryPolicy.nextTrimmedPriorHistory (cognitive 21) Agent/Engine/ConversationMemoryPolicy.swift:140 — ConversationMemoryPolicy.nextTrimmedPriorHistory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveCameraService.start (cognitive 21) · ×1
  • LiveCameraService.start (cognitive 21) Live/Camera/LiveCameraService.swift:56 — LiveCameraService.start has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3, error handling 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
D2 · Cognitive Complexity · ASRService.initialize (cognitive 21) · ×1
  • ASRService.initialize (cognitive 21) Shared/Audio/ASRService.swift:49 — ASRService.initialize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResumableAssetDownloader.downloadFile (cognitive 21) · ×1
  • ResumableAssetDownloader.downloadFile (cognitive 21) LLM/Installation/Download/ResumableAssetDownloader.swift:99 — ResumableAssetDownloader.downloadFile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.loadSystemPrompt (cognitive 20) · ×1
  • AgentEngine.loadSystemPrompt (cognitive 20) Agent/Engine/EngineLifecycle.swift:148 — AgentEngine.loadSystemPrompt has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ConfigurationsView.modelRuntimeLabel (cognitive 20) · ×1
  • ConfigurationsView.modelRuntimeLabel (cognitive 20) UI/ConfigurationsView.swift:854 — ConfigurationsView.modelRuntimeLabel has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (8 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · LiveLandAudioIO.startEngine (cognitive 20) · ×1
  • LiveLandAudioIO.startEngine (cognitive 20) LiveLand/Audio/LiveLandAudioIO.swift:84 — LiveLandAudioIO.startEngine has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, error handling 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FoundationModelsInferenceService.streamText (cognitive 20) · ×1
  • FoundationModelsInferenceService.streamText (cognitive 20) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:188 — FoundationModelsInferenceService.streamText has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatCompletionsLanguageModelExecutor.respond (cognitive 20) · ×1
  • ChatCompletionsLanguageModelExecutor.respond (cognitive 20) LLM/Backends/Remote/RemoteInferenceService.swift:440 — ChatCompletionsLanguageModelExecutor.respond has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProbeView.extractFirstJSONObject (cognitive 19) · ×1
  • ProbeView.extractFirstJSONObject (cognitive 19) Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:541 — ProbeView.extractFirstJSONObject has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RuntimeSetupGuide.resolve (cognitive 19) · ×1
  • RuntimeSetupGuide.resolve (cognitive 19) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1688 — RuntimeSetupGuide.resolve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 8). 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.
D2 · Cognitive Complexity · AgentEngine.latestRefreshablePriorToolArtifact (cognitive 19) · ×1
  • AgentEngine.latestRefreshablePriorToolArtifact (cognitive 19) Agent/Engine/Router.swift:480 — AgentEngine.latestRefreshablePriorToolArtifact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentView.body (cognitive 19) · ×1
  • ContentView.body (cognitive 19) UI/ContentView.swift:251 — ContentView.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LiteRTModelStore.cleanupObsoleteCoreMLV46 (cognitive 19) · ×1
  • LiteRTModelStore.cleanupObsoleteCoreMLV46 (cognitive 19) LLM/Installation/LiteRTModelStore.swift:110 — LiteRTModelStore.cleanupObsoleteCoreMLV46 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 3 (7 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveModeEngine.extractSpeakableSegments (cognitive 19) · ×1
  • LiveModeEngine.extractSpeakableSegments (cognitive 19) Live/Core/LiveModeEngine.swift:1222 — LiveModeEngine.extractSpeakableSegments has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ResumableAssetDownloader.resumePlan (cognitive 19) · ×1
  • ResumableAssetDownloader.resumePlan (cognitive 19) LLM/Installation/Download/ResumableAssetDownloader.swift:541 — ResumableAssetDownloader.resumePlan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BackgroundDownloadSession.inferContext (cognitive 19) · ×1
  • BackgroundDownloadSession.inferContext (cognitive 19) LLM/Installation/Download/ResumableAssetDownloader.swift:1404 — BackgroundDownloadSession.inferContext has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiteRTLMEngine.conversationSend (cognitive 18) · ×1
  • LiteRTLMEngine.conversationSend (cognitive 18) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1089 — LiteRTLMEngine.conversationSend has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts), error handling 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.finishTurn (cognitive 18) · ×1
  • AgentEngine.finishTurn (cognitive 18) Agent/Engine/ProcessInput.swift:969 — AgentEngine.finishTurn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentEngine.canonicalToolName (cognitive 18) · ×1
  • AgentEngine.canonicalToolName (cognitive 18) Agent/Engine/ToolCallParser.swift:7 — AgentEngine.canonicalToolName has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · AgentEngine.significantQuestionConcepts (cognitive 17) · ×1
  • AgentEngine.significantQuestionConcepts (cognitive 17) Agent/Engine/ToolChain.swift:2454 — AgentEngine.significantQuestionConcepts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 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.
D2 · Cognitive Complexity · ConfigurationsView.modelInstallLabel (cognitive 17) · ×1
  • ConfigurationsView.modelInstallLabel (cognitive 17) UI/ConfigurationsView.swift:770 — ConfigurationsView.modelInstallLabel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (5 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SelectableAssistantTextView.attributedText (cognitive 17) · ×1
  • SelectableAssistantTextView.attributedText (cognitive 17) UI/ResponseUI.swift:553 — SelectableAssistantTextView.attributedText has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 1 (2 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveModeEngine.enqueueForPlayback (cognitive 17) · ×1
  • LiveModeEngine.enqueueForPlayback (cognitive 17) Live/Core/LiveModeEngine.swift:1151 — LiveModeEngine.enqueueForPlayback has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 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.
D2 · Cognitive Complexity · AgentEngine.rawParseToolCalls (cognitive 16) · ×1
  • AgentEngine.rawParseToolCalls (cognitive 16) Agent/Engine/ToolCallParser.swift:219 — AgentEngine.rawParseToolCalls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 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.
D2 · Cognitive Complexity · AgentEngine.validateGroundedWebAnswer (cognitive 16) · ×1
  • AgentEngine.validateGroundedWebAnswer (cognitive 16) Agent/Engine/ToolChain.swift:1696 — AgentEngine.validateGroundedWebAnswer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 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.
D2 · Cognitive Complexity · SkillCardView.skillKind (cognitive 16) · ×1
  • SkillCardView.skillKind (cognitive 16) UI/ResponseUI.swift:1354 — SkillCardView.skillKind has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WebFreshness.embeddedDate (cognitive 16) · ×1
  • WebFreshness.embeddedDate (cognitive 16) LLM/Core/WebFreshness.swift:218 — WebFreshness.embeddedDate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LiveTurnProcessor.makeEventStream (cognitive 16) · ×1
  • LiveTurnProcessor.makeEventStream (cognitive 16) Live/Turn/LiveTurnProcessor.swift:97 — LiveTurnProcessor.makeEventStream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (7 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemma4LanguageModel.newCache (cognitive 16) · ×1
  • Gemma4LanguageModel.newCache (cognitive 16) LLM/MLX/Gemma4/Gemma4LanguageModel.swift:266 — Gemma4LanguageModel.newCache has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Near-duplicate member family (3 members, 16 shared lines) · ×1
  • Near-duplicate member family (3 members, 16 shared lines) LLM/Backends/Remote/GatewayProviders.swift:580 — LLM/Backends/Remote/GatewayProviders.swift:580-597 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1928-1950 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:580-597 — These 3 members are variants of one another: a block of 16 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Edited copy of a member (74 corresponding lines) · ×1
  • Edited copy of a member (74 corresponding lines) LLM/PromptBuilder.swift:1704 — LLM/PromptBuilder.swift:1704-1785 | LLM/PromptBuilder.swift:1787-1866 — These two members are one piece of code written twice and then edited apart: 74 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 (71 corresponding lines) · ×1
  • Edited copy of a member (71 corresponding lines) LLM/PromptBuilder.swift:1787 — LLM/PromptBuilder.swift:1787-1866 | LLM/PromptBuilder.swift:1874-1958 — These two members are one piece of code written twice and then edited apart: 71 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 (18 corresponding lines) · ×1
  • Edited copy of a member (18 corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:350 — LLM/Backends/Remote/GatewayProviders.swift:350-367 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:350-367 — These two members are one piece of code written twice and then edited apart: 18 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 (33 corresponding lines) · ×1
  • Edited copy of a member (33 corresponding lines) Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift:53 — Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift:53-96 | Experiments/iOS27CoreAIProbeApp/Sources/ProbeView.swift:541-577 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Agent/Engine/ToolChain.swift:2220 — Agent/Engine/ToolChain.swift:2220-2278 | Agent/Engine/ToolChain.swift:2454-2504 | Tools/Handlers/Web.swift:1124-1131 | Tools/Handlers/Web.swift:1512-1551 | Tools/Handlers/Web.swift:1684-1732 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Edited copy of a member (110 corresponding lines) · ×1
  • Edited copy of a member (110 corresponding lines) Live/Audio/LiveAudioIO.swift:70 — Live/Audio/LiveAudioIO.swift:70-212 | LiveLand/Audio/LiveLandAudioIO.swift:84-193 — These two members are one piece of code written twice and then edited apart: 110 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 (146 corresponding lines) · ×1
  • Edited copy of a member (146 corresponding lines) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:469 — LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:469-624 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:689-834 — These two members are one piece of code written twice and then edited apart: 146 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 (57 corresponding lines) · ×1
  • Edited copy of a member (57 corresponding lines) UI/AudioUI.swift:12 — UI/AudioUI.swift:12-68 | UI/AudioUI.swift:350-415 — These two members are one piece of code written twice and then edited apart: 57 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 (85 corresponding lines) · ×1
  • Edited copy of a member (85 corresponding lines) LLM/Backends/LiteRT/LiteRTBackend.swift:582 — LLM/Backends/LiteRT/LiteRTBackend.swift:582-684 | LLM/Backends/LiteRT/LiteRTBackend.swift:857-941 — These two members are one piece of code written twice and then edited apart: 85 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 (55 corresponding lines) · ×1
  • Edited copy of a member (55 corresponding lines) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:713 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:713-767 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:783-838 — These two members are one piece of code written twice and then edited apart: 55 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 (92 corresponding lines) · ×1
  • Edited copy of a member (92 corresponding lines) LLM/PromptBuilder.swift:2369 — LLM/PromptBuilder.swift:2369-2460 | LLM/PromptBuilder.swift:2462-2575 — These two members are one piece of code written twice and then edited apart: 92 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 (48 corresponding lines) · ×1
  • Edited copy of a member (48 corresponding lines) UI/ContentView.swift:2349 — UI/ContentView.swift:2349-2396 | UI/SkillsManagerView.swift:48-96 — These two members are one piece of code written twice and then edited apart: 48 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 (28 corresponding lines) · ×1
  • Edited copy of a member (28 corresponding lines) UI/ContentView.swift:2647 — UI/ContentView.swift:2647-2679 | UI/RemoteMacSettingsView.swift:236-263 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×1
  • Edited copy of a member (31 corresponding lines) LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:157 — LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:157-187 | LocalPackages/PhoneClawEngine/Sources/MTMDEngine/MTMDWrapper.swift:189-219 — These two members are one piece of code written twice and then edited apart: 31 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 (58 corresponding lines) · ×1
  • Edited copy of a member (58 corresponding lines) LLM/PromptBuilder.swift:713 — LLM/PromptBuilder.swift:713-775 | LLM/PromptBuilder.swift:777-834 — These two members are one piece of code written twice and then edited apart: 58 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, 74+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 74+ corresponding lines) LLM/PromptBuilder.swift:2207 — LLM/PromptBuilder.swift:2207-2280 | LLM/PromptBuilder.swift:2283-2365 | LLM/PromptBuilder.swift:2674-2747 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 74 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 (36 corresponding lines) · ×1
  • Edited copy of a member (36 corresponding lines) UI/ResponseUI.swift:382 — UI/ResponseUI.swift:382-417 | UI/ResponseUI.swift:515-550 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) Live/VAD/VADService.swift:83 — Live/VAD/VADService.swift:83-109 | LiveLand/VAD/LiveLandVADService.swift:83-111 — 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 (26 corresponding lines) · ×1
  • Edited copy of a member (26 corresponding lines) LLM/MLX/Gemma4/Gemma4Processor.swift:222 — LLM/MLX/Gemma4/Gemma4Processor.swift:222-247 | LLM/MLX/Gemma4/Gemma4Processor.swift:258-291 — These two members are one piece of code written twice and then edited apart: 26 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 (14 corresponding lines) · ×1
  • Edited copy of a member (14 corresponding lines) LLM/MLX/Gemma4/Gemma4AudioFeatureExtractor.swift:110 — LLM/MLX/Gemma4/Gemma4AudioFeatureExtractor.swift:110-123 | Shared/Audio/ASRService.swift:538-552 — These two members are one piece of code written twice and then edited apart: 14 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 (38 corresponding lines) · ×1
  • Edited copy of a member (38 corresponding lines) LLM/PromptBuilder.swift:533 — LLM/PromptBuilder.swift:533-579 | LLM/PromptBuilder.swift:581-618 — These two members are one piece of code written twice and then edited apart: 38 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 (16 corresponding lines) · ×1
  • Edited copy of a member (16 corresponding lines) UI/ConfigurationsView.swift:297 — UI/ConfigurationsView.swift:297-313 | UI/ConfigurationsView.swift:437-452 — These two members are one piece of code written twice and then edited apart: 16 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 (4 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 12+ corresponding lines) LLM/Core/GenerationTransaction.swift:117 — LLM/Core/GenerationTransaction.swift:117-129 | LLM/Core/GenerationTransaction.swift:132-144 | LLM/Core/GenerationTransaction.swift:152-163 | LLM/Core/GenerationTransaction.swift:170-182 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3490 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3490-3504 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3510-3524 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3543-3557 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 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 copies of one member (3 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 27+ corresponding lines) LLM/MLX/MLXLocalLLMService.swift:253 — LLM/MLX/MLXLocalLLMService.swift:253-281 | LLM/MLX/MLXLocalLLMService.swift:283-309 | LLM/MLX/MLXLocalLLMService.swift:311-338 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 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 copies of one member (4 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 21+ corresponding lines) Shared/Audio/SherpaOnnx.swift:665 — Shared/Audio/SherpaOnnx.swift:665-689 | Shared/Audio/SherpaOnnx.swift:1212-1232 | Shared/Audio/SherpaOnnx.swift:1234-1254 | Shared/Audio/SherpaOnnx.swift:1272-1296 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 21 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 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×1
  • Edited copy of a member (22 corresponding lines) Agent/Engine/ConversationMemoryPolicy.swift:20 — Agent/Engine/ConversationMemoryPolicy.swift:20-41 | Agent/Engine/ConversationMemoryPolicy.swift:45-66 — These two members are one piece of code written twice and then edited apart: 22 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, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2015 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2015-2026 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2603-2618 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2857-2872 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 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 copies of one member (3 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 8+ corresponding lines) Agent/Engine/EngineLifecycle.swift:523 — Agent/Engine/EngineLifecycle.swift:523-530 | LLM/Core/WebFreshness.swift:292-299 | LLM/Core/WebFreshness.swift:301-309 — 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.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 7+ corresponding lines) Agent/Engine/ChatAttachments.swift:131 — Agent/Engine/ChatAttachments.swift:131-137 | UI/AudioUI.swift:191-197 | UI/AudioUI.swift:321-327 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 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 (8 corresponding lines) · ×1
  • Edited copy of a member (8 corresponding lines) Agent/Engine/ToolChain.swift:2506 — Agent/Engine/ToolChain.swift:2506-2513 | Tools/Handlers/Web.swift:1734-1741 — These two members are one piece of code written twice and then edited apart: 8 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, 9+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 9+ corresponding lines) LLM/MLX/Installation/LiveModelStore.swift:396 — LLM/MLX/Installation/LiveModelStore.swift:396-404 | Shared/PCLog.swift:58-67 | Shared/PCLog.swift:115-124 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 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 copies of one member (3 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:120 — LLM/Backends/FoundationModels/IOS27FoundationModelsInferenceService.swift:120-125 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:919-928 | LLM/Backends/Remote/RemoteInferenceService.swift:168-176 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 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 copies of one member (3 members, 3+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 3+ corresponding lines) LLM/Backends/Remote/GatewayProviders.swift:973 — LLM/Backends/Remote/GatewayProviders.swift:973-975 | LLM/Backends/Remote/RemoteInferenceService.swift:342-344 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:973-975 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 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 · Duplicated block (129 lines × 2) · ×1
  • Duplicated block (129 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:643 — LLM/Backends/Remote/GatewayProviders.swift:643-771 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:643-771 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (67 lines × 2) · ×1
  • Duplicated block (67 lines × 2) Live/Audio/LiveAudioIO.swift:110 — Live/Audio/LiveAudioIO.swift:110-176 | LiveLand/Audio/LiveLandAudioIO.swift:102-168 — before extracting anything, compare `Live/Audio/LiveAudioIO.swift` and `LiveLand/Audio/LiveLandAudioIO.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Live/Audio/LiveAudioIO.swift:110` 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.
D4 · Code Duplication · Duplicated block (65 lines × 2) · ×1
  • Duplicated block (65 lines × 2) LLM/PromptBuilder.swift:2370 — LLM/PromptBuilder.swift:2370-2434 | LLM/PromptBuilder.swift:2463-2527 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:2370` 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. 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.
D4 · Code Duplication · Duplicated block (58–61 lines × 2) · ×1
  • Duplicated block (58–61 lines × 2) Agent/AudioCaptureService.swift:229 — Agent/AudioCaptureService.swift:229-286 | UI/ContentView.swift:2189-2249 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (56 lines × 2) · ×1
  • Duplicated block (56 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:857 — LLM/Backends/Remote/GatewayProviders.swift:857-912 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:857-912 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (48 lines × 3) · ×1
  • Duplicated block (48 lines × 3) LLM/PromptBuilder.swift:859 — LLM/PromptBuilder.swift:859-906 | LLM/PromptBuilder.swift:909-956 | LLM/PromptBuilder.swift:959-1006 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (41 lines × 2) · ×1
  • Duplicated block (41 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:177 — LLM/Backends/Remote/GatewayProviders.swift:177-217 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:177-217 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (42 lines × 3) · ×1
  • Duplicated block (42 lines × 3) LLM/PromptBuilder.swift:1538 — LLM/PromptBuilder.swift:1538-1579 | LLM/PromptBuilder.swift:1582-1623 | LLM/PromptBuilder.swift:1626-1667 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) LLM/Backends/Remote/GatewayProviders.swift:607 — LLM/Backends/Remote/GatewayProviders.swift:607-641 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:607-641 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) LLM/Backends/Remote/LANDiscovery.swift:82 — LLM/Backends/Remote/LANDiscovery.swift:82-115 | MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift:82-115 — before extracting anything, compare `LLM/Backends/Remote/LANDiscovery.swift` and `MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (31–34 lines × 2) · ×1
  • Duplicated block (31–34 lines × 2) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:727 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:727-760 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1099-1129 — both copies are in the same file, so extract the 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, `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:724` calls `inferenceFailure` and `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1096` 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.
D4 · Code Duplication · Duplicated block (32–33 lines × 2) · ×1
  • Duplicated block (32–33 lines × 2) LLM/PromptBuilder.swift:2209 — LLM/PromptBuilder.swift:2209-2240 | LLM/PromptBuilder.swift:2284-2316 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:2209` 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. 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.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) UI/ConfigurationsView.swift:117 — UI/ConfigurationsView.swift:117-149 | UI/ConfigurationsView.swift:1789-1821 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:117` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `UI/ConfigurationsView.swift:116` calls `applySettings` and `UI/ConfigurationsView.swift:1788` 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.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×1
  • Duplicated block (32 lines × 2) LLM/Backends/Remote/MacGateway.swift:255 — LLM/Backends/Remote/MacGateway.swift:255-286 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:255-286 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (29–31 lines × 2) · ×1
  • Duplicated block (29–31 lines × 2) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1258 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1258-1286 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1759-1789 — both copies are in the same file, so extract the 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1258` 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.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×1
  • Duplicated block (29 lines × 2) Live/Core/VoiceTurnController.swift:96 — Live/Core/VoiceTurnController.swift:96-124 | LiveLand/Core/LiveLandTurnController.swift:96-124 — before extracting anything, compare `Live/Core/VoiceTurnController.swift` and `LiveLand/Core/LiveLandTurnController.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (35 lines × 3) · ×1
  • Duplicated block (35 lines × 3) LLM/PromptBuilder.swift:1056 — LLM/PromptBuilder.swift:1056-1090 | LLM/PromptBuilder.swift:1093-1127 | LLM/PromptBuilder.swift:1130-1164 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (25 lines × 3) · ×1
  • Duplicated block (25 lines × 3) LLM/PromptBuilder.swift:1880 — LLM/PromptBuilder.swift:1880-1904 | LLM/PromptBuilder.swift:1906-1930 | LLM/PromptBuilder.swift:1932-1957 — 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 `LLM/PromptBuilder.swift:1932` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:719 — LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:719-742 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:1033-1057 — both copies are in the same file, so extract the 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 `LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:719` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:1030` calls `makeStream` and `LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:716` 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.
D4 · Code Duplication · Duplicated block (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) UI/ConfigurationsView.swift:217 — UI/ConfigurationsView.swift:217-239 | UI/ConfigurationsView.swift:478-502 — both copies are in the same file, so extract the 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 `UI/ConfigurationsView.swift:478` 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.
D4 · Code Duplication · Duplicated block (24 lines × 3) · ×1
  • Duplicated block (24 lines × 3) LLM/PromptBuilder.swift:2126 — LLM/PromptBuilder.swift:2126-2149 | LLM/PromptBuilder.swift:2151-2174 | LLM/PromptBuilder.swift:2176-2200 — 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 `LLM/PromptBuilder.swift:2176` 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.
D4 · Code Duplication · Duplicated block (23–24 lines × 3) · ×1
  • Duplicated block (23–24 lines × 3) LLM/PromptBuilder.swift:2761 — LLM/PromptBuilder.swift:2761-2783 | LLM/PromptBuilder.swift:2785-2807 | LLM/PromptBuilder.swift:2809-2832 — 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 `LLM/PromptBuilder.swift:2809` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (32 lines × 3) · ×1
  • Duplicated block (32 lines × 3) LLM/PromptBuilder.swift:1975 — LLM/PromptBuilder.swift:1975-2006 | LLM/PromptBuilder.swift:2009-2040 | LLM/PromptBuilder.swift:2043-2074 — 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 `LLM/PromptBuilder.swift:1975` 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.
D4 · Code Duplication · Duplicated block (19–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1139 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1139-1160 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1691-1709 — both copies are in the same file, so extract the 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (17–19 lines × 4) · ×1
  • Duplicated block (17–19 lines × 4) LLM/Backends/Remote/GatewayProviders.swift:607 — LLM/Backends/Remote/GatewayProviders.swift:607-623 | LLM/Backends/Remote/GatewayProviders.swift:648-666 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:607-623 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:648-666 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `LLM/Backends/Remote/GatewayProviders.swift:648` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) Agent/Engine/ToolChain.swift:2294 — Agent/Engine/ToolChain.swift:2294-2312 | Agent/Engine/ToolChain.swift:2348-2364 — both copies are in the same file, so extract the 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 `Agent/Engine/ToolChain.swift:2294` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–19 lines × 2) · ×1
  • Duplicated block (10–19 lines × 2) LLM/PromptBuilder.swift:463 — LLM/PromptBuilder.swift:463-481 | LLM/PromptBuilder.swift:687-696 — both copies are in the same file, so extract the 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 `LLM/PromptBuilder.swift:463` 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.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) Agent/Engine/GuardedSkillRouter.swift:214 — Agent/Engine/GuardedSkillRouter.swift:214-229 | Agent/Engine/Router.swift:161-178 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (2–18 lines × 5) · ×1
  • Duplicated block (2–18 lines × 5) Agent/Engine/ToolChain.swift:2252 — Agent/Engine/ToolChain.swift:2252-2269 | Agent/Engine/ToolChain.swift:2456-2457 | Tools/Handlers/Web.swift:1125-1127 | Tools/Handlers/Web.swift:1525-1542 | Tools/Handlers/Web.swift:1686-1687 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Agent/Engine/ToolChain.swift:2252` 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. 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.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×1
  • Duplicated block (17 lines × 4) UI/ConfigurationsView.swift:1553 — UI/ConfigurationsView.swift:1553-1569 | UI/ConfigurationsView.swift:1572-1588 | UI/ConfigurationsView.swift:2020-2036 | UI/ConfigurationsView.swift:2039-2055 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (10–14 lines × 4) · ×1
  • Duplicated block (10–14 lines × 4) Agent/Engine/ToolChain.swift:2722 — Agent/Engine/ToolChain.swift:2722-2731 | Agent/Engine/ToolChain.swift:2874-2883 | Agent/Engine/ToolChain.swift:2904-2917 | Agent/Engine/ToolChain.swift:3228-3237 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Agent/Engine/ToolChain.swift:2722` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Agent/Engine/ToolChain.swift:3239` calls `looksLikeStructuredIntermediateOutput`, `looksLikePromptEcho` and `Agent/Engine/ToolChain.swift:2732` 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.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1398 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1398-1411 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1522-1535 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1786-1799 — 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1398` 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, `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1785` calls `extractTextFromConversationResponse` and `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1397` 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.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:546 — LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:546-559 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:742-753 — both copies are in the same file, so extract the 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 `LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:546` 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.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) LLM/Backends/Remote/MacGateway.swift:482 — LLM/Backends/Remote/MacGateway.swift:482-508 | MacGateway/Sources/PhoneClawGateway/MacGateway.swift:482-508 — before extracting anything, compare `LLM/Backends/Remote/MacGateway.swift` and `MacGateway/Sources/PhoneClawGateway/MacGateway.swift` as WHOLE FILES: this scan already matched 26 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:533 — LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:533-545 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:729-740 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:1043-1054 — 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 `LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:533` 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.
D4 · Code Duplication · Duplicated block (11–12 lines × 4) · ×1
  • Duplicated block (11–12 lines × 4) LLM/Backends/Remote/GatewayProviders.swift:240 — LLM/Backends/Remote/GatewayProviders.swift:240-250 | LLM/Backends/Remote/GatewayProviders.swift:264-275 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:240-250 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:264-275 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) LLM/Backends/Remote/LANDiscovery.swift:54 — LLM/Backends/Remote/LANDiscovery.swift:54-73 | MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift:54-73 — before extracting anything, compare `LLM/Backends/Remote/LANDiscovery.swift` and `MacGateway/Sources/PhoneClawGateway/LANDiscovery.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (10–11 lines × 4) · ×1
  • Duplicated block (10–11 lines × 4) LLM/Backends/Remote/GatewayProviders.swift:668 — LLM/Backends/Remote/GatewayProviders.swift:668-678 | LLM/Backends/Remote/GatewayProviders.swift:858-867 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:668-678 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:858-867 — before extracting anything, compare `LLM/Backends/Remote/GatewayProviders.swift` and `MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift` as WHOLE FILES: this scan already matched 41 separate duplicated blocks between them, totalling at least 793 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1368 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1368-1377 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1492-1501 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1757-1765 — 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 `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1368` 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, `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1488` calls `createSession` and `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1366` 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.
D4 · Code Duplication · Duplicated block (7–9 lines × 4) · ×1
  • Duplicated block (7–9 lines × 4) LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:737 — LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:737-745 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:809-815 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1108-1114 | LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift:1187-1193 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `LocalPackages/PhoneClawEngine/Sources/PhoneClawEngine/PhoneClawEngine.swift: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.
D4 · Code Duplication · Duplicated block (6–8 lines × 3) · ×1
  • Duplicated block (6–8 lines × 3) Agent/Engine/ToolChain.swift:3105 — Agent/Engine/ToolChain.swift:3105-3110 | Agent/Engine/ToolChain.swift:3114-3121 | Agent/Engine/ToolChain.swift:3125-3130 — 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 `Agent/Engine/ToolChain.swift:3114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) LLM/Backends/Remote/GatewayProviders.swift:520 — LLM/Backends/Remote/GatewayProviders.swift:520-534 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:2709-2723 | MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:520-534 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×1
  • Duplicated block (8 lines × 3) UI/ConfigurationsView.swift:1380 — UI/ConfigurationsView.swift:1380-1387 | UI/ConfigurationsView.swift:1402-1409 | UI/ConfigurationsView.swift:1429-1436 — 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:841 — LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:841-847 | LLM/Backends/MiniCPMV/MiniCPMVBackend.swift:1233-1238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×1
  • Duplicated block (6 lines × 3) UI/ConfigurationsView.swift:224 — UI/ConfigurationsView.swift:224-229 | UI/ConfigurationsView.swift:257-262 | UI/ConfigurationsView.swift:485-490 — 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 `UI/ConfigurationsView.swift:224` 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.
D4 · Code Duplication · Duplicated block (5 lines × 7) · ×1
  • Duplicated block (5 lines × 7) Shared/LanguageService.swift:391 — Shared/LanguageService.swift:391-396 | Shared/LanguageService.swift:410-414 | Shared/LanguageService.swift:419-423 | Shared/LanguageService.swift:461-465 | Shared/LanguageService.swift:467-471 | Shared/LanguageService.swift:473-477 | Shared/LanguageService.swift:479-483 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Shared/LanguageService.swift:410` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Shared/LanguageService.swift:415` calls `hasPrefix` and `Shared/LanguageService.swift:466` 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.
D4 · Code Duplication · Duplicated block (4–5 lines × 5) · ×1
  • Duplicated block (4–5 lines × 5) MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1100 — MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1100-1104 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1510-1514 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1533-1537 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3378-3381 | MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:3702-3706 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1100` 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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×1
  • Duplicated block (5 lines × 3) Agent/Engine/EngineLifecycle.swift:182 — Agent/Engine/EngineLifecycle.swift:182-186 | Agent/Engine/EngineLifecycle.swift:189-193 | Agent/Engine/EngineLifecycle.swift:196-200 — 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.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Tools/Handlers/Health.swift:1057 — Tools/Handlers/Health.swift:1057-1102 | Tools/Handlers/Health.swift:1104-1162 | Tools/Handlers/Health.swift:1166-1212 | Tools/Handlers/Health.swift:1215-1262 | Tools/Handlers/Health.swift:1266-1338 | Tools/Handlers/Health.swift:1341-1397 — These 6 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 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×1
  • Edited copy of a member (23 corresponding lines) Tools/Handlers/Health.swift:444 — Tools/Handlers/Health.swift:444-466 | Tools/Handlers/Health.swift:468-490 — These two members are one piece of code written twice and then edited apart: 23 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 · Duplicated block (42 lines × 2) · ×1
  • Duplicated block (42 lines × 2) scripts/test-resumable-downloader.swift:163 — scripts/test-resumable-downloader.swift:163-204 | scripts/test-resumable-downloader.swift:211-252 — both copies are in the same file, so extract the 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 `scripts/test-resumable-downloader.swift:163` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 3) · ×1
  • Duplicated block (14–16 lines × 3) Tools/Handlers/Contacts.swift:391 — Tools/Handlers/Contacts.swift:391-406 | Tools/Handlers/Contacts.swift:531-544 | Tools/Handlers/Contacts.swift:664-679 — 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 `Tools/Handlers/Contacts.swift:391` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6–7 lines × 6) · ×1
  • Duplicated block (6–7 lines × 6) Tools/Handlers/Health.swift:363 — Tools/Handlers/Health.swift:363-368 | Tools/Handlers/Health.swift:371-376 | Tools/Handlers/Health.swift:379-385 | Tools/Handlers/Health.swift:967-972 | Tools/Handlers/Health.swift:975-980 | Tools/Handlers/Health.swift:983-989 — all 6 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 `Tools/Handlers/Health.swift:379` 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.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) Tools/Handlers/Health.swift:1087 — Tools/Handlers/Health.swift:1087-1092 | Tools/Handlers/Health.swift:1143-1148 | Tools/Handlers/Health.swift:1197-1202 | Tools/Handlers/Health.swift:1247-1252 | Tools/Handlers/Health.swift:1295-1300 | Tools/Handlers/Health.swift:1369-1374 — all 6 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 `Tools/Handlers/Health.swift:1087` 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.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: PhoneClawEngine — PhoneClawEngine: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
X3 · Exception handling · Swallowed exception (empty catch) · ×1
  • Swallowed exception (empty catch) Live/Core/LiveModeEngine.swift:463 — 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.
Minor — 48 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×24
  • Duplicated predicate UI/ConfigurationsView.swift:564 — `!$0.requiresLocalArtifact && !$0.id.hasPrefix("remote::")` appears character-identically in 2 files — UI/ConfigurationsView.swift, UI/ContentView.swift. 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 LLM/Backends/Remote/GatewayProviders.swift:142 — `!advertisedModels.isEmpty && !restrictToAdvertisedModels` appears character-identically in 2 files — LLM/Backends/Remote/GatewayProviders.swift, MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift. 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 LLM/Backends/Remote/GatewayProviders.swift:775 — `!cleanModel.isEmpty && cleanModel != "antigravity"` appears character-identically in 2 files — LLM/Backends/Remote/GatewayProviders.swift, MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift. 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 Agent/Engine/ToolChain.swift:2607 — `$0.role == .skillResult && $0.skillResultKind == .toolExecution` appears character-identically in 2 files — Agent/Engine/ToolChain.swift, LiveLand/Runtime/LiveLandVoiceRuntime.swift. 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 Agent/Engine/GuardedSkillRouter.swift:215 — `(scalar.value < 128) && ( CharacterSet.alphanumerics.contains(scalar) || scalar == "-" || scalar == "_" )` appears character-identically in 2 files — Agent/Engine/GuardedSkillRouter.swift, Agent/Engine/Router.swift. 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 Packages/InferenceKit/Package.swift:83 — `Context.environment["MLX_SWIFT_BUILD_DOC"] == "1" || Context.environment["SPI_GENERATE_DOCS"] == "1"` appears character-identically in 2 files — Packages/InferenceKit/Package.swift, Packages/mlx-swift/Package.swift. 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 Agent/Engine/Planner.swift:695 — `HotfixFeatureFlags.useHotfixPromptPipeline && HotfixFeatureFlags.enableCanonicalToolResult` appears character-identically in 2 files — Agent/Engine/Planner.swift, Agent/Engine/ToolChain.swift. 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 Agent/Engine/Planner.swift:800 — `cleaned.isEmpty || looksLikeStructuredIntermediateOutput(cleaned) || looksLikePromptEcho(cleaned)` appears character-identically in 2 files — Agent/Engine/Planner.swift, Agent/Engine/ToolChain.swift. 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 Packages/FluidAudio/Sources/FluidAudio/TTS/PocketTTS/Pipeline/PocketTtsSession.swift:198 — `eosLogit > PocketTtsConstants.eosThreshold && eosStep == nil` appears character-identically in 2 files — Packages/FluidAudio/Sources/FluidAudio/TTS/PocketTTS/Pipeline/PocketTtsSession.swift, Packages/FluidAudio/Sources/FluidAudio/TTS/PocketTTS/Pipeline/PocketTtsSynthesizer.swift. 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 LLM/Installation/Download/ResumableAssetDownloader.swift:894 — `error is CancellationError || Task.isCancelled` appears character-identically in 2 files — LLM/Installation/Download/ResumableAssetDownloader.swift, Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/SlidingWindowAsrManager.swift. 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 LLM/Backends/Remote/MacGateway.swift:161 — `host == "localhost" || host == "127.0.0.1" || host == "::1"` appears character-identically in 2 files — LLM/Backends/Remote/MacGateway.swift, MacGateway/Sources/PhoneClawGateway/MacGateway.swift. 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 LLM/Backends/Remote/MacGateway.swift:152 — `isAllowedLoopbackOrigin(origin) && isAllowedLoopbackOrigin(referer)` appears character-identically in 2 files — LLM/Backends/Remote/MacGateway.swift, MacGateway/Sources/PhoneClawGateway/MacGateway.swift. 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 LLM/Backends/Remote/MacGateway.swift:247 — `isComplete || error != nil || buf.count > 8_000_000` appears character-identically in 2 files — LLM/Backends/Remote/MacGateway.swift, MacGateway/Sources/PhoneClawGateway/MacGateway.swift. 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 LLM/MLX/Gemma4/Gemma4LanguageModel.swift:338 — `key.contains("input_max") || key.contains("input_min") || key.contains("output_max") || key.contains("output_min")` appears character-identically in 2 files — LLM/MLX/Gemma4/Gemma4LanguageModel.swift, LLM/MLX/Gemma4/Gemma4Model.swift. 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 LLM/Backends/Remote/GatewayProviders.swift:525 — `line.hasPrefix("model ") || line.hasPrefix("model=")` appears character-identically in 3 files — LLM/Backends/Remote/GatewayProviders.swift, MacGateway/Sources/PhoneClawGateway/GatewayApp.swift, MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift. 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 LLM/Backends/Remote/GatewayProviders.swift:321 — `lower.contains("-cloud") || lower.hasSuffix(":cloud")` appears character-identically in 2 files — LLM/Backends/Remote/GatewayProviders.swift, MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift. 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 Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/CTC/CtcJaManager.swift:174 — `maxLabel != models.blankId && maxLabel != prevLabel` appears character-identically in 2 files — Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/CTC/CtcJaManager.swift, Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/CTC/CtcZhCnManager.swift. 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 LLM/Backends/Remote/MacGateway.swift:504 — `migrated || hydrated.count != list.count` appears character-identically in 2 files — LLM/Backends/Remote/MacGateway.swift, MacGateway/Sources/PhoneClawGateway/MacGateway.swift. 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 LLM/Backends/Remote/GatewayProviders.swift:134 — `restrictToAdvertisedModels && !advertisedModels.isEmpty` appears character-identically in 2 files — LLM/Backends/Remote/GatewayProviders.swift, MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift. 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 Packages/FluidAudio/Sources/FluidAudio/TTS/Kokoro/Pipeline/Preprocess/KokoroChunker.swift:31 — `scalar.properties.isEmojiPresentation || scalar.properties.isEmoji` appears character-identically in 2 files — Packages/FluidAudio/Sources/FluidAudio/TTS/Kokoro/Pipeline/Preprocess/KokoroChunker.swift, Packages/FluidAudio/Sources/FluidAudio/TTS/SSML/SSMLTypes.swift. 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 Live/Audio/LiveAudioIO.swift:135 — `self.audioInputHandler != nil || self.audioInputBufferHandler != nil || self.visualisationInputHandler != nil` appears character-identically in 2 files — Live/Audio/LiveAudioIO.swift, LiveLand/Audio/LiveLandAudioIO.swift. 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 Agent/AgentEngine.swift:243 — `state == .downloaded || state == .bundled` appears character-identically in 2 files — Agent/AgentEngine.swift, LLM/Core/ModelRuntimeCoordinator.swift. 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 LLM/Backends/Remote/LANBinding.swift:135 — `status == errSecSuccess || status == errSecItemNotFound` appears character-identically in 4 files — LLM/Backends/Remote/LANBinding.swift, LLM/Backends/Remote/MacGateway.swift, MacGateway/Sources/PhoneClawGateway/GatewayApp.swift, MacGateway/Sources/PhoneClawGateway/MacGateway.swift. 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 Agent/Engine/OutputCleaner.swift:11 — `trimmed.hasPrefix("```json") || trimmed.hasPrefix("```")` appears character-identically in 2 files — Agent/Engine/OutputCleaner.swift, Agent/Engine/ToolCallParser.swift. 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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×11
  • Silent fallback default in catch MacGateway/Sources/PhoneClawGateway/GatewayApp.swift:1931 — `codexExecutablePathsFromNVM` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch MacGateway/Sources/PhoneClawGateway/GatewayProviders.swift:583 — `codexExecutablePathsFromNVM` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch Agent/Engine/ToolChain.swift:2134 — `regexMatchCount` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch Agent/Engine/ChatSessionStore.swift:331 — `loadSessionsIndex` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch Tools/Handlers/Web.swift:1806 — `regexMatches` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch LLM/Backends/Remote/GatewayProviders.swift:583 — `codexExecutablePathsFromNVM` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch LLM/Installation/Download/DownloadManifestStore.swift:166 — `fileSize` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch LLM/Installation/Download/ResumableAssetDownloader.swift:870 — `fileSize` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch LLM/Installation/Download/ResumableAssetDownloader.swift:1510 — `fileSize` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch LLM/MLX/Installation/LiveModelInstallFinalizer.swift:75 — `fileSize` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch Packages/InferenceKit/Libraries/MLXLMCommon/Extensions/Encodable+toolResult.swift:11 — `toolResult` turns every thrown error into `"{}"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
X9 · Subsumed condition operand · Subsumed condition operand · ×2
  • Subsumed condition operand Agent/Engine/OutputCleaner.swift:11 — `trimmed.hasPrefix("```json")` can never decide this `||` — every value satisfying `trimmed.hasPrefix("```json")` also satisfies `trimmed.hasPrefix("```")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
  • Subsumed condition operand Agent/Engine/ToolCallParser.swift:80 — `trimmed.hasPrefix("```json")` can never decide this `||` — every value satisfying `trimmed.hasPrefix("```json")` also satisfies `trimmed.hasPrefix("```")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
D16 · Bus Factor · Small-team knowledge concentration · ×1
  • Small-team knowledge concentration — 94 file(s) are concentrated to one author — the ambient state with 2 active author(s), not 94 separate risks. The signal becomes meaningful as ownership spreads; no per-file action implied now.
D21 · Naming Consistency · `Qwen3ASR` spells `ASR` where 13 names in the project spell it `Asr` · ×1
  • `Qwen3ASR` spells `ASR` where 13 names in the project spell it `Asr` Packages/FluidAudio/Sources/FluidAudio/ModelNames.swift:530 — 13 of 14 names in project Packages~FluidAudio~FluidAudio spell the token `Asr` (13 of 14; unit: names in project Packages~FluidAudio~FluidAudio containing `Asr`). Peers: Packages~FluidAudio~FluidAudio.SlidingWindowAsrManager (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/SlidingWindowAsrManager.swift:10); Packages~FluidAudio~FluidAudio.SlidingWindowAsrConfig (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/SlidingWindowAsrManager.swift:683); Packages~FluidAudio~FluidAudio.SlidingWindowAsrSession (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/SlidingWindowAsrSession.swift:6); Packages~FluidAudio~FluidAudio.SlidingWindowAsrError (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/SlidingWindow/SlidingWindowAsrSession.swift:159); Packages~FluidAudio~FluidAudio.StreamingEouAsrManager (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/Streaming/EOU/StreamingEouAsrManager.swift:163). Rename to `Qwen3Asr`. [rule N6]
D21 · Naming Consistency · `voiceID` spells `ID` where 62 names in the project spell it `Id` · ×1
  • `voiceID` spells `ID` where 62 names in the project spell it `Id` Packages/FluidAudio/Sources/FluidAudio/TTS/Kokoro/Pipeline/Synthesize/KokoroSynthesizer+VoiceEmbeddings.swift:158 — 62 of 63 names in project Packages~FluidAudio~FluidAudio spell the token `Id` (62 of 63; unit: names in project Packages~FluidAudio~FluidAudio containing `Id`). Peers: TokenTiming.tokenId (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/AsrTypes.swift:96); TokenTiming.init(tokenId) (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/AsrTypes.swift:101); ParakeetLanguageModelConfig.blankId (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/ParakeetLanguageModels.swift:7); ParakeetLanguageModels.blankId (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/ParakeetLanguageModels.swift:43); ParakeetLanguageModels.init(blankId) (Packages/FluidAudio/Sources/FluidAudio/ASR/Parakeet/ParakeetLanguageModels.swift:49). Rename to `voiceId`. [rule N6]
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 5 project(s) overshoot their size bounds, lowering Project Cohesion to 6.0/10. The most over is `(repository root)` (62793 LoC, 1476 module-visible types across 128 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
M2 · Architecture documentation · ADRs not easily discoverable · ×1
  • ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `Docs/architecture-decisions.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Most of the production code is in directories of its own, but 1 application file(s) sit at the repository root beside the build and tooling files (`PhoneClaw-Bridging-Header.h`).
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 3/5 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `Experiments/iOS27CoreAIProbeApp`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 1 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.
P3 · Security & performance tooling · Dependabot does not watch pip/gradle/gitsubmodule · ×1
  • Dependabot does not watch pip/gradle/gitsubmodule Packages/mlx-swift/Source/Cmlx/mlx/.github/dependabot.yml:2 — `Packages/mlx-swift/Source/Cmlx/mlx/.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, `gradle`, `gitsubmodule`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×1
  • Hand-rolled JSON/XML parsing via regex Agent/Engine/EngineLifecycle.swift:524 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Swift code already uses a real parser in the same package; use it here too.
Minor — 8 finding(s)
D12 · Dependency Hygiene · Outdated · ×8
  • Outdated: swift-argument-parser — `swift-argument-parser` is resolved at 1.7.1, but 1.8.2 is the newest release tagged on https://github.com/apple/swift-argument-parser.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-argument-parser` reaches this one with no change to Package.swift.
  • Outdated: swift-asn1 — `swift-asn1` is resolved at 1.7.0, but 1.7.4 is the newest release tagged on https://github.com/apple/swift-asn1.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-asn1` reaches this one with no change to Package.swift.
  • Outdated: swift-cmark — `swift-cmark` is resolved at 0.7.1, but 0.9.0 is the newest release tagged on https://github.com/swiftlang/swift-cmark within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-cmark` reaches this one with no change to Package.swift.
  • Outdated: swift-collections — `swift-collections` is resolved at 1.4.1, but 1.7.6 is the newest release tagged on https://github.com/apple/swift-collections.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-collections` reaches this one with no change to Package.swift.
  • Outdated: swift-crypto — `swift-crypto` is resolved at 4.5.0, but 4.5.2 is the newest release tagged on https://github.com/apple/swift-crypto.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-crypto` reaches this one with no change to Package.swift.
  • Outdated: swift-jinja — `swift-jinja` is resolved at 2.3.5, but 2.5.2 is the newest release tagged on https://github.com/huggingface/swift-jinja.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-jinja` reaches this one with no change to Package.swift.
  • Outdated: swift-transformers — `swift-transformers` is resolved at 1.1.9, but 1.4.0 is the newest release tagged on https://github.com/huggingface/swift-transformers.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-transformers` reaches this one with no change to Package.swift.
  • Outdated: yyjson — `yyjson` is resolved at 0.12.0, but 0.13.0 is the newest release tagged on https://github.com/ibireme/yyjson.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update yyjson` reaches this one with no change to Package.swift.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-948e794578af4017b664d2b3f2970130/history.json --exit-code 0 --source .2artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-948e794578af4017b664d2b3f2970130/tree.json --exit-code 0 --source .2artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude App/OrbWebAssets/three/build --exclude Packages/FluidAudio --exclude Packages/InferenceKit/Libraries --exclude Packages/InferenceKit/skills --exclude Packages/mlx-swift/Source/Cmlx/fmt --exclude Packages/mlx-swift/Source/Cmlx/framework --exclude Packages/mlx-swift/Source/Cmlx/include --exclude Packages/mlx-swift/Source/Cmlx/include-framework --exclude Packages/mlx-swift/Source/Cmlx/json --exclude Packages/mlx-swift/Source/Cmlx/metal-cpp --exclude Packages/mlx-swift/Source/Cmlx/mlx/benchmarks --exclude Packages/mlx-swift/Source/Cmlx/mlx/cmake --exclude Packages/mlx-swift/Source/Cmlx/mlx/docs --exclude Packages/mlx-swift/Source/Cmlx/mlx/examples --exclude Packages/mlx-swift/Source/Cmlx/mlx/mlx --exclude Packages/mlx-swift/Source/Cmlx/mlx/python --exclude Packages/mlx-swift/Source/Cmlx/mlx/tests --exclude Packages/mlx-swift/Source/Cmlx/mlx-c --exclude Packages/mlx-swift/Source/Cmlx/mlx-conditional --exclude Packages/mlx-swift/Source/Cmlx/mlx-generated --exclude Packages/mlx-swift/Source/Examples --exclude Packages/mlx-swift/Source/MLX --exclude Packages/mlx-swift/Source/MLXFFT --exclude Packages/mlx-swift/Source/MLXFast --exclude Packages/mlx-swift/Source/MLXLinalg --exclude Packages/mlx-swift/Source/MLXNN --exclude Packages/mlx-swift/Source/MLXOptimizers --exclude Packages/mlx-swift/Source/MLXRandom --exclude Packages/mlx-swift/Tests --exclude Packages/mlx-swift/cmake --exclude Packages/mlx-swift/skills --exclude Packages/mlx-swift/tools --exclude Packages/mlx-swift/xcode .4artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 20 file(s) — `Agent/Engine/GuardedSkillRouter.swift`, `Agent/Engine/OutputCleaner.swift`, `Agent/Engine/PromptPipelineHelpers.swift`, `Agent/Engine/ToolChain.swift`, `Experiments/iOS27CoreAI/Sources/IOS27CoreAIExperiment/PlanningPromptBuilder.swift`, … (+15 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D36 · Supply-chain Provenance & Signingprovenance—provenance: not applicable — The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files).0—
D37 · Vulnerability-disclosure Policydisclosure—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.0—
D40 · Network Egress Confinementruntime-hardening—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.0—
D41 · Kernel & Syscall Confinementruntime-hardening—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.0—
D42 · Runtime Threat Enforcementruntime-hardening—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.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1dd09-c252-7896-876b-58e08892074c · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

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.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md