Public report of zeroclaw-labs/zeroclaw, published 26 October 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). 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, 26 October 2026, 02:55 UTC · Survey ID cd_1a4665335b784b8192ea8057f14292dc
zeroclaw-labs/zeroclaw
Measured 26 October 2026, 02:48 UTC, at code version 5d4b18d
Regression: 2 dimensions fell since the last survey
A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
No change 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 very large codebase: 1,232,333 lines of product code in 34 projects, tests not counted · Estimated rebuild effort: about 10.4 person-years · Weakest lens: Event Sourcing, 49
Findings by how serious they are
86 critical3605 serious152 minor
22 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 02:48 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
74of 74 dimensions measured by tools.
3786of 3843 findings point to an exact file and line, so you can open each one in the code. The other 57 concern the repository as a whole, such as missing documentation.
74dimensions across 9 lenses, read from 1,232,333 lines of product code in 34 projects.
zeroclaw-labs/zeroclaw falls short of our standard for a preview release because it has history replays that read the clock or random values. It scores 56 out of 100 and is rated Adequate, and 38 of its 86 critical findings are security problems.
Event Sourcing, at 49, is the weakest lens and counts most in the score. The best first step is making event replay repeatable, worth about 7 points. Restoring certificate checks is another step, worth about 2 points. Raising Event Sourcing to 65 would lift the score to about 62.
Twelve weaknesses in the code could be used by an attacker. Seven settings leave the servers or containers unsafe, and twenty-six form fields can't be read by a screen reader. Fixing the weaknesses the scanner points to, correcting the unsafe settings and labelling the form fields would close these risks. Limiting each secret to its own step would fix the five secrets exposed to more of the pipeline than needed, and the five pipeline steps that install packages without pinning their versions need the packages they install pinned to exact versions. The 11 labels or groups of fields with no name need connecting to their fields or naming.
The product code is 1,232,333 lines, about €1,500,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Event Sourcing rose from 49 to 65, the lowest score rated Strong, the score would rise from 56 to about 62.
Code composition: what the lines of code are
Product code 96%Tests 4%
New since the last survey: 247 findings
These 247 critical or serious findings weren't in the previous survey, on 12 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · FunctionTooLong: zeroclaw_runtime::agent::turn::run_tool_call_loop_impl crates/zeroclaw-runtime/src/agent/turn/mod.rs
God Classes · MethodTooLong: DelegateTool.execute_agentic_with_approval_registry crates/zeroclaw-runtime/src/tools/delegate.rs
God Classes · MethodTooLong: AnthropicModelProvider.stream_chat_with_tool_round_policy crates/zeroclaw-providers/src/anthropic.rs
God Classes · ClassTooLong: PluginHost crates/zeroclaw-plugins/src/host.rs
God Classes · MethodTooLong: App.handle_mouse_inner apps/zerocode/src/config_manager.rs
God Classes · MethodTooLong: SopEngine.advance_current_step crates/zeroclaw-runtime/src/sop/engine.rs
God Classes · TooManyMethods: PluginHost crates/zeroclaw-plugins/src/host.rs
God Classes · MethodTooLong: RpcDispatcher.prepare_live_sessions_refresh crates/zeroclaw-runtime/src/rpc/dispatch.rs
God Classes · FunctionTooLong: zeroclaw::channel_instance_readiness_lines_with_admission src/main.rs
God Classes · FileTooLong: tools/scoped.rs crates/zeroclaw-runtime/src/tools/scoped.rs
God Classes · FunctionTooLong: zeroclaw::run_plugin_update src/main.rs
God Classes · MethodTooLong: App.bottom_hint apps/zerocode/src/config_manager.rs
God Classes · MethodTooLong: App.draw_field_edit apps/zerocode/src/config_manager.rs
God Classes · MethodTooLong: PluginHost.remove_with_report crates/zeroclaw-plugins/src/host.rs
God Classes · FunctionTooLong: zeroclaw_runtime::agent::turn::vision_route::resolve_vision_provider_with_allowed_refs crates/zeroclaw-runtime/src/agent/turn/vision_route.rs
God Classes · FunctionTooLong: zeroclaw::update_one_plugin src/main.rs
God Classes · ClassTooLong: AgentSidebar apps/zerocode/src/agent_sidebar.rs
God Classes · MethodTooLong: App.draw_alias_list apps/zerocode/src/config_manager.rs
God Classes · TooManyMethods: ModelRoutingConfigTool crates/zeroclaw-tools/src/model_routing_config.rs
God Classes · TooManyFields: RuntimeProfileConfig crates/zeroclaw-config/src/schema.rs
God Classes · MethodTooLong: AnthropicModelProvider.chat_with_tool_round_policy crates/zeroclaw-providers/src/anthropic.rs
God Classes · FileTooLong: src/agent_sidebar.rs apps/zerocode/src/agent_sidebar.rs
God Classes · FileTooLong: security/detect.rs crates/zeroclaw-runtime/src/security/detect.rs
God Classes · TooManyMethods: MessageQueue apps/zerocode/src/chat/message_queue.rs
God Classes · TooManyMethods: OpenAiCompatibleBuilder crates/zeroclaw-providers/src/compatible.rs
God Classes · MethodTooLong: App.draw_into apps/zerocode/src/config_manager.rs
God Classes · MethodTooLong: RpcDispatcher.handle_config_map_key_delete crates/zeroclaw-runtime/src/rpc/dispatch.rs
God Classes · MethodTooLong: ModelRoutingConfigTool.handle_set_default crates/zeroclaw-tools/src/model_routing_config.rs
God Classes · MethodTooLong: App.handle_alias_rename apps/zerocode/src/config_manager.rs
God Classes · MethodTooLong: SopEngine.resume_deterministic_run crates/zeroclaw-runtime/src/sop/engine.rs
Code Duplication · Members sharing a duplicated core (17 members, 50+ identical tokens) crates/zeroclaw-providers/src/anthropic.rs
Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) crates/zeroclaw-channels/src/matrix.rs
Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) crates/zeroclaw-providers/src/anthropic.rs
Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) crates/zeroclaw-tools/src/web_search_tool.rs
Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) crates/zeroclaw-tools/src/web_search_tool.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/bluesky.rs
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 217 findings
These 217 critical or serious findings were in the previous survey, on 12 October 2026, and are gone from this one. The first 100 are listed here.
€500,000 to €2,500,000, for 8,354 to 26,503 hours of work, about 10.4 person-years for 6 to 20 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.8 at a score of 56. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Very large: 1,232,333 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Stamp clock/random values into the event in the command; the recovery fold must be a pure function of the event.
Raises the score by about 7 points · Medium effort · Fold determinism
2
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.
Raises the score by about 1 point · Low effort · Secret Scanning
3
Stop accepting every TLS certificate: delete `danger_accept_invalid_certs(true)` / `SslVerifyMode::NONE` / the rustls verifier that returns `ServerCertVerified::assertion()` unconditionally, and trust a self-signed or private server by adding its CA as a root (`add_root_certificate`, a rustls `RootCertStore`) — never by switching verification off.
This repository constructs a TLS client that accepts any certificate at 3 sites, not one: `apps/zerocode/src/enroll.rs:445` (a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`)), `apps/zerorelay/src/enroll_proxy.rs:350` (a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`)), `crates/zeroclaw-channels/src/irc.rs:306` (a rustls `ServerCertVerifier` that accepts every certificate (`NoVerify`)). Each is a separate decision — fixing only the line this row cites leaves the others in place.
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 €1,500,000 to build again, about 10.4 person-years of work. Its weakest lens is Event Sourcing, at 49 (Weak). Event Sourcing is about whether the stored history the system is built on can be trusted. Because the weakest lens counts most in the score, work on Event Sourcing also moves the score most.
Based on: the rebuild estimate · the Event Sourcing grade · how much each lens counts
What to do: Start with the Event Sourcing actions in Top priorities.
If you do one thing first · First action
Stamp clock/random values into the event in the command; the recovery fold must be a pure function of the event. Of all the actions in this report, it raises the score most for the work it takes: about 7 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 6.5 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 871,498 lines over the last 90 days, which is about 3,534,409 lines a year. At that pace, the extra work comes to an estimated 339.1 to 2034.9 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, 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.
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.
1073 modules, with 2588 dependencies between them. 13 loops run through 44 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 1033 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.
crossterm.event uses zerorelay.main, so a change to zerorelay.main can break crossterm.event, while a change to crossterm.event can't break zerorelay.main.
Position
Below the diagonal: crossterm.event uses a module listed above it, which is the healthy direction.
6→7 zeroclaw_log.event uses xtask.generate.specpart of a loop✕
Connections
2 pairs of types, where a type in zeroclaw_log.event uses a type in xtask.generate.spec.
zeroclaw_log.event uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_log.event, while a change to zeroclaw_log.event can't break xtask.generate.spec.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
xtask.generate.spec uses zeroclaw_log.event, so a change to zeroclaw_log.event can break xtask.generate.spec, while a change to xtask.generate.spec can't break zeroclaw_log.event.
Position
Below the diagonal: xtask.generate.spec uses a module listed above it, which is the healthy direction.
zeroclaw_api.a2a_wire uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_api.a2a_wire, while a change to zeroclaw_api.a2a_wire can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_api.a2a_wire uses a module listed above it, which is the healthy direction.
zeroclaw_plugins uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_plugins, while a change to zeroclaw_plugins can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_plugins uses a module listed above it, which is the healthy direction.
zerocode.wire uses xtask.generate.spec, so a change to xtask.generate.spec can break zerocode.wire, while a change to zerocode.wire can't break xtask.generate.spec.
Position
Below the diagonal: zerocode.wire uses a module listed above it, which is the healthy direction.
zeroclaw_api.attribution uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_api.attribution, while a change to zeroclaw_api.attribution can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_api.attribution uses a module listed above it, which is the healthy direction.
zeroclaw_plugins.component uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_plugins.component, while a change to zeroclaw_plugins.component can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_plugins.component uses a module listed above it, which is the healthy direction.
zeroclaw_plugins.component uses zeroclaw_plugins, so a change to zeroclaw_plugins can break zeroclaw_plugins.component, while a change to zeroclaw_plugins.component can't break zeroclaw_plugins.
Position
Below the diagonal: zeroclaw_plugins.component uses a module listed above it, which is the healthy direction.
12→32 zeroclaw_plugins.component uses zeroclaw.mainpart of a loop✕
Connections
1 pair of types, where a type in zeroclaw_plugins.component uses a type in zeroclaw.main.
zeroclaw_plugins.component uses zeroclaw.main, so a change to zeroclaw.main can break zeroclaw_plugins.component, while a change to zeroclaw_plugins.component can't break zeroclaw.main.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
zerocode.client uses xtask.generate.spec, so a change to xtask.generate.spec can break zerocode.client, while a change to zerocode.client can't break xtask.generate.spec.
Position
Below the diagonal: zerocode.client uses a module listed above it, which is the healthy direction.
zerocode.client uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zerocode.client, while a change to zerocode.client can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zerocode.client uses a module listed above it, which is the healthy direction.
zerocode.client uses zerocode.wire, so a change to zerocode.wire can break zerocode.client, while a change to zerocode.client can't break zerocode.wire.
Position
Below the diagonal: zerocode.client uses a module listed above it, which is the healthy direction.
zeroclaw_api.channel uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_api.channel, while a change to zeroclaw_api.channel can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_api.channel uses a module listed above it, which is the healthy direction.
zeroclaw_api.channel uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_api.channel, while a change to zeroclaw_api.channel can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_api.channel uses a module listed above it, which is the healthy direction.
zeroclaw_api.memory_traits uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_api.memory_traits, while a change to zeroclaw_api.memory_traits can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_api.memory_traits uses a module listed above it, which is the healthy direction.
zeroclaw_api.model_provider uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_api.model_provider, while a change to zeroclaw_api.model_provider can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_api.model_provider uses a module listed above it, which is the healthy direction.
zeroclaw_api.model_provider uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_api.model_provider, while a change to zeroclaw_api.model_provider can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_api.model_provider uses a module listed above it, which is the healthy direction.
zeroclaw_api.tool uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_api.tool, while a change to zeroclaw_api.tool can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_api.tool uses a module listed above it, which is the healthy direction.
zeroclaw_api.tool uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_api.tool, while a change to zeroclaw_api.tool can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_api.tool uses a module listed above it, which is the healthy direction.
zerocode.chat uses crossterm.event, so a change to crossterm.event can break zerocode.chat, while a change to zerocode.chat can't break crossterm.event.
Position
Below the diagonal: zerocode.chat uses a module listed above it, which is the healthy direction.
zerocode.chat uses xtask.generate.spec, so a change to xtask.generate.spec can break zerocode.chat, while a change to zerocode.chat can't break xtask.generate.spec.
Position
Below the diagonal: zerocode.chat uses a module listed above it, which is the healthy direction.
zerocode.chat uses zerocode.client, so a change to zerocode.client can break zerocode.chat, while a change to zerocode.chat can't break zerocode.client.
Position
Below the diagonal: zerocode.chat uses a module listed above it, which is the healthy direction.
zeroclaw_providers.compatible uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_providers.compatible, while a change to zeroclaw_providers.compatible can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_providers.compatible uses a module listed above it, which is the healthy direction.
zeroclaw_providers.compatible uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_providers.compatible, while a change to zeroclaw_providers.compatible can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_providers.compatible uses a module listed above it, which is the healthy direction.
zeroclaw_providers.compatible uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_providers.compatible, while a change to zeroclaw_providers.compatible can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_providers.compatible uses a module listed above it, which is the healthy direction.
zeroclaw_providers.compatible uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_providers.compatible, while a change to zeroclaw_providers.compatible can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_providers.compatible uses a module listed above it, which is the healthy direction.
19→21 zeroclaw_providers.compatible uses zeroclaw_config.schemapart of a loop✕
Connections
7 pairs of types, where a type in zeroclaw_providers.compatible uses a type in zeroclaw_config.schema.
zeroclaw_providers.compatible uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_providers.compatible, while a change to zeroclaw_providers.compatible can't break zeroclaw_config.schema.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
zeroclaw_runtime.rpc.types uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_runtime.rpc.types, while a change to zeroclaw_runtime.rpc.types can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_runtime.rpc.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.types uses zerocode.wire, so a change to zerocode.wire can break zeroclaw_runtime.rpc.types, while a change to zeroclaw_runtime.rpc.types can't break zerocode.wire.
Position
Below the diagonal: zeroclaw_runtime.rpc.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.types uses zerocode.client, so a change to zerocode.client can break zeroclaw_runtime.rpc.types, while a change to zeroclaw_runtime.rpc.types can't break zerocode.client.
Position
Below the diagonal: zeroclaw_runtime.rpc.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.types uses zeroclaw_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.rpc.types, while a change to zeroclaw_runtime.rpc.types can't break zeroclaw_api.memory_traits.
Position
Below the diagonal: zeroclaw_runtime.rpc.types uses a module listed above it, which is the healthy direction.
zeroclaw_config.schema uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_config.schema, while a change to zeroclaw_config.schema can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_config.schema uses a module listed above it, which is the healthy direction.
zeroclaw_config.schema uses zerocode.wire, so a change to zerocode.wire can break zeroclaw_config.schema, while a change to zeroclaw_config.schema can't break zerocode.wire.
Position
Below the diagonal: zeroclaw_config.schema uses a module listed above it, which is the healthy direction.
zeroclaw_config.schema uses zeroclaw_providers.compatible, so a change to zeroclaw_providers.compatible can break zeroclaw_config.schema, while a change to zeroclaw_config.schema can't break zeroclaw_providers.compatible.
Position
Below the diagonal: zeroclaw_config.schema uses a module listed above it, which is the healthy direction.
zeroclaw_channels.matrix.streaming uses zeroclaw_api.channel, so a change to zeroclaw_api.channel can break zeroclaw_channels.matrix.streaming, while a change to zeroclaw_channels.matrix.streaming can't break zeroclaw_api.channel.
Position
Below the diagonal: zeroclaw_channels.matrix.streaming uses a module listed above it, which is the healthy direction.
zeroclaw_channels.matrix.streaming uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_channels.matrix.streaming, while a change to zeroclaw_channels.matrix.streaming can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_channels.matrix.streaming uses a module listed above it, which is the healthy direction.
zeroclaw_config.live uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_config.live, while a change to zeroclaw_config.live can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_config.live uses a module listed above it, which is the healthy direction.
zeroclaw_config.policy uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_config.policy, while a change to zeroclaw_config.policy can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_config.policy uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.live_config_authority uses zerocode.wire, so a change to zerocode.wire can break zeroclaw_runtime.live_config_authority, while a change to zeroclaw_runtime.live_config_authority can't break zerocode.wire.
Position
Below the diagonal: zeroclaw_runtime.live_config_authority uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.live_config_authority uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.live_config_authority, while a change to zeroclaw_runtime.live_config_authority can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.live_config_authority uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.live_config_authority uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.live_config_authority, while a change to zeroclaw_runtime.live_config_authority can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.live_config_authority uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.skills uses zerorelay.main, so a change to zerorelay.main can break zeroclaw_runtime.skills, while a change to zeroclaw_runtime.skills can't break zerorelay.main.
Position
Below the diagonal: zeroclaw_runtime.skills uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.skills uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_runtime.skills, while a change to zeroclaw_runtime.skills can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_runtime.skills uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.skills uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_runtime.skills, while a change to zeroclaw_runtime.skills can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_runtime.skills uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.skills uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.skills, while a change to zeroclaw_runtime.skills can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.skills uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.skills uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.skills, while a change to zeroclaw_runtime.skills can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.skills uses a module listed above it, which is the healthy direction.
zeroclaw_tools.mcp_deferred uses zeroclaw_api.tool, so a change to zeroclaw_api.tool can break zeroclaw_tools.mcp_deferred, while a change to zeroclaw_tools.mcp_deferred can't break zeroclaw_api.tool.
Position
Below the diagonal: zeroclaw_tools.mcp_deferred uses a module listed above it, which is the healthy direction.
zeroclaw_tools.mcp_deferred uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_tools.mcp_deferred, while a change to zeroclaw_tools.mcp_deferred can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_tools.mcp_deferred uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.types uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_runtime.sop.types, while a change to zeroclaw_runtime.sop.types can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_runtime.sop.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.types uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_runtime.sop.types, while a change to zeroclaw_runtime.sop.types can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_runtime.sop.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.types uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_runtime.sop.types, while a change to zeroclaw_runtime.sop.types can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_runtime.sop.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.types uses zerocode.client, so a change to zerocode.client can break zeroclaw_runtime.sop.types, while a change to zeroclaw_runtime.sop.types can't break zerocode.client.
Position
Below the diagonal: zeroclaw_runtime.sop.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.types uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.sop.types, while a change to zeroclaw_runtime.sop.types can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.sop.types uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_api.tool, so a change to zeroclaw_api.tool can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_api.tool.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_runtime.skills, so a change to zeroclaw_runtime.skills can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_runtime.skills.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.delegate uses zeroclaw_tools.mcp_deferred, so a change to zeroclaw_tools.mcp_deferred can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_tools.mcp_deferred.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.audit uses zeroclaw_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.sop.audit, while a change to zeroclaw_runtime.sop.audit can't break zeroclaw_api.memory_traits.
Position
Below the diagonal: zeroclaw_runtime.sop.audit uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.audit uses zeroclaw_runtime.sop.types, so a change to zeroclaw_runtime.sop.types can break zeroclaw_runtime.sop.audit, while a change to zeroclaw_runtime.sop.audit can't break zeroclaw_runtime.sop.types.
Position
Below the diagonal: zeroclaw_runtime.sop.audit uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.engine uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_runtime.sop.engine, while a change to zeroclaw_runtime.sop.engine can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_runtime.sop.engine uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.engine uses zerocode.client, so a change to zerocode.client can break zeroclaw_runtime.sop.engine, while a change to zeroclaw_runtime.sop.engine can't break zerocode.client.
Position
Below the diagonal: zeroclaw_runtime.sop.engine uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.engine uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.sop.engine, while a change to zeroclaw_runtime.sop.engine can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.sop.engine uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.engine uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.sop.engine, while a change to zeroclaw_runtime.sop.engine can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.sop.engine uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.sop.engine uses zeroclaw_runtime.sop.types, so a change to zeroclaw_runtime.sop.types can break zeroclaw_runtime.sop.engine, while a change to zeroclaw_runtime.sop.engine can't break zeroclaw_runtime.sop.types.
Position
Below the diagonal: zeroclaw_runtime.sop.engine uses a module listed above it, which is the healthy direction.
zeroclaw.main uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw.main, while a change to zeroclaw.main can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw.main uses a module listed above it, which is the healthy direction.
zeroclaw.main uses zeroclaw_plugins, so a change to zeroclaw_plugins can break zeroclaw.main, while a change to zeroclaw.main can't break zeroclaw_plugins.
Position
Below the diagonal: zeroclaw.main uses a module listed above it, which is the healthy direction.
zeroclaw.main uses zeroclaw_plugins.component, so a change to zeroclaw_plugins.component can break zeroclaw.main, while a change to zeroclaw.main can't break zeroclaw_plugins.component.
Position
Below the diagonal: zeroclaw.main uses a module listed above it, which is the healthy direction.
zeroclaw.main uses zerocode.client, so a change to zerocode.client can break zeroclaw.main, while a change to zeroclaw.main can't break zerocode.client.
Position
Below the diagonal: zeroclaw.main uses a module listed above it, which is the healthy direction.
zeroclaw.main uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw.main, while a change to zeroclaw.main can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw.main uses a module listed above it, which is the healthy direction.
zeroclaw.main uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw.main, while a change to zeroclaw.main can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw.main uses a module listed above it, which is the healthy direction.
zeroclaw.main uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw.main, while a change to zeroclaw.main can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw.main uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_desktop.state, so a change to zeroclaw_desktop.state can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_desktop.state.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_api.channel, so a change to zeroclaw_api.channel can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_api.channel.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_api.tool, so a change to zeroclaw_api.tool can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_api.tool.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_channels.matrix.streaming, so a change to zeroclaw_channels.matrix.streaming can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_channels.matrix.streaming.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_gateway uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw_gateway, while a change to zeroclaw_gateway can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw_gateway uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_log.event, so a change to zeroclaw_log.event can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_log.event.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zerocode.client, so a change to zerocode.client can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zerocode.client.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_runtime.skills, so a change to zeroclaw_runtime.skills can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_runtime.skills.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_tools.mcp_deferred, so a change to zeroclaw_tools.mcp_deferred can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_tools.mcp_deferred.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.turn uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw_runtime.agent.turn uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.context uses zeroclaw_api.channel, so a change to zeroclaw_api.channel can break zeroclaw_runtime.rpc.context, while a change to zeroclaw_runtime.rpc.context can't break zeroclaw_api.channel.
Position
Below the diagonal: zeroclaw_runtime.rpc.context uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.context uses zerocode.chat, so a change to zerocode.chat can break zeroclaw_runtime.rpc.context, while a change to zeroclaw_runtime.rpc.context can't break zerocode.chat.
Position
Below the diagonal: zeroclaw_runtime.rpc.context uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.context uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.rpc.context, while a change to zeroclaw_runtime.rpc.context can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.rpc.context uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.context uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.rpc.context, while a change to zeroclaw_runtime.rpc.context can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.rpc.context uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.context uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.rpc.context, while a change to zeroclaw_runtime.rpc.context can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.rpc.context uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.context uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw_runtime.rpc.context, while a change to zeroclaw_runtime.rpc.context can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw_runtime.rpc.context uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.context uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw_runtime.rpc.context, while a change to zeroclaw_runtime.rpc.context can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw_runtime.rpc.context uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zerorelay.main, so a change to zerorelay.main can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zerorelay.main.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_plugins, so a change to zeroclaw_plugins can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_plugins.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_plugins.component, so a change to zeroclaw_plugins.component can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_plugins.component.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_api.tool, so a change to zeroclaw_api.tool can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_api.tool.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_runtime.tools.delegate, so a change to zeroclaw_runtime.tools.delegate can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_runtime.tools.delegate.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw_runtime.tools uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_api.channel, so a change to zeroclaw_api.channel can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_api.channel.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_providers.compatible, so a change to zeroclaw_providers.compatible can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_providers.compatible.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_tools.mcp_deferred, so a change to zeroclaw_tools.mcp_deferred can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_tools.mcp_deferred.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_channels.orchestrator uses zeroclaw_runtime.tools, so a change to zeroclaw_runtime.tools can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_runtime.tools.
Position
Below the diagonal: zeroclaw_channels.orchestrator uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_api.channel, so a change to zeroclaw_api.channel can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_api.channel.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_api.memory_traits.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_runtime.skills, so a change to zeroclaw_runtime.skills can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.skills.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_tools.mcp_deferred, so a change to zeroclaw_tools.mcp_deferred can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_tools.mcp_deferred.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_runtime.tools.delegate, so a change to zeroclaw_runtime.tools.delegate can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.tools.delegate.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.agent uses zeroclaw_runtime.agent.turn, so a change to zeroclaw_runtime.agent.turn can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.agent.turn.
Position
Below the diagonal: zeroclaw_runtime.agent.agent uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_api.tool, so a change to zeroclaw_api.tool can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_api.tool.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_tools.mcp_deferred, so a change to zeroclaw_tools.mcp_deferred can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_tools.mcp_deferred.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.agent.loop_ uses zeroclaw_runtime.agent.turn, so a change to zeroclaw_runtime.agent.turn can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_runtime.agent.turn.
Position
Below the diagonal: zeroclaw_runtime.agent.loop_ uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses xtask.generate.spec, so a change to xtask.generate.spec can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break xtask.generate.spec.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zerocode.wire, so a change to zerocode.wire can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zerocode.wire.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zerocode.client, so a change to zerocode.client can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zerocode.client.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_api.memory_traits.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_runtime.rpc.types, so a change to zeroclaw_runtime.rpc.types can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_runtime.rpc.types.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_runtime.sop.types, so a change to zeroclaw_runtime.sop.types can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_runtime.sop.types.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_runtime.rpc.context, so a change to zeroclaw_runtime.rpc.context can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_runtime.rpc.context.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_runtime.agent.agent, so a change to zeroclaw_runtime.agent.agent can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_runtime.agent.agent.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.rpc.dispatch uses zeroclaw_runtime.agent.loop_, so a change to zeroclaw_runtime.agent.loop_ can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_runtime.agent.loop_.
Position
Below the diagonal: zeroclaw_runtime.rpc.dispatch uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 76% · Adequate · gated by D2 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A02:2025 — Security Misconfiguration
30
High / Critical
A05:2025 — Injection
25
High / Critical
A03:2025 — Software Supply Chain Failures
19
High / Critical
A07:2025 — Authentication Failures
1
High / Critical
Roadmap
First, ensure event recovery is deterministic by stamping clock and random values into commands, and immediately eliminate all instances of accepting invalid TLS certificates by properly configuring root certificate stores. Next, enforce accessibility standards by integrating a11y plugins into the toolchain and gating them in CI, while simultaneously making custom controls keyboard-operable and ensuring all form controls and buttons have proper programmatic labels.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Stamp clock/random values into the event in the command; the recovery fold must be a pure function of the event.
Stop accepting every TLS certificate: delete `danger_accept_invalid_certs(true)` / `SslVerifyMode::NONE` / the rustls verifier that returns `ServerCertVerified::assertion()` unconditionally, and trust a self-signed or private server by adding its CA as a root (`add_root_certificate`, a rustls `RootCertStore`) — never by switching verification off. This repository constructs a TLS client that accepts any certificate at 3 sites, not one: `apps/zerocode/src/enroll.rs:445` (a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`)), `apps/zerorelay/src/enroll_proxy.rs:350` (a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`)), `crates/zeroclaw-channels/src/irc.rs:306` (a rustls `ServerCertVerifier` that accepts every certificate (`NoVerify`)). Each is a separate decision — fixing only the line this row cites leaves the others in place.
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
Dependency Vulnerabilities: Medium advisory (unmaintained): REDACTED
crates/zeroclaw-runtime/src/agent/turn/mod.rs
6.0
Mixed
Explicit Debt: TodoComment
crates/zeroclaw-channels/src/wechat.rs
6.0
Mixed
Explicit Debt: TodoComment
apps/zerocode/src/config/mod.rs
6.0
Mixed
Explicit Debt: TodoComment
apps/zerocode/src/zerocode_pane.rs
6.0
Mixed
Explicit Debt: TodoComment
firmware/pico/src/main.rs
6.0
Mixed
Explicit Debt: TodoComment
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 — 86
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 — 3605
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 — 152
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 22
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 74 of 74 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 74 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 3786 of 3843 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: this repository's production source spans .rs, and our analyzer cannot run the .rs test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 96.4% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 147 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 152 test source file(s) (.rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .rs, and the rust executor ran against the .rs half and never executed — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in web/ (47 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The half was driven by a runner we ship, so this is not a missing-runner gap.
D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D15 Churn × Complexity Hotspots — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A hotspot's complexity is meant to be the worst body its churn actually touched. For crates/zeroclaw-plugins/src/component_logging.rs that could not be established — the complexity reader for the file reports no body extents, or the history carries no per-line attribution — so the row quotes the file's worst body, which the counted changes may never have touched. The churn count is unaffected.
D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming 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. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `crates/zeroclaw-channels/src/telegram.rs` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
AC2 Forms & labels — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 58 further occurrence(s) are not listed individually; the score already reflects all 98.
AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (docker-compose.alpine.yml). compose up failed (exit 17 — an image could not be built) — zeroclaw Pulling zeroclaw Warning Get "https://registry-1.docker.io/v2/": Forbidden failed to solve: failed to resolve source metadata for docker.io/docker/dockerfile:1.7-labs: failed to do request: Head "https://registry-1.docker.io/v2/docker/dockerfile/manifests/1.7-labs": Forbidden; runtime evidence skipped.
GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Rust is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Rust 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 — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). 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.
X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, 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.
X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, 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.
X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check 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.
X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, 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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, 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.
X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Python, 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.
X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and Java, TypeScript/JavaScript, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded, and this repository's Rust 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.
X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin 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.
X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Scala, Ruby and Python source only, and no C# was loaded and no JavaScript/TypeScript, Java, Scala, Ruby or Python was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart and Ruby source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart or Ruby 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 — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and PHP, Java, Kotlin, Python, Ruby, Scala, Dart, Swift, Erlang, Go and JavaScript/TypeScript source only, and no C# was loaded and no PHP, Java, Kotlin, Python, Ruby, Scala, Dart, Swift, Erlang, Go, JavaScript or TypeScript 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.
X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check 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 Rust 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.
X7 Silent fallback defaults — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 1 further occurrence(s) are not listed individually; the score already reflects all 41.
Repo exclusion declarations: 3 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
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
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.
D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
D42 Runtime Threat Enforcement: Runtime enforcement is read from committed policy files — a Tetragon/Falco/Kyverno stack installed cluster-wide (Helm release, platform add-on) with no in-repo trace can't be credited, and a committed policy is declared intent, not proof the engine is running and blocking in the live cluster.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
C3 Audit Trail: This control is scored from in-repo evidence only — a working control configured outside the repository leaves no signal a static scan can credit.
C4 Data Retention: This control is scored from in-repo evidence only — its real-world effectiveness, exercised only at runtime, is outside a static scan.
DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
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.
358 function(s) exceeded the cyclomatic complexity threshold of 15; the worst was zeroclaw::async_main_inner at 371. A further 29 function(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 FileUploadBundleTool::mime_for_filename at 81 — they are counted neither in the figure above nor in this dimension's score. 12 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: crates/zeroclaw-plugins/src/component_logging.rs (PluginState::log_record at 45), crates/zeroclaw-providers/src/lib.rs (zeroclaw_providers::canonicalize_v2_model_provider_name at 40), apps/zerocode/src/diff.rs (zerocode::diff::ext_to_language at 31), crates/zeroclaw-tools/src/calculator.rs (CalculatorTool::execute at 29), xtask/src/bin/mdbook.rs (xtask::bin::mdbook::main at 23), and 7 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 112 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 240 down to 240 or less in Cyclomatic Complexity — start with zeroclaw::async_main_inner (cyclomatic 371), Config::validate (cyclomatic 276), zerocode::app::run (cyclomatic 275). — 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 4.6 to about 5.1/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 165 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 10 bodies over 240 down to 240 or less in Cognitive Complexity — start with zeroclaw::async_main_inner (cognitive 888), DiscordChannel::listen (cognitive 713), Config::validate (cognitive 484). — 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 10 together lifts Cognitive Complexity from 2.0 to about 3.9/10, projected with the scoring formula itself and assuming each lands exactly at 240; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes9.1 / 10Stronggated by 544 serious findings✓ 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.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 163 FileTooLong finding(s) in God Classes — start with REDACTED (15), lib.rs (7), dispatch.rs (3). — One of this dimension's main actionable groups (163 warning-level).
Resolve the 154 MethodTooLong finding(s) in God Classes — start with dispatch.rs (16), config_manager.rs (10), engine.rs (6). — One of this dimension's main actionable groups (154 warning-level).
Resolve the 103 FunctionTooLong finding(s) in God Classes — start with REDACTED (15), main.rs (11), lib.rs (6). — One of this dimension's main actionable groups (103 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
1671 duplicated block group(s) detected. A further 93 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 1 of the 1764 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.
+ 292 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 128 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with REDACTED (12), lark.rs (6), telegram.rs (4). — One of this dimension's main actionable groups (128 warning-level).
Resolve the 116 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with REDACTED (8), engine.rs (6), v2.rs (4). — One of this dimension's main actionable groups (116 warning-level).
Resolve the 106 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with REDACTED (13), telegram.rs (4), config_manager.rs (3). — One of this dimension's main actionable groups (106 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling7.9 / 10Strong✓ 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.
33 production modules (Cargo), 0 dependency cycle(s), 2 unstable depended-on module(s). Read from the build's own module declarations; 6 module(s) off the main sequence, with abstractness counted on 25 of the 33 (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: zeroclaw-commands · ×6
Unstable project zeroclaw-channels
Unstable project zeroclaw-gateway
What to do
Resolve the 6 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 1 Unstable project zeroclaw-channels finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 Unstable project zeroclaw-gateway finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 5 Low cohesion finding(s) in Cohesion (LCOM4) — start with wasm_memory.rs, pairing.rs, event.rs. — One of this dimension's main actionable groups (5 warning-level).
Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
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).
Classify ADR enforcement: Rust is the implementation language for ZeroClaw · ×18docs/book/src/architecture/decisions/ADR-001-rust-first.md
What to do
Resolve the 18 Classify ADR enforcement finding(s) in Architectural Integrity — start with ADR-001-rust-first.md, ADR-002-trait-driven-extensibility.md, ADR-003-wasm-plugin-model.md. — One of this dimension's main actionable groups (18 recommendation-level).
Enforce Architectural Integrity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d7_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
22536 test methods: 21551 unit, 897 integration, 0 BDD, 88 e2e. The JavaScript/TypeScript suite contributes 147 `it`/`test` case(s) across 28 test file(s) declaring at least one; its tier split is read from package names and paths only. The Rust suite contributes 22133 `#[test]` function(s) across 928 file(s) declaring at least one; its unit/integration split is Cargo's own — 101 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test. The Python suite contributes 256 test function(s) across 14 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 147 tests. Measured on the JavaScript/TypeScript suite only — at least 152 test source file(s) (.rs) went unread, so its test quality is unmeasured and is not in these counts.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
33 outdated, 0 yanked direct Cargo dependencies. 160 of 176 direct crates were graded against crates.io (0 not published there, 16 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Outdated: clap · ×33
What to do
Improve Dependency Hygiene — currently 8.4/10. — 33 outdated, 0 yanked direct Cargo dependencies. 160 of 176 direct crates were graded against crates.io (0 not published there, 16 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
1 of 1234 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under MIT OR Apache-2.0, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
Banned license: unescaper
What to do
Resolve the 1 Banned license finding(s) in License Compliance. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d14_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: crates/zeroclaw-config/src/schema.rs (149×276=41124); src/main.rs (68×371=25228); crates/zeroclaw-channels/src/orchestrator/mod.rs (111×179=19869) Repeated repair below the complexity floor: crates/zeroclaw-runtime/src/i18n.rs (21 of 31 changes were fixes); crates/zeroclaw-api/src/channel.rs (10 of 19 changes were fixes); src/lib.rs (9 of 15 changes were fixes)
Resolve the 102 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (13), lib.rs (3), main.rs (2). — One of this dimension's main actionable groups (102 warning-level).
Resolve the 62 Repeated repair finding(s) in Churn × Complexity Hotspots — start with REDACTED (5), i18n.rs (3), lib.rs (2). — One of this dimension's main actionable groups (62 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.2 / 10Exemplary✓ 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.
71 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is apps/zerorelay/src/lib.rs. Counted over 844 of the 1054 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×5
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
21 deducted task-comment markers across 1232333 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 · ×21firmware/pico/src/main.rs:77
What to do
Resolve the 21 TodoComment finding(s) in Explicit Debt — start with REDACTED (4), browser_open.rs (3), zerocode_pane.rs (3). — One of this dimension's main actionable groups (21 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.
0 of 18 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question). How well each record argues its case is not measured.
✓ On the Gold path — maintain.
Detailed fixes: d20_recommendation.md.
Do you agree with this assessment?
D26 · Project Cohesion4.7 / 10Weak✓ Tool-verified
What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.
9 of 34 build units (Cargo, Python) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
25 finding(s): 0 critical, 24 high, 1 medium, 0 low. semgrep hit a parse error in 9 file(s) — `REDACTED` (line 93, line 99, line 106), `apps/tauri/src/daemon.rs` (line 28, line 30), `apps/zerocode/src/logs.rs` (line 106, line 107, line 108, …), `apps/zerocode/src/oidc_enroll.rs` (line 510, line 989, line 1007, …), `crates/zeroclaw-log/src/layer.rs` (line 473), … (+4 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 12 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 10 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (10). — One of this dimension's main actionable groups (10 issue-level).
Resolve the 5 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (5 issue-level).
Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3). — One of this dimension's main actionable groups (3 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.
Resolve the 8 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (8). — One of this dimension's main actionable groups (8 warning-level).
Resolve the 3 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (3). — One of this dimension's main actionable groups (3 issue-level).
Resolve the 1 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 20 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (10), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (20 warning-level).
Resolve the 7 High IaC finding(s) in IaC & Container Security — start with REDACTED (3), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (7 issue-level).
Resolve the 3 Low IaC finding(s) in IaC & Container Security — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
8 of 844 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/zeroclaw-runtime/src/security/playbook.rs. Counted over 844 of the 1054 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 1 Boundary-crossing change coupling finding(s) in Change Coupling — start with registry.rs. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 6 Change coupling finding(s) in Change Coupling — start with loop_.rs (2), safety_net.rs, attribution.rs. — One of this dimension's main actionable groups (6 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
Build pipeline generates provenance, signs artifacts and produces an SBOM.
REDACTED
REDACTED
REDACTED
REDACTED
What to do
Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn — language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction — baseline misconfigs stay with D31). Deterministic.
What it measures: Whether Kubernetes workloads confine the kernel boundary — a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer — shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.
1/1 workload(s) run every container under a seccomp profile; 0/1 declare an AppArmor/SELinux profile.
What to do
Improve Kernel & Syscall Confinement — currently 8.0/10. — 1/1 workload(s) run every container under a seccomp profile; 0/1 declare an AppArmor/SELinux profile.
What it measures: Whether the Kubernetes deployment wires runtime threat enforcement — a detection engine (Tetragon/Falco) and/or an admission-control policy gate (Kyverno / OPA Gatekeeper / PodSecurity). Presence of committed policy, not a runtime guarantee.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a runtime threat-detection engine (Tetragon TracingPolicy / Falco) and an admission-control policy (Kyverno / OPA Gatekeeper / PodSecurity). Reward-leaning; NotApplicable without workloads. Deterministic.
Resolve the 1 No runtime threat detection finding(s) in Runtime Threat Enforcement. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d42_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Do you agree with this assessment?
AC2 · Forms & labels5.0 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. — .claude/skills/skill-creator/eval-viewer/viewer.html:604
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. (×20) — web/src/App.tsx:333, web/src/components/AliasPromptDialog.tsx:77, web/src/components/ToolPicker.tsx:283, …
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). (×2) — web/src/components/ToolPermissionGrid.tsx:306, web/src/components/sections/ReloadDaemonButton.tsx:152
This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. — web/src/components/sections/FieldForm.tsx:2597
This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×11) — web/src/components/sections/FieldForm.tsx:2823, web/src/components/sections/SkillsBundleEditor.tsx:296, web/src/components/sections/SkillsBundleEditor.tsx:309, …
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×5) — web/src/components/sections/FieldForm.tsx:2853, web/src/components/sections/FieldForm.tsx:2866, web/src/components/sections/FieldForm.tsx:2923, …
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×5) — .claude/skills/skill-creator/assets/eval_review.html:2, .claude/skills/skill-creator/eval-viewer/viewer.html:2, apps/tauri/splash/index.html:2, …
An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label. — docs/book/theme/index.hbs:211
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
This <span> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control. (×2) — web/src/components/AgentCard.tsx:139, web/src/components/ChatTabBar.tsx:158
This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×2) — web/src/components/UpgradeDialog.tsx:298, web/src/components/sections/DirectoryPicker.tsx:172
This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. — web/src/pages/Dashboard.tsx:1576
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. — web/src/pages/SopCanvas.tsx:941
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.grades-toggle .arrow` moves (`transition: transform 0.15s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — .claude/skills/skill-creator/eval-viewer/viewer.html:275
`.spinner` moves (`animation: spin 0.8s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — apps/tauri/splash/index.html:63
<button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). — web/src/components/ChatTabBar.tsx:220
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×2) — web/src/components/CommandPalette.tsx:340, web/src/pages/Logs.tsx:540
`.chapter-fold-toggle` moves (`transition: transform 0.2s ease, color 0.18s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/book/theme/custom.css:282
`#pc-progress` moves (`transition: width 0.08s linear`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/book/theme/custom.css:688
`.pc-diagram-stage > svg` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/book/theme/custom.css:1021
`.pc-hero-glow` moves (`animation: pc-float 8s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/book/theme/custom.css:1117
`.cfg-fields .cfg-field > summary::before` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/book/theme/custom.css:1498
`.provider-entry > summary::before` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — docs/book/theme/custom.css:1577
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 81 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility in the toolchain: add eslint-plugin-jsx-a11y, then assert with your test runner's axe binding (jest-axe, vitest-axe, cypress-axe or @axe-core/playwright) in tests, then gate axe/pa11y/Lighthouse in CI.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
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.
Do you agree with this assessment?
C1 · Data Protection6.5 / 10Adequate✓ Tool-verified
Other · Security — Whether sensitive data is encrypted at rest and in transit and keys are vaulted.
Method: Roslyn plus filesystem scan: encryption presence (EF ColumnEncryption, key-vault references, HTTPS enforcement) and key-derivation KDF detection. Deterministic.
What to do
Strengthen data-at-rest protection: vault your keys (AWS KMS / Secrets Manager, GCP KMS / Secret Manager, Azure Key Vault, HashiCorp Vault — not a key read from an environment variable beside the data) and encrypt the most sensitive columns (an AEAD over the field before Diesel/sqlx write it, SQLCipher, pgcrypto) — partial coverage still leaves gaps.
Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Do you agree with this assessment?
C3 · Audit Trail7.5 / 10Strong✓ Tool-verified
Other · Security — Whether changes to sensitive data are recorded (who, what, when) for compliance + incident response.
An audit mechanism is present, but the trail is not yet complete — missing: a write-side hook every change flows through (a SeaORM ActiveModelBehavior hook or a database trigger recording each change, or an event-sourced store), per-entity coverage (an event-sourced aggregate, or a hook on each entity that needs a who-changed-what trail).
What to do
Back the audit convention with a structural mechanism: a SeaORM ActiveModelBehavior before_save/after_save hook or a database trigger writing each sensitive change to an audit-log table, with the acting user and time on every entry.
Do you agree with this assessment?
C4 · Data Retention10.0 / 10Exemplary✓ Tool-verified
Other · Security — Whether data has a defined lifetime — retention periods, TTLs, cleanup jobs (storage limitation).
Method: Roslyn scan: retention/TTL configuration presence in schema; CascadeDelete detected but not scored as retention control. Deterministic, gated by PII presence.
Do you agree with this assessment?
DM4 · Rich vs anemic domain model10.0 / 10Exemplary✓ Tool-verified
Other · Domain Modelling — Whether domain entities own their behaviour (invariant-enforcing commands) rather than being data-only structs driven by a foreign service.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
Other · Domain Modelling — Whether a domain type's identity-bearing field stays immutable — a `pub` mutable field under a hand-rolled Hash/PartialEq breaks the value-identity invariant.
Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.
Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.
`DelegateProgressSink.apply` folds a domain event but reads a clock/random source (`Instant::now`/`Utc::now`/`rand`/`Uuid::new_v4`) on the replay path — a replay must derive state PURELY from the event's own fields, or two replays of the same log diverge. Stamp the timestamp/id into the event in the COMMAND, then read it from the event in the fold. (×2) — crates/zeroclaw-runtime/src/tools/delegate_progress.rs:128, crates/zeroclaw-runtime/src/tools/delegate_progress.rs:158
What to do
Stamp clock/random values into the event in the command; the recovery fold must be a pure function of the event.
Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.
Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add a README to the 33 of 36 project(s) that lack one — worth up to 1.8 pts.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Only 10/18 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `apps/tauri`, `apps/zerocode`, `crates/zeroclaw-gateway`, `crates/zeroclaw-memory` and 3 more.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Dependabot is configured but does not watch `pip`, `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.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Do you agree with this assessment?
P5 · DR & Backup7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`reqwest::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — crates/zeroclaw-runtime/src/rpc/locales.rs:117, src/bin/zeroclaw-acp-bridge.rs:349
`reqwest::get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — src/bin/zeroclaw-acp-bridge.rs:327
What to do
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Other · Security — Read from this repository's Rust source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. Markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. This repository serves HTTP itself (`axum::serve(` (xtask/src/cmd/mdbook/serve.rs:158)), so its Rust source was also read for the server controls: TLS served or HSTS set, security response headers, cookie flags and inbound validation — each credited where its Rust spelling appears in production source, not proven on every route. A Rocket 0.5 application is credited the headers Rocket's default `Shield` sends unless it attaches its own, and its cookie jar's SameSite=Strict default; a session middleware its default cookie flags.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`) is set on a TLS client, so every peer certificate is accepted — including one an attacker presents. Chain, expiry, revocation and hostname are all skipped, so an attacker on the network path can present any certificate and read or rewrite the traffic — the connection is encrypted to the attacker, not to the intended host. Remove the override so the TLS stack verifies the peer — reqwest, native-tls, rustls and openssl's `SslConnector` all check the chain and hostname when nothing is set. If the server presents a self-signed or privately-issued certificate, trust THAT issuer rather than every certificate: `reqwest::ClientBuilder::add_root_certificate(Certificate::from_pem(…))`, a rustls `RootCertStore` holding its CA, or `SslConnectorBuilder::set_ca_file`, which keeps the chain and hostname checks on. (×3) — apps/zerocode/src/enroll.rs:445, apps/zerorelay/src/enroll_proxy.rs:350, crates/zeroclaw-channels/src/irc.rs:306
MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call. — crates/zeroclaw-channels/src/wechat.rs:1709
`https://cdn.jsdelivr.net/npm/@scalar/api-reference` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 2 such include(s) across the repository's markup. — crates/zeroclaw-gateway/src/openapi_docs.html:53
What to do
Stop accepting every TLS certificate: delete `danger_accept_invalid_certs(true)` / `SslVerifyMode::NONE` / the rustls verifier that returns `ServerCertVerified::assertion()` unconditionally, and trust a self-signed or private server by adding its CA as a root (`add_root_certificate`, a rustls `RootCertStore`) — never by switching verification off. This repository constructs a TLS client that accepts any certificate at 3 sites, not one: `apps/zerocode/src/enroll.rs:445` (a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`)), `apps/zerorelay/src/enroll_proxy.rs:350` (a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`)), `crates/zeroclaw-channels/src/irc.rs:306` (a rustls `ServerCertVerifier` that accepts every certificate (`NoVerify`)). Each is a separate decision — fixing only the line this row cites leaves the others in place.
Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key.
Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
`warn!` at line 266 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/zeroclaw-log/src/writer.rs:266
`warn!` at line 292 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — crates/zeroclaw-log/src/writer.rs:292
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 10 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 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.
C5 Data-Subject Rights — Repo shows no corroborated data-subject-rights mechanism (erasure / export-portability / consent) tied to a subject id or GDPR vocabulary — absence of evidence is not evidence of a working control. Implement erasure, data export/portability and consent tracking over the subject's records.
Not included — 49 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AX1 Captive dependencies — Not applicable: Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one.
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. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — compose up failed (exit 17 — an image could not be built) — zeroclaw Pulling zeroclaw Warning Get "https://registry-1.docker.io/v2/": Forbidden failed to solve: failed to resolve source metadata for docker.io/docker/dockerfile:1.7-labs: failed to do request: Head "https://registry-1.docker.io/v2/docker/dockerfile/manifests/1.7-labs": Forbidden; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
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 — No runnable or published unit to look for an example in, and no multi-project root README to look for a map in; the other documentation kinds are withheld (see the gaps), so documentation quality is not applicable here.
D21 Naming Consistency — Naming consistency is measured on C# only; JavaScript, Python, Rust, TypeScript, html not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust 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+ projects each declaring an entity of their own. 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# and Visual Basic comments only — this repository's production source is .rs, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — None of 7 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.
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D32 Data Compliance (PII/GDPR) — 1 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
DM1 Aggregate boundaries — this Rust crate declares no domain aggregate (a struct with private state and its own command methods), so DM1's aggregate-boundary read has no population to be taken over
DM2 Strongly-typed ids — the crate defines newtype typed-ids but declares no domain aggregate that could carry an id — so DM2's adoption ratio has no population to be taken over
DM3 Integration-event coupling — no integration events detected — coupling check not applicable
DM6 Domain ↔ infrastructure boundary — this Rust crate maps no type to a persistence framework (diesel/sea-orm/sqlx), so DM6's domain↔infrastructure fusion read has no population to be taken over
DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
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'.
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 12 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.
PF2 Allocation hygiene — Not applicable: Rust spells out every heap allocation and makes borrowed slices (&[T], &str) its ordinary parameter types, so the allocation-aware style this card rewards elsewhere is the language's baseline rather than a rung to climb.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X12 Unreachable branch — 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
X13 Undrained process stream — 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
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 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
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 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
X2 Cancellation propagation — no C# was loaded; this repository's Rust was read, and no request in it can be cancelled by a caller — a Rust request takes no token: a future is cancelled by dropping it, from outside the call (select!, a timeout, an aborted task), and reqwest, hyper and tonic take none
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.
X22 Contradicted release guard — 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
X23 Unguarded diagnostic materialisation — 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
X24 Document value interpolated into markup unescaped — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X25 Inert configuration knob — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. Rust's compiler refuses the unsynchronised version: a collection shared between a callback's thread and the waiting body must be `Sync`, which a `Vec`, `VecDeque` or `HashMap` is only behind a `Mutex`/`RwLock`, so the race this check looks for cannot be written in safe Rust. Not a gap in the analyzer and not a finding about your code.
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
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.
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 — 86 finding(s)
AC2 · Forms & labels· <input> without a programmatic label · ×18
<input> without a programmatic label web/src/App.tsx:333— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/AliasPromptDialog.tsx:77— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/ToolPicker.tsx:283— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/AddEntityDialog.tsx:190— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/CostRatesEditor.tsx:338— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/DirectoryPicker.tsx:206— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/FieldForm.tsx:906— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/FieldForm.tsx:2437— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/FieldForm.tsx:2607— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/FieldForm.tsx:2866— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label web/src/components/sections/FieldForm.tsx:2923— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label web/src/components/sections/FieldForm.tsx:3068— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/FieldForm.tsx:3076— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/SectionNavigator.tsx:388— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/SectionPicker.tsx:127— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/SkillsBundleEditor.tsx:299— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/SkillsBundleEditor.tsx:614— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<input> without a programmatic label web/src/components/sections/SkillsBundleEditor.tsx:1009— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels· <label> that labels no control · ×11
<label> that labels no control web/src/components/sections/FieldForm.tsx:2823— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:296— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:309— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:468— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:549— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:611— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:783— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:797— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:863— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:944— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control web/src/components/sections/SkillsBundleEditor.tsx:1006— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC2 · Forms & labels· <textarea> without a programmatic label · ×7
<textarea> without a programmatic label .claude/skills/skill-creator/eval-viewer/viewer.html:604— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label web/src/components/sections/FieldForm.tsx:894— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label web/src/components/sections/FieldForm.tsx:2636— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label web/src/components/sections/FieldForm.tsx:2720— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label web/src/components/sections/FieldForm.tsx:3023— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label web/src/components/sections/SkillsBundleEditor.tsx:312— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
<textarea> without a programmatic label web/src/components/sections/SkillsBundleEditor.tsx:471— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
TLS certificate validation disabled apps/zerocode/src/enroll.rs:445— a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`) is set on a TLS client, so every peer certificate is accepted — including one an attacker presents. Chain, expiry, revocation and hostname are all skipped, so an attacker on the network path can present any certificate and read or rewrite the traffic — the connection is encrypted to the attacker, not to the intended host. Remove the override so the TLS stack verifies the peer — reqwest, native-tls, rustls and openssl's `SslConnector` all check the chain and hostname when nothing is set. If the server presents a self-signed or privately-issued certificate, trust THAT issuer rather than every certificate: `reqwest::ClientBuilder::add_root_certificate(Certificate::from_pem(…))`, a rustls `RootCertStore` holding its CA, or `SslConnectorBuilder::set_ca_file`, which keeps the chain and hostname checks on.
TLS certificate validation disabled apps/zerorelay/src/enroll_proxy.rs:350— a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`) is set on a TLS client, so every peer certificate is accepted — including one an attacker presents. Chain, expiry, revocation and hostname are all skipped, so an attacker on the network path can present any certificate and read or rewrite the traffic — the connection is encrypted to the attacker, not to the intended host. Remove the override so the TLS stack verifies the peer — reqwest, native-tls, rustls and openssl's `SslConnector` all check the chain and hostname when nothing is set. If the server presents a self-signed or privately-issued certificate, trust THAT issuer rather than every certificate: `reqwest::ClientBuilder::add_root_certificate(Certificate::from_pem(…))`, a rustls `RootCertStore` holding its CA, or `SslConnectorBuilder::set_ca_file`, which keeps the chain and hostname checks on.
TLS certificate validation disabled crates/zeroclaw-channels/src/irc.rs:306— a rustls `ServerCertVerifier` that accepts every certificate (`AcceptProvisional`) is set on a TLS client, so every peer certificate is accepted — including one an attacker presents. Chain, expiry, revocation and hostname are all skipped, so an attacker on the network path can present any certificate and read or rewrite the traffic — the connection is encrypted to the attacker, not to the intended host. Remove the override so the TLS stack verifies the peer — reqwest, native-tls, rustls and openssl's `SslConnector` all check the chain and hostname when nothing is set. If the server presents a self-signed or privately-issued certificate, trust THAT issuer rather than every certificate: `reqwest::ClientBuilder::add_root_certificate(Certificate::from_pem(…))`, a rustls `RootCertStore` holding its CA, or `SslConnectorBuilder::set_ca_file`, which keeps the chain and hostname checks on.
AC2 · Forms & labels· <button> with no accessible text · ×2
<button> with no accessible text web/src/components/ToolPermissionGrid.tsx:306— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
<button> with no accessible text web/src/components/sections/ReloadDaemonButton.tsx:152— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC4 · Keyboard semantics· Click handler on a <span> nested inside <button> · ×2
Click handler on a <span> nested inside <button> web/src/components/AgentCard.tsx:139— This <span> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control.
Click handler on a <span> nested inside <button> web/src/components/ChatTabBar.tsx:158— This <span> carries its own click handler, but it sits inside a <button> that performs a different action. A keyboard user reaches the <button> and activating it runs the <button>'s handler, never this one, so this action has no keyboard path at all. Role and tabindex cannot supply one: HTML forbids a <button> from containing interactive content or any descendant with a tabindex, so the browser will not put this element in the tab order however it is marked up. Move it out of the <button> and make it a sibling <button>, so each action has its own control.
Non-deterministic recovery fold: DelegateProgressSink.apply crates/zeroclaw-runtime/src/tools/delegate_progress.rs:128— `DelegateProgressSink.apply` folds a domain event but reads a clock/random source (`Instant::now`/`Utc::now`/`rand`/`Uuid::new_v4`) on the replay path — a replay must derive state PURELY from the event's own fields, or two replays of the same log diverge. Stamp the timestamp/id into the event in the COMMAND, then read it from the event in the fold.
Non-deterministic recovery fold: DelegateProgressSink.apply crates/zeroclaw-runtime/src/tools/delegate_progress.rs:158— `DelegateProgressSink.apply` folds a domain event but reads a clock/random source (`Instant::now`/`Utc::now`/`rand`/`Uuid::new_v4`) on the replay path — a replay must derive state PURELY from the event's own fields, or two replays of the same log diverge. Stamp the timestamp/id into the event in the COMMAND, then read it from the event in the fold.
AC2 · Forms & labels· <select> without a programmatic label · ×1
<select> without a programmatic label web/src/components/sections/FieldForm.tsx:2853— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC3 · Page structure· <iframe> without a title · ×1
<iframe> without a title docs/book/theme/index.hbs:211— An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label.
AC4 · Keyboard semantics· Hover-only interaction on <div> · ×1
Hover-only interaction on <div> web/src/pages/Dashboard.tsx:1576— This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
AC4 · Keyboard semantics· Click handler on a non-interactive <g> · ×1
Click handler on a non-interactive <g> web/src/pages/SopCanvas.tsx:941— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Banned license: unescaper — `unescaper` 0.1.8 is published on crates.io under `GPL-3.0/MIT`, which this policy bans, and it is in the SHIPPED closure of this repository's REDACTED — so it is compiled by everything that builds this repository, not just by its test harness. The expression was read as SPDX, not as text: an `OR` is a choice and is only charged when every branch is banned, while an `AND` binds you to both operands and is charged when either is. Replace the crate, or record an accepted exception.
Boundary-crossing change coupling: registry.rs ↔ REDACTED crates/zeroclaw-runtime/src/integrations/registry.rs:1— `crates/zeroclaw-runtime/src/integrations/registry.rs` (context crates) and `src/config/mod.rs` (context config) sit in DIFFERENT parts of the tree yet change together 50% of the time (9 of the 18 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 9 shared commits counted here, the most recent 3 are `441df131` feat(channels/telegram): add multi_message streaming mode (#8561); `b954de22` feat(channels): add passive Telegram group context (#10640); `cc39235d` feat(telegram): add per_user_session toggle for shared group-chat ses… — run `git show` on any of them.
FileTooLong: src/schema.rs crates/zeroclaw-config/src/schema.rs— FileTooLong — 15486 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 465 free functions. The bar is 500 significant lines; this is 14986 over it, 30.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: orchestrator/mod.rs crates/zeroclaw-channels/src/orchestrator/mod.rs— FileTooLong — 11649 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 303 free functions. The bar is 500 significant lines; this is 11149 over it, 23.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/main.rs src/main.rs— FileTooLong — 10567 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 176 free functions. The bar is 500 significant lines; this is 10067 over it, 21.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: rpc/dispatch.rs crates/zeroclaw-runtime/src/rpc/dispatch.rs— FileTooLong — 8893 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 84% of them inside a single declaration: RpcDispatcher (4 blocks, 1129-13032), declaring 55 free functions. The bar is 500 significant lines; this is 8393 over it, 17.79× 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: src/chat.rs apps/zerocode/src/chat.rs— FileTooLong — 8040 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 100 free functions. The bar is 500 significant lines; this is 7540 over it, 16.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/telegram.rs crates/zeroclaw-channels/src/telegram.rs— FileTooLong — 5601 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 32 free functions. The bar is 500 significant lines; this is 5101 over it, 11.20× 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: sop/engine.rs crates/zeroclaw-runtime/src/sop/engine.rs— FileTooLong — 4665 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 89% of them inside a single declaration: SopEngine (2 blocks, 31-6900), declaring 37 free functions. The bar is 500 significant lines; this is 4165 over it, 9.33× 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: src/config_manager.rs apps/zerocode/src/config_manager.rs— FileTooLong — 4298 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 90% of them inside a single declaration: App (5 blocks, 444-6051), declaring 36 free functions. The bar is 500 significant lines; this is 3798 over it, 8.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: src/slack.rs crates/zeroclaw-channels/src/slack.rs— FileTooLong — 4258 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 3758 over it, 8.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/matrix.rs crates/zeroclaw-channels/src/matrix.rs— FileTooLong — 3611 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 3111 over it, 7.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lib.rs crates/zeroclaw-gateway/src/lib.rs— FileTooLong — 3571 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 98 free functions. The bar is 500 significant lines; this is 3071 over it, 7.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: tools/delegate.rs crates/zeroclaw-runtime/src/tools/delegate.rs— FileTooLong — 3497 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 93% of them inside a single declaration: DelegateTool (5 blocks, 268-5331). The bar is 500 significant lines; this is 2997 over it, 6.99× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: agent/agent.rs crates/zeroclaw-runtime/src/agent/agent.rs— FileTooLong — 3351 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 2851 over it, 6.70× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/compatible.rs crates/zeroclaw-providers/src/compatible.rs— FileTooLong — 3232 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 63% of them inside a single declaration: OpenAiCompatibleModelProvider (5 blocks, 48-5215), declaring 33 free functions. The bar is 500 significant lines; this is 2732 over it, 6.46× 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: agent/loop_.rs crates/zeroclaw-runtime/src/agent/loop_.rs— FileTooLong — 3060 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 66 free functions. The bar is 500 significant lines; this is 2560 over it, 6.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: turn/mod.rs crates/zeroclaw-runtime/src/agent/turn/mod.rs— FileTooLong — 2996 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 34 free functions. The bar is 500 significant lines; this is 2496 over it, 5.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/lark.rs crates/zeroclaw-channels/src/lark.rs— FileTooLong — 2963 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 40 free functions. The bar is 500 significant lines; this is 2463 over it, 5.93× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/whatsapp_web.rs crates/zeroclaw-channels/src/whatsapp_web.rs— FileTooLong — 2918 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 37 free functions. The bar is 500 significant lines; this is 2418 over it, 5.84× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/client.rs apps/zerocode/src/client.rs— FileTooLong — 2893 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 31 free functions. The bar is 500 significant lines; this is 2393 over it, 5.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/policy.rs crates/zeroclaw-config/src/policy.rs— FileTooLong — 2873 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 86 free functions. The bar is 500 significant lines; this is 2373 over it, 5.75× 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: discord/mod.rs crates/zeroclaw-channels/src/discord/mod.rs— FileTooLong — 2761 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 78% of them inside a single declaration: DiscordChannel (4 blocks, 69-4222). The bar is 500 significant lines; this is 2261 over it, 5.52× 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: src/app.rs apps/zerocode/src/app.rs— FileTooLong — 2610 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 52 free functions. The bar is 500 significant lines; this is 2110 over it, 5.22× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/dashboard.rs apps/zerocode/src/dashboard.rs— FileTooLong — 2586 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 72% of them inside a single declaration: Dashboard (3 blocks, 95-2743), declaring 38 free functions. The bar is 500 significant lines; this is 2086 over it, 5.17× 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: schema/v2.rs crates/zeroclaw-config/src/schema/v2.rs— FileTooLong — 2505 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 68 free functions. The bar is 500 significant lines; this is 2005 over it, 5.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.
FileTooLong: service/mod.rs crates/zeroclaw-runtime/src/service/mod.rs— FileTooLong — 2430 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 96 free functions. The bar is 500 significant lines; this is 1930 over it, 4.86× 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.
MethodTooLong: Config.validate crates/zeroclaw-config/src/schema.rs:24274— MethodTooLong — validate runs 1211 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1111 over it, 12.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DiscordChannel.listen crates/zeroclaw-channels/src/discord/mod.rs:1993— MethodTooLong — listen runs 975 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 875 over it, 9.75× 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: RpcDispatcher.run_session_prompt crates/zeroclaw-runtime/src/rpc/dispatch.rs:6339— MethodTooLong — run_session_prompt runs 666 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 566 over it, 6.66× 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: RpcDispatcher.session_new_with_mode crates/zeroclaw-runtime/src/rpc/dispatch.rs:4386— MethodTooLong — session_new_with_mode runs 631 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 531 over it, 6.31× 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: OtelObserver.record_event crates/zeroclaw-runtime/src/observability/otel.rs:268— MethodTooLong — record_event runs 461 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 361 over it, 4.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DelegateTool.execute_agentic_with_approval_registry crates/zeroclaw-runtime/src/tools/delegate.rs:4727— MethodTooLong — execute_agentic_with_approval_registry runs 376 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 276 over it, 3.76× 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: DelegateTool.execute_background crates/zeroclaw-runtime/src/tools/delegate.rs:3047— MethodTooLong — execute_background runs 355 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 255 over it, 3.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: QuickstartPane.handle_modal_key apps/zerocode/src/quickstart_pane.rs:1610— MethodTooLong — handle_modal_key runs 339 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 239 over it, 3.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: QQChannel.listen crates/zeroclaw-channels/src/qq.rs:1401— MethodTooLong — listen runs 324 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 224 over it, 3.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WeChatChannel.listen crates/zeroclaw-channels/src/wechat.rs:2808— MethodTooLong — listen runs 319 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 219 over it, 3.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: SqliteMemory.recall_scoped crates/zeroclaw-memory/src/sqlite.rs:1050— MethodTooLong — recall_scoped runs 311 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 211 over it, 3.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AcpServer.handle_session_prompt crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1878— MethodTooLong — handle_session_prompt runs 308 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 208 over it, 3.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RpcDispatcher.rehydrate_reaped_session_under_guard crates/zeroclaw-runtime/src/rpc/dispatch.rs:5764— MethodTooLong — rehydrate_reaped_session_under_guard runs 296 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 196 over it, 2.96× 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: ModelRoutingConfigTool.handle_upsert_agent crates/zeroclaw-tools/src/model_routing_config.rs:1132— MethodTooLong — handle_upsert_agent runs 286 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 186 over it, 2.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AnthropicModelProvider.parse_anthropic_sse_from_reader crates/zeroclaw-providers/src/anthropic.rs:2449— MethodTooLong — parse_anthropic_sse_from_reader runs 281 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 181 over it, 2.81× 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: SqliteSessionBackend.migrate_from_jsonl_with_handlers crates/zeroclaw-infra/src/session_sqlite.rs:510— MethodTooLong — migrate_from_jsonl_with_handlers runs 277 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 177 over it, 2.77× 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: AnthropicModelProvider.stream_chat_with_tool_round_policy crates/zeroclaw-providers/src/anthropic.rs:3219— MethodTooLong — stream_chat_with_tool_round_policy runs 242 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 142 over it, 2.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DelegateTool.execute_parallel crates/zeroclaw-runtime/src/tools/delegate.rs:3590— MethodTooLong — execute_parallel runs 233 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 133 over it, 2.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RusqliteStore.init_schema crates/zeroclaw-channels/src/whatsapp_storage.rs:146— MethodTooLong — init_schema runs 231 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 131 over it, 2.31× 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: FileUploadBundleTool.execute crates/zeroclaw-tools/src/file_upload_bundle.rs:216— MethodTooLong — execute runs 223 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 123 over it, 2.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ChannelsConfig.channels crates/zeroclaw-config/src/schema.rs:16141— MethodTooLong — channels runs 219 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 119 over it, 2.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: Config.load_or_init crates/zeroclaw-config/src/schema.rs:22920— MethodTooLong — load_or_init runs 217 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: App.zeroclaw_help_context apps/zerocode/src/config_manager.rs:5715— MethodTooLong — zeroclaw_help_context runs 214 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 114 over it, 2.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AcpServer.handle_session_load crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1153— MethodTooLong — handle_session_load runs 213 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 113 over it, 2.13× 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: GeminiModelProvider.send_generate_content crates/zeroclaw-providers/src/gemini.rs:1173— MethodTooLong — send_generate_content runs 211 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (7 lines × 2) apps/zerocode/src/chat.rs:5278— apps/zerocode/src/chat.rs:5278-5284 | apps/zerocode/src/chat.rs:5315-5321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) apps/zerocode/src/chat.rs:6208— apps/zerocode/src/chat.rs:6208-6214 | apps/zerocode/src/chat.rs:6292-6298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) apps/zerocode/src/client.rs:1721— apps/zerocode/src/client.rs:1721-1727 | apps/zerocode/src/client.rs:2005-2011 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) apps/zerocode/src/config_manager.rs:1341— apps/zerocode/src/config_manager.rs:1341-1347 | apps/zerocode/src/config_manager.rs:1353-1359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) apps/zerocode/src/config_manager.rs:5875— apps/zerocode/src/config_manager.rs:5875-5881 | apps/zerocode/src/config_manager.rs:5904-5910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) apps/zerocode/src/dashboard.rs:1574— apps/zerocode/src/dashboard.rs:1574-1580 | apps/zerocode/src/dashboard.rs:1602-1608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-api/src/channel.rs:1107— crates/zeroclaw-api/src/channel.rs:1107-1113 | crates/zeroclaw-plugins/src/wasm_channel.rs:1270-1276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/dingtalk.rs:265— crates/zeroclaw-channels/src/dingtalk.rs:265-271 | crates/zeroclaw-channels/src/slack.rs:4366-4372 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/discord/markers.rs:837— crates/zeroclaw-channels/src/discord/markers.rs:837-843 | crates/zeroclaw-channels/src/matrix.rs:3336-3342 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/discord/mod.rs:401— crates/zeroclaw-channels/src/discord/mod.rs:401-407 | crates/zeroclaw-channels/src/discord/mod.rs:736-742 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:577— crates/zeroclaw-channels/src/discord/mod.rs:577-584 | crates/zeroclaw-channels/src/discord/mod.rs:705-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2061— crates/zeroclaw-channels/src/discord/mod.rs:2061-2067 | crates/zeroclaw-channels/src/qq.rs:1439-1445 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/qq.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/git/events.rs:270— crates/zeroclaw-channels/src/git/events.rs:270-276 | crates/zeroclaw-channels/src/git/events.rs:280-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/lark.rs:1860— crates/zeroclaw-channels/src/lark.rs:1860-1866 | crates/zeroclaw-channels/src/lark.rs:1996-2002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/lark.rs:1883— crates/zeroclaw-channels/src/lark.rs:1883-1889 | crates/zeroclaw-channels/src/lark.rs:1945-1951 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/lark.rs:2020— crates/zeroclaw-channels/src/lark.rs:2020-2026 | crates/zeroclaw-channels/src/lark.rs:2071-2077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/lark.rs:2295— crates/zeroclaw-channels/src/lark.rs:2295-2301 | crates/zeroclaw-channels/src/lark.rs:2319-2325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/lark.rs:2423— crates/zeroclaw-channels/src/lark.rs:2423-2429 | crates/zeroclaw-channels/src/lark.rs:2838-2844 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/line.rs:130— crates/zeroclaw-channels/src/line.rs:130-136 | crates/zeroclaw-channels/src/line.rs:174-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/line.rs:494— crates/zeroclaw-channels/src/line.rs:494-505 | crates/zeroclaw-channels/src/signal.rs:732-738 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/matrix.rs:2404— crates/zeroclaw-channels/src/matrix.rs:2404-2410 | crates/zeroclaw-runtime/src/cron/scheduler.rs:499-505 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/matrix.rs:4616— crates/zeroclaw-channels/src/matrix.rs:4616-4622 | crates/zeroclaw-channels/src/matrix.rs:4684-4690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/matrix.rs:4838— crates/zeroclaw-channels/src/matrix.rs:4838-4844 | crates/zeroclaw-channels/src/matrix.rs:4849-4855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/mattermost.rs:1907— crates/zeroclaw-channels/src/mattermost.rs:1907-1913 | crates/zeroclaw-channels/src/mattermost.rs:2032-2038 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/notion.rs:65— crates/zeroclaw-channels/src/notion.rs:65-71 | crates/zeroclaw-tools/src/notion_tool.rs:34-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) apps/tauri/src/macos/permissions.rs:95— apps/tauri/src/macos/permissions.rs:95-102 | apps/tauri/src/macos/permissions.rs:119-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) apps/zerocode/src/chat.rs:1602— apps/zerocode/src/chat.rs:1602-1609 | apps/zerocode/src/chat.rs:5116-5123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) apps/zerocode/src/chat.rs:5514— apps/zerocode/src/chat.rs:5514-5521 | apps/zerocode/src/chat.rs:5598-5605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) apps/zerocode/src/doctor.rs:368— apps/zerocode/src/doctor.rs:368-375 | apps/zerocode/src/logs.rs:1862-1869 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) apps/zerocode/src/quickstart_pane.rs:1811— apps/zerocode/src/quickstart_pane.rs:1811-1818 | apps/zerocode/src/quickstart_pane.rs:1829-1836 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) apps/zerocode/src/quickstart_pane.rs:2001— apps/zerocode/src/quickstart_pane.rs:2001-2008 | apps/zerocode/src/quickstart_pane.rs:2038-2045 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) apps/zerocode/src/widgets.rs:208— apps/zerocode/src/widgets.rs:208-215 | crates/zeroclaw-runtime/src/agent/loop_.rs:9-16 — 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) crates/zeroclaw-channels/src/bluesky.rs:413— crates/zeroclaw-channels/src/bluesky.rs:413-420 | crates/zeroclaw-channels/src/reddit.rs:216-223 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/reddit.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/discord/markers.rs:858— crates/zeroclaw-channels/src/discord/markers.rs:858-865 | crates/zeroclaw-channels/src/matrix.rs:3364-3371 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/linq.rs:407— crates/zeroclaw-channels/src/linq.rs:407-414 | crates/zeroclaw-channels/src/linq.rs:428-435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/mattermost.rs:997— crates/zeroclaw-channels/src/mattermost.rs:997-1004 | crates/zeroclaw-channels/src/slack.rs:3767-3774 — before extracting anything, compare `crates/zeroclaw-channels/src/mattermost.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/mattermost.rs:1905— crates/zeroclaw-channels/src/mattermost.rs:1905-1912 | crates/zeroclaw-channels/src/whatsapp_web.rs:3081-3088 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:6752— crates/zeroclaw-channels/src/orchestrator/mod.rs:6752-6759 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10818-10828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:9326— crates/zeroclaw-channels/src/orchestrator/mod.rs:9326-9333 | crates/zeroclaw-channels/src/orchestrator/mod.rs:12190-12197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10896— crates/zeroclaw-channels/src/orchestrator/mod.rs:10896-10903 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10978-10985 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:12161— crates/zeroclaw-channels/src/orchestrator/mod.rs:12161-12168 | crates/zeroclaw-runtime/src/sop/engine.rs:1481-1488 — 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) crates/zeroclaw-channels/src/signal.rs:827— crates/zeroclaw-channels/src/signal.rs:827-836 | crates/zeroclaw-channels/src/signal.rs:870-877 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/slack.rs:676— crates/zeroclaw-channels/src/slack.rs:676-683 | crates/zeroclaw-channels/src/slack.rs:5680-5687 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/slack.rs:3049— crates/zeroclaw-channels/src/slack.rs:3049-3056 | crates/zeroclaw-channels/src/slack.rs:3792-3799 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2217— crates/zeroclaw-channels/src/telegram.rs:2217-2224 | crates/zeroclaw-channels/src/telegram.rs:2286-2293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/transcription.rs:215— crates/zeroclaw-channels/src/transcription.rs:215-222 | crates/zeroclaw-channels/src/transcription.rs:322-329 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/wechat.rs:2836— crates/zeroclaw-channels/src/wechat.rs:2836-2843 | crates/zeroclaw-channels/src/wechat.rs:2945-2952 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-config/src/policy.rs:2869— crates/zeroclaw-config/src/policy.rs:2869-2876 | crates/zeroclaw-config/src/policy.rs:2881-2888 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-config/src/schema.rs:22955— crates/zeroclaw-config/src/schema.rs:22955-22962 | crates/zeroclaw-config/src/schema.rs:22969-22976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) crates/zeroclaw-config/src/schema/v2.rs:137— crates/zeroclaw-config/src/schema/v2.rs:137-144 | crates/zeroclaw-config/src/schema/v2.rs:177-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) apps/zerocode/src/chat.rs:1217— apps/zerocode/src/chat.rs:1217-1225 | apps/zerocode/src/chat.rs:1251-1259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) apps/zerocode/src/chat.rs:11445— apps/zerocode/src/chat.rs:11445-11453 | apps/zerocode/src/client.rs:355-363 — 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 (9 lines × 2) apps/zerocode/src/config_manager.rs:2778— apps/zerocode/src/config_manager.rs:2778-2786 | apps/zerocode/src/config_manager.rs:2812-2820 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) apps/zerocode/src/config_manager.rs:3364— apps/zerocode/src/config_manager.rs:3364-3372 | apps/zerocode/src/config_manager.rs:3625-3633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) apps/zerocode/src/quickstart_pane.rs:3148— apps/zerocode/src/quickstart_pane.rs:3148-3156 | apps/zerocode/src/quickstart_pane.rs:3209-3217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) apps/zerorelay/src/enroll_route.rs:179— apps/zerorelay/src/enroll_route.rs:179-187 | apps/zerorelay/src/lib.rs:1533-1541 — 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 (9 lines × 2) crates/zeroclaw-api/src/model_provider.rs:849— crates/zeroclaw-api/src/model_provider.rs:849-857 | crates/zeroclaw-api/src/model_provider.rs:990-998 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:431— crates/zeroclaw-channels/src/discord/mod.rs:431-439 | crates/zeroclaw-channels/src/discord/mod.rs:659-667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:69— crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:69-77 | crates/zeroclaw-channels/src/git/providers/github/mapping.rs:121-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/lark.rs:3588— crates/zeroclaw-channels/src/lark.rs:3588-3596 | crates/zeroclaw-channels/src/lark.rs:3625-3633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/matrix.rs:1354— crates/zeroclaw-channels/src/matrix.rs:1354-1362 | crates/zeroclaw-channels/src/matrix.rs:1374-1382 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/mattermost.rs:496— crates/zeroclaw-channels/src/mattermost.rs:496-504 | crates/zeroclaw-channels/src/slack.rs:1454-1462 — before extracting anything, compare `crates/zeroclaw-channels/src/mattermost.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:7286— crates/zeroclaw-channels/src/orchestrator/mod.rs:7286-7294 | crates/zeroclaw-runtime/src/agent/turn/stream_guard.rs:604-612 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:9958— crates/zeroclaw-channels/src/orchestrator/mod.rs:9958-9966 | crates/zeroclaw-channels/src/orchestrator/mod.rs:9975-9983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10712— crates/zeroclaw-channels/src/orchestrator/mod.rs:10712-10720 | crates/zeroclaw-runtime/src/agent/loop_.rs:3392-3400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13656— crates/zeroclaw-channels/src/orchestrator/mod.rs:13656-13664 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15319-15327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:15502— crates/zeroclaw-channels/src/orchestrator/mod.rs:15502-15510 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15801-15809 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2199— crates/zeroclaw-channels/src/telegram.rs:2199-2207 | crates/zeroclaw-channels/src/telegram.rs:2262-2270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2252— crates/zeroclaw-channels/src/telegram.rs:2252-2260 | crates/zeroclaw-channels/src/telegram.rs:2330-2338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/telegram.rs:5055— crates/zeroclaw-channels/src/telegram.rs:5055-5063 | crates/zeroclaw-channels/src/telegram.rs:5836-5844 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/tts.rs:135— crates/zeroclaw-channels/src/tts.rs:135-143 | crates/zeroclaw-channels/src/tts.rs:976-984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-config/src/policy.rs:423— crates/zeroclaw-config/src/policy.rs:423-431 | crates/zeroclaw-config/src/policy.rs:466-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.
Duplicated block (9 lines × 2) crates/zeroclaw-config/src/schema.rs:21765— crates/zeroclaw-config/src/schema.rs:21765-21773 | crates/zeroclaw-config/src/schema.rs:21788-21796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-config/src/schema.rs:24973— crates/zeroclaw-config/src/schema.rs:24973-24983 | crates/zeroclaw-config/src/schema.rs:25024-25032 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) crates/zeroclaw-config/src/schema/v2.rs:3283— crates/zeroclaw-config/src/schema/v2.rs:3283-3291 | crates/zeroclaw-config/src/schema/v2.rs:3328-3336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
FunctionTooLong: zeroclaw::async_main_inner src/main.rs:9516— FunctionTooLong — zeroclaw::async_main_inner runs 3184 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 3084 over it, 31.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.
FunctionTooLong: zeroclaw_macros::derive_configurable crates/zeroclaw-macros/src/lib.rs:162— FunctionTooLong — zeroclaw_macros::derive_configurable runs 1465 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1365 over it, 14.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::agent::loop_::run crates/zeroclaw-runtime/src/agent/loop_.rs:1526— FunctionTooLong — zeroclaw_runtime::agent::loop_::run runs 1403 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1303 over it, 14.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::agent::turn::run_tool_call_loop_impl crates/zeroclaw-runtime/src/agent/turn/mod.rs:1615— FunctionTooLong — zeroclaw_runtime::agent::turn::run_tool_call_loop_impl runs 1351 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1251 over it, 13.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw::run_quickstart_cli src/main.rs:1779— FunctionTooLong — zeroclaw::run_quickstart_cli runs 955 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 855 over it, 9.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zerocode::app::run apps/zerocode/src/app.rs:1673— FunctionTooLong — zerocode::app::run runs 810 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 710 over it, 8.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::agent::loop_::process_message_inner crates/zeroclaw-runtime/src/agent/loop_.rs:3614— FunctionTooLong — zeroclaw_runtime::agent::loop_::process_message_inner runs 510 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 410 over it, 5.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::daemon::run_with_authority crates/zeroclaw-runtime/src/daemon/mod.rs:715— FunctionTooLong — zeroclaw_runtime::daemon::run_with_authority runs 486 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 386 over it, 4.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_gateway::ws::process_chat_message crates/zeroclaw-gateway/src/ws.rs:1821— FunctionTooLong — zeroclaw_gateway::ws::process_chat_message runs 465 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 365 over it, 4.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw::cron::handle_command src/cron/mod.rs:133— FunctionTooLong — zeroclaw::cron::handle_command runs 440 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 340 over it, 4.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zerocode::quickstart_pane::draw_modal apps/zerocode/src/quickstart_pane.rs:2913— FunctionTooLong — zerocode::quickstart_pane::draw_modal runs 433 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 333 over it, 4.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_gateway::ws::handle_socket crates/zeroclaw-gateway/src/ws.rs:471— FunctionTooLong — zeroclaw_gateway::ws::handle_socket runs 413 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 313 over it, 4.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered crates/zeroclaw-runtime/src/sop/dispatch.rs:655— FunctionTooLong — zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered runs 409 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 309 over it, 4.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw::skills::handle_command src/skills/mod.rs:56— FunctionTooLong — zeroclaw::skills::handle_command runs 389 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 289 over it, 3.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.
FunctionTooLong: zeroclaw_runtime::daemon::run_heartbeat_worker crates/zeroclaw-runtime/src/daemon/mod.rs:2379— FunctionTooLong — zeroclaw_runtime::daemon::run_heartbeat_worker runs 352 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 252 over it, 3.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::agent::turn::max_iter::finish_after_max_iterations crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:71— FunctionTooLong — zeroclaw_runtime::agent::turn::max_iter::finish_after_max_iterations runs 350 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 250 over it, 3.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_gateway::openapi::build_spec crates/zeroclaw-gateway/src/openapi.rs:59— FunctionTooLong — zeroclaw_gateway::openapi::build_spec runs 303 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 203 over it, 3.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::agent::turn::provider_call::call_provider crates/zeroclaw-runtime/src/agent/turn/provider_call.rs:302— FunctionTooLong — zeroclaw_runtime::agent::turn::provider_call::call_provider runs 303 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 203 over it, 3.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::sop::executor::drive_headless_run crates/zeroclaw-runtime/src/sop/executor.rs:876— FunctionTooLong — zeroclaw_runtime::sop::executor::drive_headless_run runs 290 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 190 over it, 2.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::agent::tool_execution::execute_one_tool crates/zeroclaw-runtime/src/agent/tool_execution.rs:144— FunctionTooLong — zeroclaw_runtime::agent::tool_execution::execute_one_tool runs 262 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 162 over it, 2.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zerocode::run apps/zerocode/src/main.rs:879— FunctionTooLong — zerocode::run runs 238 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 138 over it, 2.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw::handle_auth_command src/main.rs:15372— FunctionTooLong — zeroclaw::handle_auth_command runs 232 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 132 over it, 2.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_config::agent_bundle::plan_export crates/zeroclaw-config/src/agent_bundle.rs:290— FunctionTooLong — zeroclaw_config::agent_bundle::plan_export runs 217 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_gateway::api_config::handle_patch crates/zeroclaw-gateway/src/api_config.rs:2575— FunctionTooLong — zeroclaw_gateway::api_config::handle_patch runs 217 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 117 over it, 2.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_runtime::agent::system_prompt::build_system_prompt_with_mode_and_effective_tools crates/zeroclaw-runtime/src/agent/system_prompt.rs:253— FunctionTooLong — zeroclaw_runtime::agent::system_prompt::build_system_prompt_with_mode_and_effective_tools runs 212 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
Hotspot: crates/zeroclaw-config/src/schema.rs crates/zeroclaw-config/src/schema.rs:24274— crates/zeroclaw-config/src/schema.rs changed 149 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 276 in Config::validate at line 24274. 69 of those changes were fix/bug commits, and the other 80 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-config/src/schema.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/main.rs src/main.rs:9516— src/main.rs changed 68 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 371 in zeroclaw::async_main_inner at line 9516. 42 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- src/main.rs`: 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: crates/zeroclaw-channels/src/orchestrator/mod.rs crates/zeroclaw-channels/src/orchestrator/mod.rs:9263— crates/zeroclaw-channels/src/orchestrator/mod.rs changed 111 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 179 in zeroclaw_channels::orchestrator::process_channel_message_body at line 9263. 58 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-channels/src/orchestrator/mod.rs`: 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: crates/zeroclaw-runtime/src/rpc/dispatch.rs crates/zeroclaw-runtime/src/rpc/dispatch.rs:3530— crates/zeroclaw-runtime/src/rpc/dispatch.rs changed 94 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 113 in RpcDispatcher::dispatch_method at line 3530. 43 of those changes were fix/bug commits, and the other 51 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/rpc/dispatch.rs`: 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: apps/zerocode/src/chat.rs apps/zerocode/src/chat.rs:3934— apps/zerocode/src/chat.rs changed 63 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 160 in Chat::handle_key at line 3934. 34 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- apps/zerocode/src/chat.rs`: 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: crates/zeroclaw-runtime/src/agent/turn/mod.rs crates/zeroclaw-runtime/src/agent/turn/mod.rs:1615— crates/zeroclaw-runtime/src/agent/turn/mod.rs changed 61 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 142 in zeroclaw_runtime::agent::turn::run_tool_call_loop_impl at line 1615. 33 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/turn/mod.rs`: 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: apps/zerocode/src/app.rs apps/zerocode/src/app.rs:1673— apps/zerocode/src/app.rs changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 275 in zerocode::app::run at line 1673. 16 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- apps/zerocode/src/app.rs`: 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: crates/zeroclaw-runtime/src/tools/mod.rs crates/zeroclaw-runtime/src/tools/mod.rs:1548— crates/zeroclaw-runtime/src/tools/mod.rs changed 67 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 110 in zeroclaw_runtime::tools::all_tools_with_runtime_on_thread at line 1548. 33 of those changes were fix/bug commits, and the other 34 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/tools/mod.rs`: 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: crates/zeroclaw-runtime/src/agent/loop_.rs crates/zeroclaw-runtime/src/agent/loop_.rs:1526— crates/zeroclaw-runtime/src/agent/loop_.rs changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in zeroclaw_runtime::agent::loop_::run at line 1526. 36 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/loop_.rs`: 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: crates/zeroclaw-gateway/src/lib.rs crates/zeroclaw-gateway/src/lib.rs:1314— crates/zeroclaw-gateway/src/lib.rs changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in zeroclaw_gateway::run_gateway_with_plugin_webhooks at line 1314. 21 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-gateway/src/lib.rs`: 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: crates/zeroclaw-runtime/src/agent/agent.rs crates/zeroclaw-runtime/src/agent/agent.rs:4444— crates/zeroclaw-runtime/src/agent/agent.rs changed 67 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in Agent::turn_streamed_with_steering_body at line 4444. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/agent.rs`: 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: crates/zeroclaw-runtime/src/daemon/mod.rs crates/zeroclaw-runtime/src/daemon/mod.rs:715— crates/zeroclaw-runtime/src/daemon/mod.rs changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in zeroclaw_runtime::daemon::run_with_authority at line 715. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/daemon/mod.rs`: 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: crates/zeroclaw-gateway/src/ws.rs crates/zeroclaw-gateway/src/ws.rs:471— crates/zeroclaw-gateway/src/ws.rs changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 77 in zeroclaw_gateway::ws::handle_socket at line 471. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-gateway/src/ws.rs`: 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: crates/zeroclaw-runtime/src/tools/delegate.rs crates/zeroclaw-runtime/src/tools/delegate.rs:4727— crates/zeroclaw-runtime/src/tools/delegate.rs changed 47 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in DelegateTool::execute_agentic_with_approval_registry at line 4727. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/tools/delegate.rs`: 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: crates/zeroclaw-runtime/src/agent/turn/stream_consume.rs crates/zeroclaw-runtime/src/agent/turn/stream_consume.rs:121— crates/zeroclaw-runtime/src/agent/turn/stream_consume.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in zeroclaw_runtime::agent::turn::stream_consume::consume_provider_streaming_response_with_policy at line 121. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/turn/stream_consume.rs`: 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: crates/zeroclaw-providers/src/anthropic.rs crates/zeroclaw-providers/src/anthropic.rs:2449— crates/zeroclaw-providers/src/anthropic.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in AnthropicModelProvider::parse_anthropic_sse_from_reader at line 2449. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-providers/src/anthropic.rs`: 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: crates/zeroclaw-tool-call-parser/src/lib.rs crates/zeroclaw-tool-call-parser/src/lib.rs:2090— crates/zeroclaw-tool-call-parser/src/lib.rs changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in zeroclaw_tool_call_parser::parse_tool_calls at line 2090. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-tool-call-parser/src/lib.rs`: 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: crates/zeroclaw-providers/src/compatible.rs crates/zeroclaw-providers/src/compatible.rs:2832— crates/zeroclaw-providers/src/compatible.rs changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in zeroclaw_providers::compatible::sse_bytes_to_events_for_contract at line 2832. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-providers/src/compatible.rs`: 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: crates/zeroclaw-runtime/src/agent/turn/max_iter.rs crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:71— crates/zeroclaw-runtime/src/agent/turn/max_iter.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in zeroclaw_runtime::agent::turn::max_iter::finish_after_max_iterations at line 71. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/turn/max_iter.rs`: 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: crates/zeroclaw-channels/src/whatsapp_web.rs crates/zeroclaw-channels/src/whatsapp_web.rs:3793— crates/zeroclaw-channels/src/whatsapp_web.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in WhatsAppWebChannel::listen at line 3793. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-channels/src/whatsapp_web.rs`: 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: apps/zerocode/src/input_bar.rs apps/zerocode/src/input_bar.rs:1534— apps/zerocode/src/input_bar.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in InputBarState::handle_key at line 1534. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- apps/zerocode/src/input_bar.rs`: 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: crates/zeroclaw-config/src/policy.rs crates/zeroclaw-config/src/policy.rs:3715— crates/zeroclaw-config/src/policy.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in SecurityPolicy::forbidden_path_argument_impl at line 3715. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-config/src/policy.rs`: 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: crates/zeroclaw-channels/src/telegram.rs crates/zeroclaw-channels/src/telegram.rs:1942— crates/zeroclaw-channels/src/telegram.rs changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in TelegramChannel::process_model_picker_callback at line 1942. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-channels/src/telegram.rs`: 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: crates/zeroclaw-runtime/src/agent/turn/provider_call.rs crates/zeroclaw-runtime/src/agent/turn/provider_call.rs:302— crates/zeroclaw-runtime/src/agent/turn/provider_call.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in zeroclaw_runtime::agent::turn::provider_call::call_provider at line 302. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/turn/provider_call.rs`: 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: crates/zeroclaw-channels/src/matrix.rs crates/zeroclaw-channels/src/matrix.rs:2279— crates/zeroclaw-channels/src/matrix.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in zeroclaw_channels::matrix::inbound::handle_message at line 2279. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-channels/src/matrix.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Duplicated block (10 lines × 2) apps/zerocode/src/app.rs:3344— apps/zerocode/src/app.rs:3344-3353 | apps/zerocode/src/dashboard.rs:3647-3656 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) apps/zerocode/src/diff.rs:160— apps/zerocode/src/diff.rs:160-170 | apps/zerocode/src/diff.rs:230-239 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) apps/zerocode/src/editor.rs:8— apps/zerocode/src/editor.rs:8-17 | src/skills/mod.rs:1277-1286 — 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 (10 lines × 2) apps/zerocode/src/input_bar.rs:1716— apps/zerocode/src/input_bar.rs:1716-1725 | apps/zerocode/src/input_bar.rs:1949-1958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) apps/zerocode/src/logs.rs:1657— apps/zerocode/src/logs.rs:1657-1666 | apps/zerocode/src/logs.rs:1739-1748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/acp_channel.rs:378— crates/zeroclaw-channels/src/acp_channel.rs:378-387 | crates/zeroclaw-runtime/src/rpc/approval_channel.rs:266-275 — before extracting anything, compare `crates/zeroclaw-channels/src/acp_channel.rs` and `crates/zeroclaw-runtime/src/rpc/approval_channel.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/clawdtalk.rs:120— crates/zeroclaw-channels/src/clawdtalk.rs:120-129 | crates/zeroclaw-channels/src/clawdtalk.rs:183-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/discord/markers.rs:791— crates/zeroclaw-channels/src/discord/markers.rs:791-800 | crates/zeroclaw-channels/src/matrix.rs:3305-3314 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/line.rs:119— crates/zeroclaw-channels/src/line.rs:119-128 | crates/zeroclaw-channels/src/line.rs:163-172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/line.rs:468— crates/zeroclaw-channels/src/line.rs:468-477 | crates/zeroclaw-channels/src/line.rs:498-507 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/matrix.rs:5179— crates/zeroclaw-channels/src/matrix.rs:5179-5188 | crates/zeroclaw-channels/src/matrix.rs:5263-5272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/mattermost.rs:2157— crates/zeroclaw-channels/src/mattermost.rs:2157-2166 | crates/zeroclaw-channels/src/mattermost.rs:2175-2184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1308— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1308-1317 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1642-1651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1879— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1879-1888 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3139-3148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/qq.rs:1543— crates/zeroclaw-channels/src/qq.rs:1543-1552 | crates/zeroclaw-channels/src/qq.rs:1592-1601 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/slack.rs:5736— crates/zeroclaw-channels/src/slack.rs:5736-5745 | crates/zeroclaw-channels/src/slack.rs:5781-5790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/telegram.rs:7700— crates/zeroclaw-channels/src/telegram.rs:7700-7709 | crates/zeroclaw-channels/src/telegram.rs:8750-8760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/transcription.rs:228— crates/zeroclaw-channels/src/transcription.rs:228-237 | crates/zeroclaw-channels/src/transcription.rs:334-343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/wechat.rs:870— crates/zeroclaw-channels/src/wechat.rs:870-879 | crates/zeroclaw-channels/src/whatsapp_web.rs:1291-1300 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/wechat.rs:1200— crates/zeroclaw-channels/src/wechat.rs:1200-1209 | crates/zeroclaw-channels/src/wechat.rs:1242-1251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/whatsapp_storage.rs:494— crates/zeroclaw-channels/src/whatsapp_storage.rs:494-503 | crates/zeroclaw-channels/src/whatsapp_storage.rs:542-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.
Duplicated block (10 lines × 2) crates/zeroclaw-config/src/schema.rs:25782— crates/zeroclaw-config/src/schema.rs:25782-25791 | crates/zeroclaw-config/src/schema.rs:25807-25816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-gateway/src/api.rs:684— crates/zeroclaw-gateway/src/api.rs:684-693 | crates/zeroclaw-gateway/src/api.rs:747-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-gateway/src/api_sop_author.rs:323— crates/zeroclaw-gateway/src/api_sop_author.rs:323-332 | crates/zeroclaw-gateway/src/api_sop_author.rs:337-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) crates/zeroclaw-gateway/src/lib.rs:4755— crates/zeroclaw-gateway/src/lib.rs:4755-4764 | crates/zeroclaw-gateway/src/lib.rs:4885-4894 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) apps/zerocode/src/chat.rs:4930— apps/zerocode/src/chat.rs:4930-4935 | apps/zerocode/src/chat.rs:4943-4948 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) apps/zerocode/src/diff.rs:122— apps/zerocode/src/diff.rs:122-127 | apps/zerocode/src/diff.rs:199-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) apps/zerocode/src/editor.rs:2— apps/zerocode/src/editor.rs:2-7 | src/skills/mod.rs:1271-1276 — 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) apps/zerocode/src/quickstart_pane.rs:3108— apps/zerocode/src/quickstart_pane.rs:3108-3113 | apps/zerocode/src/quickstart_pane.rs:3171-3176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/lark.rs:1810— crates/zeroclaw-channels/src/lark.rs:1810-1815 | crates/zeroclaw-channels/src/lark.rs:3018-3023 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/lark.rs:2206— crates/zeroclaw-channels/src/lark.rs:2206-2211 | crates/zeroclaw-channels/src/telegram.rs:8108-8113 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/lark.rs:2367— crates/zeroclaw-channels/src/lark.rs:2367-2372 | crates/zeroclaw-channels/src/lark.rs:2653-2658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/line.rs:1107— crates/zeroclaw-channels/src/line.rs:1107-1112 | crates/zeroclaw-channels/src/line.rs:1144-1149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/matrix.rs:1947— crates/zeroclaw-channels/src/matrix.rs:1947-1952 | crates/zeroclaw-channels/src/telegram.rs:7957-7963 — 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 (6 lines × 2) crates/zeroclaw-channels/src/matrix.rs:4567— crates/zeroclaw-channels/src/matrix.rs:4567-4573 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1293-1298 — 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:4840— crates/zeroclaw-channels/src/orchestrator/mod.rs:4840-4845 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17102-17107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:6873— crates/zeroclaw-channels/src/orchestrator/mod.rs:6873-6878 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6890-6895 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13376— crates/zeroclaw-channels/src/orchestrator/mod.rs:13376-13381 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14630-14635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/slack.rs:4568— crates/zeroclaw-channels/src/slack.rs:4568-4573 | crates/zeroclaw-channels/src/slack.rs:6014-6021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2003— crates/zeroclaw-channels/src/telegram.rs:2003-2008 | crates/zeroclaw-channels/src/telegram.rs:7567-7572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/telegram.rs:4979— crates/zeroclaw-channels/src/telegram.rs:4979-4984 | crates/zeroclaw-gateway/src/api_upload.rs:165-170 — 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) crates/zeroclaw-channels/src/telegram.rs:7786— crates/zeroclaw-channels/src/telegram.rs:7786-7791 | crates/zeroclaw-channels/src/telegram.rs:7962-7967 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/wechat.rs:1219— crates/zeroclaw-channels/src/wechat.rs:1219-1224 | crates/zeroclaw-channels/src/wechat.rs:1258-1263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-config/src/schema.rs:8590— crates/zeroclaw-config/src/schema.rs:8590-8595 | crates/zeroclaw-tools/src/microsoft365/types.rs:21-26 — 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) crates/zeroclaw-config/src/schema.rs:11955— crates/zeroclaw-config/src/schema.rs:11955-11960 | crates/zeroclaw-config/src/schema.rs:11991-11996 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-config/src/schema/v2.rs:3680— crates/zeroclaw-config/src/schema/v2.rs:3680-3685 | crates/zeroclaw-config/src/schema/v2.rs:3719-3724 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) crates/zeroclaw-gateway/src/api_config.rs:1246— crates/zeroclaw-gateway/src/api_config.rs:1246-1251 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:9978-9983 — 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) crates/zeroclaw-gateway/src/lib.rs:1953— crates/zeroclaw-gateway/src/lib.rs:1953-1958 | crates/zeroclaw-runtime/src/daemon/mod.rs:1250-1255 — 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) crates/zeroclaw-gateway/src/lib.rs:2058— crates/zeroclaw-gateway/src/lib.rs:2058-2063 | crates/zeroclaw-runtime/src/sop/engine.rs:731-740 — 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) crates/zeroclaw-gateway/src/lib.rs:3874— crates/zeroclaw-gateway/src/lib.rs:3874-3879 | crates/zeroclaw-hardware/src/loader.rs:92-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
zeroclaw_runtime::agent::turn::run_tool_call_loop_impl (cognitive 309) crates/zeroclaw-runtime/src/agent/turn/mod.rs:1615— zeroclaw_runtime::agent::turn::run_tool_call_loop_impl has cognitive complexity 309 (threshold 15). Drivers by points: if/else 101 (229 pts), match/switch 14 (33 pts), boolean chains 31, loops 6 (16 pts) (nesting depth added 157). 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.
zeroclaw_runtime::agent::loop_::run (cognitive 288) crates/zeroclaw-runtime/src/agent/loop_.rs:1526— zeroclaw_runtime::agent::loop_::run has cognitive complexity 288 (threshold 15). Drivers by points: if/else 93 (219 pts), match/switch 15 (37 pts), loops 6 (19 pts), boolean chains 13 (nesting depth added 161). 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.
zeroclaw_runtime::agent::turn::stream_consume::consume_provider_streaming_response_with_policy (cognitive 244) crates/zeroclaw-runtime/src/agent/turn/stream_consume.rs:121— zeroclaw_runtime::agent::turn::stream_consume::consume_provider_streaming_response_with_policy has cognitive complexity 244 (threshold 15). Drivers by points: if/else 69 (220 pts), boolean chains 16, match/switch 3 (7 pts), loops 1 (nesting depth added 155). 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.
zeroclaw_runtime::tools::all_tools_with_runtime_on_thread (cognitive 155) crates/zeroclaw-runtime/src/tools/mod.rs:1548— zeroclaw_runtime::tools::all_tools_with_runtime_on_thread has cognitive complexity 155 (threshold 15). Drivers by points: if/else 73 (91 pts), boolean chains 37, match/switch 11 (23 pts), loops 2 (4 pts) (nesting depth added 32). 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.
zeroclaw_runtime::agent::turn::drive_live_sop_actions (cognitive 140) crates/zeroclaw-runtime/src/agent/turn/mod.rs:4049— zeroclaw_runtime::agent::turn::drive_live_sop_actions has cognitive complexity 140 (threshold 15). Drivers by points: if/else 26 (96 pts), match/switch 10 (38 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 99). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::identity::aieos_to_system_prompt (cognitive 132) crates/zeroclaw-runtime/src/identity.rs:719— zeroclaw_runtime::identity::aieos_to_system_prompt has cognitive complexity 132 (threshold 15). Drivers by points: if/else 45 (84 pts), loops 12 (36 pts), boolean chains 12 (nesting depth added 63). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::agent::turn::provider_call::call_provider (cognitive 111) crates/zeroclaw-runtime/src/agent/turn/provider_call.rs:302— zeroclaw_runtime::agent::turn::provider_call::call_provider has cognitive complexity 111 (threshold 15). Drivers by points: if/else 28 (59 pts), match/switch 12 (47 pts), boolean chains 5 (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_runtime::daemon::run_heartbeat_worker (cognitive 104) crates/zeroclaw-runtime/src/daemon/mod.rs:2379— zeroclaw_runtime::daemon::run_heartbeat_worker has cognitive complexity 104 (threshold 15). Drivers by points: if/else 28 (63 pts), match/switch 7 (26 pts), loops 4 (11 pts), boolean chains 4 (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered (cognitive 104) crates/zeroclaw-runtime/src/sop/dispatch.rs:655— zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered has cognitive complexity 104 (threshold 15). Drivers by points: loops 17 (40 pts), match/switch 15 (35 pts), if/else 17 (27 pts), boolean chains 2 (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::daemon::run_with_authority (cognitive 75) crates/zeroclaw-runtime/src/daemon/mod.rs:715— zeroclaw_runtime::daemon::run_with_authority has cognitive complexity 75 (threshold 15). Drivers by points: if/else 35 (48 pts), match/switch 9 (17 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::quickstart::apply_channels (cognitive 75) crates/zeroclaw-runtime/src/quickstart/mod.rs:1645— zeroclaw_runtime::quickstart::apply_channels has cognitive complexity 75 (threshold 15). Drivers by points: if/else 19 (60 pts), boolean chains 9, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::sop::parse_steps (cognitive 71) crates/zeroclaw-runtime/src/sop/mod.rs:1309— zeroclaw_runtime::sop::parse_steps has cognitive complexity 71 (threshold 15). Drivers by points: if/else 21 (63 pts), match/switch 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::agent::turn::max_iter::finish_after_max_iterations (cognitive 70) crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:71— zeroclaw_runtime::agent::turn::max_iter::finish_after_max_iterations has cognitive complexity 70 (threshold 15). Drivers by points: if/else 29 (44 pts), match/switch 8 (17 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::doctor::check_config_semantics (cognitive 63) crates/zeroclaw-runtime/src/doctor/mod.rs:1163— zeroclaw_runtime::doctor::check_config_semantics has cognitive complexity 63 (threshold 15). Drivers by points: if/else 31 (45 pts), loops 9, match/switch 3 (6 pts), boolean chains 3 (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.
zeroclaw_runtime::skills::improver::extract_skill_executions_from_history (cognitive 61) crates/zeroclaw-runtime/src/skills/improver.rs:266— zeroclaw_runtime::skills::improver::extract_skill_executions_from_history has cognitive complexity 61 (threshold 15). Drivers by points: if/else 12 (49 pts), loops 3 (7 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 44). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_runtime::agent::turn::approval_gate::gate_tool_approval (cognitive 59) crates/zeroclaw-runtime/src/agent/turn/approval_gate.rs:22— zeroclaw_runtime::agent::turn::approval_gate::gate_tool_approval has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (38 pts), match/switch 5 (19 pts), boolean chains 2 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_runtime::quickstart::apply_model_provider (cognitive 52) crates/zeroclaw-runtime/src/quickstart/mod.rs:1233— zeroclaw_runtime::quickstart::apply_model_provider has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (42 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::agent::turn::call_prep::prepare_tool_calls (cognitive 49) crates/zeroclaw-runtime/src/agent/turn/call_prep.rs:130— zeroclaw_runtime::agent::turn::call_prep::prepare_tool_calls has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (31 pts), loops 3 (8 pts), boolean chains 5, match/switch 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.
zeroclaw_runtime::skills::creator::extract_tool_calls_from_history (cognitive 48) crates/zeroclaw-runtime/src/skills/creator.rs:575— zeroclaw_runtime::skills::creator::extract_tool_calls_from_history has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (39 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_runtime::rpc::wss::serve_wss_listener (cognitive 42) crates/zeroclaw-runtime/src/rpc/wss.rs:931— zeroclaw_runtime::rpc::wss::serve_wss_listener has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 7 (18 pts), loops 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::rpc::dispatch::deliver_subscription (cognitive 41) crates/zeroclaw-runtime/src/rpc/dispatch.rs:13056— zeroclaw_runtime::rpc::dispatch::deliver_subscription has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::agent::history_pruner::remove_orphaned_tool_messages (cognitive 40) crates/zeroclaw-runtime/src/agent/history_pruner.rs:43— zeroclaw_runtime::agent::history_pruner::remove_orphaned_tool_messages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 4 (13 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::sop::executor::drive_headless_run (cognitive 40) crates/zeroclaw-runtime/src/sop/executor.rs:876— zeroclaw_runtime::sop::executor::drive_headless_run has cognitive complexity 40 (threshold 15). Drivers by points: match/switch 12 (32 pts), if/else 3 (7 pts), loops 1 (nesting depth added 24). 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.
zeroclaw_runtime::agent::loop_::process_message_inner (cognitive 37) crates/zeroclaw-runtime/src/agent/loop_.rs:3614— zeroclaw_runtime::agent::loop_::process_message_inner has cognitive complexity 37 (threshold 15). Drivers by points: if/else 27 (29 pts), boolean chains 4, match/switch 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
zeroclaw_runtime::agent::memory_inject::render_memory_context (cognitive 37) crates/zeroclaw-runtime/src/agent/memory_inject.rs:269— zeroclaw_runtime::agent::memory_inject::render_memory_context has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 3 (6 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (11 lines × 2) apps/tauri/src/daemon.rs:427— apps/tauri/src/daemon.rs:427-437 | apps/tauri/src/daemon.rs:451-461 — both copies are in the same file, so extract the 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) apps/zerocode/src/chat.rs:7524— apps/zerocode/src/chat.rs:7524-7534 | apps/zerocode/src/logs.rs:82-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) apps/zerocode/src/config_manager.rs:5209— apps/zerocode/src/config_manager.rs:5209-5219 | apps/zerocode/src/config_manager.rs:5302-5312 — both copies are in the same file, so extract the 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) apps/zerocode/src/config_manager.rs:5271— apps/zerocode/src/config_manager.rs:5271-5281 | apps/zerocode/src/config_manager.rs:5360-5370 — both copies are in the same file, so extract the 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) apps/zerocode/src/quickstart_pane.rs:1238— apps/zerocode/src/quickstart_pane.rs:1238-1248 | apps/zerocode/src/quickstart_pane.rs:1366-1376 — both copies are in the same file, so extract the 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) apps/zerocode/src/quickstart_pane.rs:3117— apps/zerocode/src/quickstart_pane.rs:3117-3127 | apps/zerocode/src/quickstart_pane.rs:3180-3190 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/discord/mod.rs:2046— crates/zeroclaw-channels/src/discord/mod.rs:2046-2056 | crates/zeroclaw-channels/src/qq.rs:1424-1434 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/qq.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/discord/mod.rs:2467— crates/zeroclaw-channels/src/discord/mod.rs:2467-2477 | crates/zeroclaw-channels/src/discord/mod.rs:2659-2669 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/discord/mod.rs:3805— crates/zeroclaw-channels/src/discord/mod.rs:3805-3815 | crates/zeroclaw-channels/src/discord/mod.rs:3843-3853 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/discord/slash.rs:571— crates/zeroclaw-channels/src/discord/slash.rs:571-581 | crates/zeroclaw-channels/src/discord/slash.rs:643-653 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/login_probe.rs:45— crates/zeroclaw-channels/src/login_probe.rs:45-55 | crates/zeroclaw-channels/src/login_relink.rs:73-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/matrix.rs:764— crates/zeroclaw-channels/src/matrix.rs:764-774 | crates/zeroclaw-channels/src/orchestrator/mod.rs:8443-8453 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/orchestrator/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/matrix.rs:5479— crates/zeroclaw-channels/src/matrix.rs:5479-5489 | crates/zeroclaw-channels/src/signal.rs:970-980 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:4454— crates/zeroclaw-channels/src/orchestrator/mod.rs:4454-4464 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4490-4500 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:15061— crates/zeroclaw-channels/src/orchestrator/mod.rs:15061-15071 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16196-16206 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/slack.rs:1592— crates/zeroclaw-channels/src/slack.rs:1592-1602 | crates/zeroclaw-channels/src/slack.rs:2676-2686 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/slack.rs:2813— crates/zeroclaw-channels/src/slack.rs:2813-2823 | crates/zeroclaw-channels/src/slack.rs:2870-2880 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/slack.rs:2932— crates/zeroclaw-channels/src/slack.rs:2932-2942 | crates/zeroclaw-channels/src/slack.rs:2952-2962 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/slack.rs:3080— crates/zeroclaw-channels/src/slack.rs:3080-3090 | crates/zeroclaw-channels/src/slack.rs:3818-3828 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/util.rs:139— crates/zeroclaw-channels/src/util.rs:139-149 | crates/zeroclaw-providers/src/compatible.rs:397-407 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/wecom_ws.rs:947— crates/zeroclaw-channels/src/wecom_ws.rs:947-957 | crates/zeroclaw-channels/src/wecom_ws.rs:983-993 — both copies are in the same file, so extract the 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) crates/zeroclaw-config/src/policy.rs:3404— crates/zeroclaw-config/src/policy.rs:3404-3414 | crates/zeroclaw-config/src/policy.rs:3583-3593 — both copies are in the same file, so extract the 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) crates/zeroclaw-config/src/schema.rs:27120— crates/zeroclaw-config/src/schema.rs:27120-27134 | crates/zeroclaw-config/src/schema.rs:27380-27390 — both copies are in the same file, so extract the 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) crates/zeroclaw-config/src/schema/v2.rs:3331— crates/zeroclaw-config/src/schema/v2.rs:3331-3341 | crates/zeroclaw-config/src/schema/v2.rs:3379-3389 — both copies are in the same file, so extract the 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) crates/zeroclaw-gateway/src/api.rs:1768— crates/zeroclaw-gateway/src/api.rs:1768-1778 | crates/zeroclaw-gateway/src/api.rs:2146-2156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) apps/tauri/src/macos/permissions.rs:203— apps/tauri/src/macos/permissions.rs:203-207 | apps/tauri/src/macos/permissions.rs:223-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.
Duplicated block (5 lines × 2) apps/zerocode/src/app.rs:2193— apps/zerocode/src/app.rs:2193-2200 | apps/zerocode/src/app.rs:2277-2281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) apps/zerocode/src/client_crypto.rs:26— apps/zerocode/src/client_crypto.rs:26-30 | crates/zeroclaw-tls/src/lib.rs:280-284 — 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) crates/zeroclaw-channels/src/discord/markers.rs:807— crates/zeroclaw-channels/src/discord/markers.rs:807-811 | crates/zeroclaw-channels/src/matrix.rs:3321-3325 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/discord/mod.rs:1643— crates/zeroclaw-channels/src/discord/mod.rs:1643-1647 | crates/zeroclaw-tools/src/web_fetch.rs:300-304 — 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) crates/zeroclaw-channels/src/discord/mod.rs:2079— crates/zeroclaw-channels/src/discord/mod.rs:2079-2083 | crates/zeroclaw-channels/src/discord/mod.rs:2114-2120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/gmail_push.rs:642— crates/zeroclaw-channels/src/gmail_push.rs:642-646 | crates/zeroclaw-channels/src/gmail_push.rs:663-667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/linq.rs:345— crates/zeroclaw-channels/src/linq.rs:345-350 | crates/zeroclaw-channels/src/whatsapp.rs:808-812 — 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:5964— crates/zeroclaw-channels/src/orchestrator/mod.rs:5964-5968 | crates/zeroclaw-tools/src/model_routing_config.rs:784-789 — 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:7887— crates/zeroclaw-channels/src/orchestrator/mod.rs:7887-7891 | crates/zeroclaw-channels/src/orchestrator/mod.rs:7982-7989 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10161— crates/zeroclaw-channels/src/orchestrator/mod.rs:10161-10165 | crates/zeroclaw-runtime/src/routines/engine.rs:206-210 — 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:10375— crates/zeroclaw-channels/src/orchestrator/mod.rs:10375-10379 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10754-10758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:11377— crates/zeroclaw-channels/src/orchestrator/mod.rs:11377-11381 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1208-1212 — 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:13253— crates/zeroclaw-channels/src/orchestrator/mod.rs:13253-13257 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14865-14869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:14499— crates/zeroclaw-channels/src/orchestrator/mod.rs:14499-14504 | crates/zeroclaw-runtime/src/tools/mod.rs:2625-2629 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-runtime/src/tools/mod.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:17103— crates/zeroclaw-channels/src/orchestrator/mod.rs:17103-17107 | crates/zeroclaw-providers/src/router.rs:702-706 — 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) crates/zeroclaw-channels/src/qq.rs:476— crates/zeroclaw-channels/src/qq.rs:476-481 | crates/zeroclaw-channels/src/wechat.rs:1811-1815 — before extracting anything, compare `crates/zeroclaw-channels/src/qq.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/qq.rs:1716— crates/zeroclaw-channels/src/qq.rs:1716-1720 | crates/zeroclaw-channels/src/qq.rs:1789-1793 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/wechat.rs:482— crates/zeroclaw-channels/src/wechat.rs:482-486 | crates/zeroclaw-channels/src/wechat.rs:541-545 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-config/src/schema_markdown.rs:683— crates/zeroclaw-config/src/schema_markdown.rs:683-687 | crates/zeroclaw-config/src/schema_markdown.rs:696-700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-gateway/src/api_sections.rs:346— crates/zeroclaw-gateway/src/api_sections.rs:346-350 | xtask/src/cmd/mdbook/versions.rs:260-264 — 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) crates/zeroclaw-gateway/src/lib.rs:1624— crates/zeroclaw-gateway/src/lib.rs:1624-1628 | crates/zeroclaw-gateway/src/lib.rs:1721-1726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-gateway/src/lib.rs:3164— crates/zeroclaw-gateway/src/lib.rs:3164-3168 | crates/zeroclaw-gateway/src/lib.rs:3689-3693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-gateway/src/ws.rs:984— crates/zeroclaw-gateway/src/ws.rs:984-988 | crates/zeroclaw-gateway/src/ws.rs:2045-2049 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) crates/zeroclaw-hardware/src/introspect.rs:90— crates/zeroclaw-hardware/src/introspect.rs:90-94 | crates/zeroclaw-hardware/src/lib.rs:554-558 — 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 (12 lines × 2) apps/tauri/src/macos/permissions.rs:57— apps/tauri/src/macos/permissions.rs:57-68 | apps/tauri/src/macos/permissions.rs:224-235 — both copies are in the same file, so extract the 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) apps/zerocode/src/chat.rs:4016— apps/zerocode/src/chat.rs:4016-4027 | apps/zerocode/src/chat.rs:4261-4272 — both copies are in the same file, so extract the 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) apps/zerocode/src/dashboard.rs:1582— apps/zerocode/src/dashboard.rs:1582-1593 | apps/zerocode/src/dashboard.rs:1610-1621 — both copies are in the same file, so extract the 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) apps/zerocode/src/enroll.rs:451— apps/zerocode/src/enroll.rs:451-462 | apps/zerorelay/src/enroll_proxy.rs:356-367 — before extracting anything, compare `apps/zerocode/src/enroll.rs` and `apps/zerorelay/src/enroll_proxy.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) apps/zerocode/src/quickstart_pane.rs:1759— apps/zerocode/src/quickstart_pane.rs:1759-1770 | apps/zerocode/src/quickstart_pane.rs:1777-1788 — both copies are in the same file, so extract the 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) apps/zerocode/src/quickstart_pane.rs:1871— apps/zerocode/src/quickstart_pane.rs:1871-1882 | apps/zerocode/src/quickstart_pane.rs:1914-1925 — both copies are in the same file, so extract the 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) apps/zerocode/src/quickstart_pane.rs:3158— apps/zerocode/src/quickstart_pane.rs:3158-3169 | apps/zerocode/src/quickstart_pane.rs:3219-3230 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/acp_channel.rs:193— crates/zeroclaw-channels/src/acp_channel.rs:193-204 | crates/zeroclaw-channels/src/acp_channel.rs:226-237 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/discord/mod.rs:1522— crates/zeroclaw-channels/src/discord/mod.rs:1522-1533 | crates/zeroclaw-channels/src/telegram.rs:693-704 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:85— crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:85-96 | crates/zeroclaw-channels/src/git/providers/github/mapping.rs:199-210 — 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 (12 lines × 2) crates/zeroclaw-channels/src/lark.rs:2890— crates/zeroclaw-channels/src/lark.rs:2890-2901 | crates/zeroclaw-channels/src/lark.rs:3377-3388 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/lark.rs:3000— crates/zeroclaw-channels/src/lark.rs:3000-3011 | crates/zeroclaw-channels/src/lark.rs:3092-3103 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/lark.rs:3020— crates/zeroclaw-channels/src/lark.rs:3020-3031 | crates/zeroclaw-channels/src/lark.rs:3141-3152 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/line.rs:333— crates/zeroclaw-channels/src/line.rs:333-344 | crates/zeroclaw-channels/src/webhook.rs:356-367 — 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 (12 lines × 2) crates/zeroclaw-channels/src/matrix.rs:3355— crates/zeroclaw-channels/src/matrix.rs:3355-3366 | crates/zeroclaw-channels/src/whatsapp_web.rs:3112-3123 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/matrix.rs:3802— crates/zeroclaw-channels/src/matrix.rs:3802-3813 | crates/zeroclaw-channels/src/matrix.rs:3853-3864 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/mattermost.rs:1576— crates/zeroclaw-channels/src/mattermost.rs:1576-1587 | crates/zeroclaw-channels/src/mattermost.rs:1634-1645 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/nostr.rs:239— crates/zeroclaw-channels/src/nostr.rs:239-250 | crates/zeroclaw-channels/src/nostr.rs:292-303 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:17040— crates/zeroclaw-channels/src/orchestrator/mod.rs:17040-17051 | crates/zeroclaw-gateway/src/lib.rs:2004-2015 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-gateway/src/lib.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:17302— crates/zeroclaw-channels/src/orchestrator/mod.rs:17302-17313 | crates/zeroclaw-runtime/src/tools/delegate.rs:5102-5113 — 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 (12 lines × 2) crates/zeroclaw-channels/src/slack.rs:1578— crates/zeroclaw-channels/src/slack.rs:1578-1590 | crates/zeroclaw-channels/src/slack.rs:2663-2674 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/slack.rs:4761— crates/zeroclaw-channels/src/slack.rs:4761-4772 | crates/zeroclaw-channels/src/slack.rs:4959-4970 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/slack.rs:6249— crates/zeroclaw-channels/src/slack.rs:6249-6260 | crates/zeroclaw-channels/src/telegram.rs:8701-8712 — 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 (12 lines × 2) crates/zeroclaw-channels/src/telegram.rs:872— crates/zeroclaw-channels/src/telegram.rs:872-883 | crates/zeroclaw-channels/src/wechat.rs:393-404 — before extracting anything, compare `crates/zeroclaw-channels/src/telegram.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 158 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/telegram.rs:8715— crates/zeroclaw-channels/src/telegram.rs:8715-8726 | crates/zeroclaw-channels/src/telegram.rs:8756-8767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Repeated repair: crates/zeroclaw-runtime/src/i18n.rs crates/zeroclaw-runtime/src/i18n.rs:209— crates/zeroclaw-runtime/src/i18n.rs changed 31 times in last 90 days and 21 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is zeroclaw_runtime::i18n::format_ftl_messages at line 209), 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(plugins): report the runtime's config refusal in plugin info and list --verify (#11811)”; “fix(plugins): count WebSocket and socket transports for a tool package's egress declaration (#11808)”; “fix(plugins): recover incomplete installs through plugin remove (#11236)”; “fix(runtime): localize iMessage and generic chat guidance (#11496)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/i18n.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-api/src/channel.rs crates/zeroclaw-api/src/channel.rs:326— crates/zeroclaw-api/src/channel.rs changed 19 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is GateChoiceKind::from_id at line 326), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(channels): wait out Telegram retry_after instead of retrying sendMessage into a 429 (#11650)”; “fix(channels): restore supervised shell approval routing (#10241)”; “fix(channels): connect CLI Ctrl+C to supervisor lifecycle token (#9197)”; “fix(runtime): deliver terminal fallbacks live (#10417)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-api/src/channel.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: src/lib.rs src/lib.rs:703— src/lib.rs changed 15 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is CronDeliveryArgs::best_effort_override at line 703), 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(service): bound Windows task stdout and stderr logs (#10931)”; “fix(gateway): require an owner-only admin token to read or mint pairing codes (#11177)”; “fix(desktop): bound daemon capture logs (#10236)”; “fix(runtime/cron): map command patches onto agent job prompts (#10258)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- src/lib.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: apps/zerocode/src/i18n.rs apps/zerocode/src/i18n.rs:115— apps/zerocode/src/i18n.rs changed 14 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is zerocode::i18n::format_ftl_messages at line 115), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(zerocode): name Enter in the paused-queue hint (#11775)”; “fix(zerocode): explain missing-completion queue pauses (#11449)”; “fix(runtime): count and report retained history in whole turns (#9368)”; “fix(zerocode): reduce repeated label and pinned-preview rendering work (#10648)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- apps/zerocode/src/i18n.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-api/src/model_provider.rs crates/zeroclaw-api/src/model_provider.rs:333— crates/zeroclaw-api/src/model_provider.rs changed 15 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is zeroclaw_api::model_provider::projected_entry_count at line 333), 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(runtime): recover from rejected image requests (#10480)”; “fix(infra): persist projected ACP message count for session/list-acp (#10810)”; “fix(providers): retry the stream-failed entry when the stream failed before send (#11170)”; “fix(runtime): preserve configured provider profile semantics (#10172)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-api/src/model_provider.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-plugins/src/component.rs crates/zeroclaw-plugins/src/component.rs:360— crates/zeroclaw-plugins/src/component.rs changed 14 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is PluginState::tls_client_config at line 360), 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(plugins): discard a memory plugin's instance after a failed call (#11402)”; “fix(plugins): harden named TLS profile materialization (#11228)”; “fix(plugins): replace a channel plugin's instance after a trap (#11356)”; “fix(plugins): report a plugin channel's own health check in /health (#11348)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-plugins/src/component.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-config/src/validation_warnings.rs crates/zeroclaw-config/src/validation_warnings.rs:133— crates/zeroclaw-config/src/validation_warnings.rs changed 13 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is zeroclaw_config::validation_warnings::levenshtein_distance at line 133), 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(security): stop presenting command execution as audited (#9410)”; “fix(whatsapp-web): an empty allowed_groups admits no group unless group_policy is all (#9382)”; “fix(vi): report the withheld vi_verify tool through the config surface (#9942)”; “fix(config): warn on risky Codex CLI extra args (#9548)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-config/src/validation_warnings.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/service/mod.rs crates/zeroclaw-runtime/src/service/mod.rs:475— crates/zeroclaw-runtime/src/service/mod.rs changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is zeroclaw_runtime::service::enforce_windows_private_acl at line 475), 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(service): gate the mpsc import for macOS test Clippy (#11314)”; “fix(service): bound Windows task stdout and stderr logs (#10931)”; “fix(runtime): keep operational paths panic-free (#10133)”; “fix(desktop): bound daemon capture logs (#10236)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/service/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-channels/src/tts.rs crates/zeroclaw-channels/src/tts.rs:1097— crates/zeroclaw-channels/src/tts.rs changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is TtsManager::from_config_for_agent at line 1097), 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(channels): route every outbound HTTP client through the runtime proxy (#10748)”; “fix(channels): create Edge TTS artifact with owner-only permissions (#10449)”; “fix(tts): surface providers dropped for a missing api_key (#10628)”; “fix(channels): mark ElevenLabs TTS API key sensitive (#10433)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-channels/src/tts.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/agent/turn/execution.rs crates/zeroclaw-runtime/src/agent/turn/execution.rs:77— crates/zeroclaw-runtime/src/agent/turn/execution.rs changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is ResolvedModelAccess::run_model_query at line 77), 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(runtime): estimate context usage when provider omits token counts (#9453)”; “fix(tools): declare tool attachments explicitly instead of scanning tool text for image markers (#10938)”; “fix(runtime): gate the no-vision error on image markers that resolve (#10904)”; “fix(runtime): normalize image markers on the run_model_query seam (#10894)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/turn/execution.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-plugins/src/wasi_http.rs crates/zeroclaw-plugins/src/wasi_http.rs:855— crates/zeroclaw-plugins/src/wasi_http.rs changed 10 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is zeroclaw_plugins::wasi_http::send at line 855), 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(plugins): stagger pinned egress dials so a silent address cannot stall the connect (#11814)”; “fix(plugins): harden named TLS profile materialization (#11228)”; “fix(deps): bump wasmtime to 48.0.x for RUSTSEC-2026-0313..0316 (#11253)”; “fix(plugins): escape apostrophes in egress remedy commands (#11107)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-plugins/src/wasi_http.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-config/src/cost/tracker.rs crates/zeroclaw-config/src/cost/tracker.rs:431— crates/zeroclaw-config/src/cost/tracker.rs changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is CostTracker::check_budget_at_period at line 431), 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(cost): key the process-global cost trackers by ledger path (#11350)”; “fix(cost): report rejected ledger records in cost summaries (#11557)”; “fix(cost): count a revisited alias's spend once in delegation-chain ceilings (#11287)”; “fix(runtime): scope cost tracking into delegated sub-loops and enforce per-agent ceilings (#10804)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-config/src/cost/tracker.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/agent/turn/vision_route.rs crates/zeroclaw-runtime/src/agent/turn/vision_route.rs:58— crates/zeroclaw-runtime/src/agent/turn/vision_route.rs changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is zeroclaw_runtime::agent::turn::vision_route::resolve_vision_provider_with_allowed_refs at line 58), 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(tools): declare tool attachments explicitly instead of scanning tool text for image markers (#10938)”; “fix(runtime): gate the no-vision error on image markers that resolve (#10904)”; “fix(multimodal): add pixel-level image validation to prevent corrupt images from failing provider requests (#9819)”; “fix(runtime): count and report retained history in whole turns (#9368)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/turn/vision_route.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/security/detect.rs crates/zeroclaw-runtime/src/security/detect.rs:576— crates/zeroclaw-runtime/src/security/detect.rs changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is zeroclaw_runtime::security::detect::create_selected_sandbox at line 576), 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(security): apply configured firejail_args to the Firejail wrapper (#11656)”; “fix(security): name the cause when a requested bubblewrap backend is rejected (#11559)”; “fix(security): report Seatbelt initialization during registry construction (#11499)”; “fix(runtime): honor allowed roots in Seatbelt (#10556)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/security/detect.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-channels/src/transcription.rs crates/zeroclaw-channels/src/transcription.rs:1046— crates/zeroclaw-channels/src/transcription.rs changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is TranscriptionManager::register_legacy_providers at line 1046), 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(channels): send initial_prompt to Groq and OpenAI transcription (#11258)”; “fix(channels): forward transcription language hints (#10431)”; “fix(channels): resolve Voice Wake transcription from the owning agent (#10032)”; “fix(channels): keep Google STT API keys out of URLs (#10107)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-channels/src/transcription.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/agent/turn/outcome.rs crates/zeroclaw-runtime/src/agent/turn/outcome.rs:257— crates/zeroclaw-runtime/src/agent/turn/outcome.rs changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is zeroclaw_runtime::agent::turn::outcome::reliable_provider_terminal_failure_message_with_renderer at line 257), 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(runtime): say what filled the window when a request cannot fit (#11578)”; “fix(runtime): deliver mid-turn steering at the next step, not after the final answer (#11725)”; “fix(runtime): distinguish trim targets from model capacity (#11067)”; “fix(providers): surface terminal provider failure causes (#10234)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/turn/outcome.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/agent/history.rs crates/zeroclaw-runtime/src/agent/history.rs:35— crates/zeroclaw-runtime/src/agent/history.rs changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is zeroclaw_runtime::agent::history::nudge_around_image_marker at line 35), 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(tools): declare tool attachments explicitly instead of scanning tool text for image markers (#10938)”; “fix(runtime): count and report retained history in whole turns (#9368)”; “fix(multimodal): keep tool-result images live for the current user turn (#10903)”; “fix(runtime): charge image markers a fixed per-image cost in the history token estimate (#10890)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/history.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-tools/src/image_gen.rs crates/zeroclaw-tools/src/image_gen.rs:25— crates/zeroclaw-tools/src/image_gen.rs changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is zeroclaw_tools::image_gen::parse_public_https_url at line 25), 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(tools): declare tool attachments explicitly instead of scanning tool text for image markers (#10938)”; “fix(tests): fix Windows platform test failures (#10208)”; “fix(tools): replace panic-prone assumptions (#10129)”; “fix(tools): pin image_gen to the validated host and cover the redirect boundary (#10046)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-tools/src/image_gen.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-providers/src/router.rs crates/zeroclaw-providers/src/router.rs:224— crates/zeroclaw-providers/src/router.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is RouterModelProvider::resolve_cost_optimized at line 224), 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(runtime): recover from rejected image requests (#10480)”; “fix(providers): name the fallback that lacks vision in capability errors (#10028)”; “fix(providers): complete lifecycle provider accounting (#10144)”; “fix(delegate): honor configured provider fallbacks (#9544)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-providers/src/router.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-providers/src/openrouter.rs crates/zeroclaw-providers/src/openrouter.rs:880— crates/zeroclaw-providers/src/openrouter.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is OpenRouterModelProvider::stream_chat at line 880), 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(tools): declare tool attachments explicitly instead of scanning tool text for image markers (#10938)”; “fix(providers): retry the stream-failed entry when the stream failed before send (#11170)”; “fix(providers): keep OpenRouter streams alive (#10442)”; “fix(providers): replace unsupported native env var guidance in missing-credential errors (#9193)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-providers/src/openrouter.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/agent/cost.rs crates/zeroclaw-runtime/src/agent/cost.rs:256— crates/zeroclaw-runtime/src/agent/cost.rs changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is zeroclaw_runtime::agent::cost::unpriced_usage at line 256), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cost): surface pricing-unavailable so silent /bin/zsh caps can't reassure (#9939)”; “fix(providers): complete lifecycle provider accounting (#10144)”; “fix(cost): preserve full provider ref so multi-alias pricing resolves (#9938)”; “fix(runtime): reject semantic-empty terminal completions (#9424)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/cost.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-infra/src/session_store.rs crates/zeroclaw-infra/src/session_store.rs:117— crates/zeroclaw-infra/src/session_store.rs changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is SessionStore::load at line 117), 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(infra): replace JSONL session files that a reader holds open on Windows (#11398)”; “fix(infra): align JSONL session file validation (#9873)”; “fix(tests): fix Windows platform test failures (#10208)”; “fix(infra): make JSONL session migration retry-safe (#9715)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-infra/src/session_store.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-providers/src/vision_override.rs crates/zeroclaw-providers/src/vision_override.rs:60— crates/zeroclaw-providers/src/vision_override.rs changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is VisionOverrideProvider::capabilities at line 60), 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(runtime): recover from rejected image requests (#10480)”; “fix(providers): name the fallback that lacks vision in capability errors (#10028)”; “fix(providers): complete lifecycle provider accounting (#10144)”; “fix(delegate): honor configured provider fallbacks (#9544)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-providers/src/vision_override.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-runtime/src/approval/mod.rs crates/zeroclaw-runtime/src/approval/mod.rs:239— crates/zeroclaw-runtime/src/approval/mod.rs changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is ApprovalManager::approval_requirement at line 239), 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(approval): preserve CLI input failure provenance (#11518)”; “fix(channels): restore supervised shell approval routing (#10241)”; “fix(runtime): enforce bounded child tool approvals (#10937)”; “fix(approval): always_ask survives Full autonomy (#9724)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/approval/mod.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-providers/src/model_pin.rs crates/zeroclaw-providers/src/model_pin.rs:85— crates/zeroclaw-providers/src/model_pin.rs changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is ModelPinnedProvider::has_stable_request_identity at line 85), 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(runtime): recover from rejected image requests (#10480)”; “fix(providers): name the fallback that lacks vision in capability errors (#10028)”; “fix(providers): complete lifecycle provider accounting (#10144)”; “fix(delegate): honor configured provider fallbacks (#9544)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 23:47:30 +00:00' --until='2026-10-24 23:47:30 +00:00' --full-history --no-merges -- crates/zeroclaw-providers/src/model_pin.rs`: 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.
ClassTooLong: RpcDispatcher crates/zeroclaw-runtime/src/rpc/dispatch.rs:1129— ClassTooLong — 7439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 225 methods, 4 blocks, lines 1129-13032. The bar is 400 significant lines; this is 7039 over it, 18.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SopEngine crates/zeroclaw-runtime/src/sop/engine.rs:31— ClassTooLong — 4131 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 201 methods, 2 blocks, lines 31-6900. The bar is 400 significant lines; this is 3731 over it, 10.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: App apps/zerocode/src/config_manager.rs:444— ClassTooLong — 3887 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 126 methods, 5 blocks, lines 444-6051. The bar is 400 significant lines; this is 3487 over it, 9.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Config crates/zeroclaw-config/src/schema.rs:146— ClassTooLong — 3495 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 103 methods, 5 blocks, lines 146-26735. The bar is 400 significant lines; this is 3095 over it, 8.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: DelegateTool crates/zeroclaw-runtime/src/tools/delegate.rs:268— ClassTooLong — 3242 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 102 methods, 5 blocks, lines 268-5331. The bar is 400 significant lines; this is 2842 over it, 8.11× 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: DiscordChannel crates/zeroclaw-channels/src/discord/mod.rs:69— ClassTooLong — 2161 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 36 methods, 4 blocks, lines 69-4222. The bar is 400 significant lines; this is 1761 over it, 5.40× 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: SqliteMemory crates/zeroclaw-memory/src/sqlite.rs:35— ClassTooLong — 2045 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 43 methods, 5 blocks, lines 35-2801. The bar is 400 significant lines; this is 1645 over it, 5.11× 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: AcpSessionStore REDACTED:70— ClassTooLong — 2043 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 74 methods, 2 blocks, lines 70-3101. The bar is 400 significant lines; this is 1643 over it, 5.11× 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: OpenAiCompatibleModelProvider crates/zeroclaw-providers/src/compatible.rs:48— ClassTooLong — 2024 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 50 methods, 5 blocks, lines 48-5215. The bar is 400 significant lines; this is 1624 over it, 5.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.
ClassTooLong: AcpServer crates/zeroclaw-channels/src/orchestrator/acp_server.rs:128— ClassTooLong — 1946 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 59 methods, 2 blocks, lines 128-3247. The bar is 400 significant lines; this is 1546 over it, 4.87× 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: Dashboard apps/zerocode/src/dashboard.rs:95— ClassTooLong — 1873 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 64 methods, 3 blocks, lines 95-2743. The bar is 400 significant lines; this is 1473 over it, 4.68× 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: WeChatChannel crates/zeroclaw-channels/src/wechat.rs:714— ClassTooLong — 1698 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 50 methods, 4 blocks, lines 714-3527. The bar is 400 significant lines; this is 1298 over it, 4.25× 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: AnthropicModelProvider crates/zeroclaw-providers/src/anthropic.rs:87— ClassTooLong — 1667 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 51 methods, 4 blocks, lines 87-3571. The bar is 400 significant lines; this is 1267 over it, 4.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: GitOperationsTool crates/zeroclaw-tools/src/git_operations.rs:51— ClassTooLong — 1512 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 49 methods, 3 blocks, lines 51-2180. The bar is 400 significant lines; this is 1112 over it, 3.78× 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: SopPane REDACTED:22— ClassTooLong — 1238 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 64 methods, 3 blocks, lines 22-2232. The bar is 400 significant lines; this is 838 over it, 3.10× 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: MattermostChannel crates/zeroclaw-channels/src/mattermost.rs:306— ClassTooLong — 1237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 6 blocks, lines 306-2324. The bar is 400 significant lines; this is 837 over it, 3.09× 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: WebSearchTool crates/zeroclaw-tools/src/web_search_tool.rs:214— ClassTooLong — 1216 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 44 methods, 3 blocks, lines 214-2422. The bar is 400 significant lines; this is 816 over it, 3.04× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: InputBarState apps/zerocode/src/input_bar.rs:699— ClassTooLong — 1211 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 71 methods, 3 blocks, lines 699-2611. The bar is 400 significant lines; this is 811 over it, 3.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: RusqliteStore crates/zeroclaw-channels/src/whatsapp_storage.rs:35— ClassTooLong — 1175 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 2 methods, 7 blocks, lines 35-1792. The bar is 400 significant lines; this is 775 over it, 2.94× 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: SqliteSessionBackend crates/zeroclaw-infra/src/session_sqlite.rs:20— ClassTooLong — 1166 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 16 methods, 3 blocks, lines 20-1685. The bar is 400 significant lines; this is 766 over it, 2.92× 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: ModelRoutingConfigTool crates/zeroclaw-tools/src/model_routing_config.rs:82— ClassTooLong — 1144 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 32 methods, 3 blocks, lines 82-1750. The bar is 400 significant lines; this is 744 over it, 2.86× 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: WeComWsChannel crates/zeroclaw-channels/src/wecom_ws.rs:286— ClassTooLong — 1111 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 25 methods, 4 blocks, lines 286-1860. The bar is 400 significant lines; this is 711 over it, 2.78× 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: ZerocodePane apps/zerocode/src/zerocode_pane.rs:137— ClassTooLong — 1037 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 62 methods, 2 blocks, lines 137-1854. The bar is 400 significant lines; this is 637 over it, 2.59× 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: QuickstartPane apps/zerocode/src/quickstart_pane.rs:1090— ClassTooLong — 1036 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 3 blocks, lines 1090-2565. The bar is 400 significant lines; this is 636 over it, 2.59× 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: QQChannel crates/zeroclaw-channels/src/qq.rs:295— ClassTooLong — 1036 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 38 methods, 4 blocks, lines 295-1880. The bar is 400 significant lines; this is 636 over it, 2.59× 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.
zeroclaw_channels::orchestrator::process_channel_message_body (cognitive 344) crates/zeroclaw-channels/src/orchestrator/mod.rs:9263— zeroclaw_channels::orchestrator::process_channel_message_body has cognitive complexity 344 (threshold 15). Drivers by points: if/else 138 (254 pts), boolean chains 40, match/switch 17 (40 pts), loops 4 (10 pts) (nesting depth added 145). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::orchestrator::collect_configured_channels_with_authority (cognitive 239) crates/zeroclaw-channels/src/orchestrator/mod.rs:14691— zeroclaw_channels::orchestrator::collect_configured_channels_with_authority has cognitive complexity 239 (threshold 15). Drivers by points: if/else 112 (189 pts), loops 32, match/switch 7 (15 pts), boolean chains 3 (nesting depth added 85). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::line::handle_webhook (cognitive 146) crates/zeroclaw-channels/src/line.rs:294— zeroclaw_channels::line::handle_webhook has cognitive complexity 146 (threshold 15). Drivers by points: if/else 30 (110 pts), match/switch 13 (34 pts), boolean chains 1, loops 1 (nesting depth added 101). 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.
zeroclaw_channels::orchestrator::start_channels_with_authority_and_plugin_webhooks (cognitive 142) crates/zeroclaw-channels/src/orchestrator/mod.rs:16966— zeroclaw_channels::orchestrator::start_channels_with_authority_and_plugin_webhooks has cognitive complexity 142 (threshold 15). Drivers by points: if/else 50 (105 pts), loops 11 (26 pts), match/switch 3 (6 pts), boolean chains 5 (nesting depth added 73). 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.
zeroclaw_channels::orchestrator::run_message_dispatch_loop_until_cancelled (cognitive 99) crates/zeroclaw-channels/src/orchestrator/mod.rs:12275— zeroclaw_channels::orchestrator::run_message_dispatch_loop_until_cancelled has cognitive complexity 99 (threshold 15). Drivers by points: if/else 22 (50 pts), match/switch 8 (26 pts), loops 6 (15 pts), boolean chains 8 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::orchestrator::handle_runtime_command_for_delivery (cognitive 46) crates/zeroclaw-channels/src/orchestrator/mod.rs:5244— zeroclaw_channels::orchestrator::handle_runtime_command_for_delivery has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (31 pts), match/switch 5 (10 pts), boolean chains 5 (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.
zeroclaw_channels::matrix::inbound::handle_message (cognitive 42) crates/zeroclaw-channels/src/matrix.rs:2279— zeroclaw_channels::matrix::inbound::handle_message has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (29 pts), match/switch 4 (8 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::util::strip_tool_call_tags (cognitive 40) crates/zeroclaw-channels/src/util.rs:188— zeroclaw_channels::util::strip_tool_call_tags has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, loops 6, match/switch 2 (3 pts) (nesting depth added 13). Most of this is not in the body itself: 15 of the 40 points are its own statements and the rest belongs to 5 function items inside it that branch (extract_first_json_end, looks_like_prose, strip_leading_close_tags, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
zeroclaw_channels::discord::process_attachments (cognitive 37) crates/zeroclaw-channels/src/discord/mod.rs:1207— zeroclaw_channels::discord::process_attachments has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 7 (17 pts), boolean chains 2, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::lark::parse_post_content_details (cognitive 37) crates/zeroclaw-channels/src/lark.rs:4074— zeroclaw_channels::lark::parse_post_content_details has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (6 pts), match/switch 1 (5 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::orchestrator::strip_tool_call_tags (cognitive 37) crates/zeroclaw-channels/src/orchestrator/mod.rs:1936— zeroclaw_channels::orchestrator::strip_tool_call_tags has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 6, loops 6, match/switch 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 4 function items inside it that branch (extract_first_json_end, looks_like_prose, strip_leading_close_tags, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
zeroclaw_channels::orchestrator::run_matrix_single_message_draft_updater (cognitive 36) crates/zeroclaw-channels/src/orchestrator/mod.rs:8942— zeroclaw_channels::orchestrator::run_matrix_single_message_draft_updater has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 4 (8 pts), loops 3 (6 pts), boolean chains 5 (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.
zeroclaw_channels::orchestrator::strip_isolated_tool_json_artifacts (cognitive 33) crates/zeroclaw-channels/src/orchestrator/mod.rs:7540— zeroclaw_channels::orchestrator::strip_isolated_tool_json_artifacts has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 2, boolean chains 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_channels::orchestrator::dispatch_channel_sop_gate (cognitive 33) crates/zeroclaw-channels/src/orchestrator/mod.rs:11875— zeroclaw_channels::orchestrator::dispatch_channel_sop_gate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (19 pts), match/switch 8 (12 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
zeroclaw_channels::irc::split_message (cognitive 32) crates/zeroclaw-channels/src/irc.rs:151— zeroclaw_channels::irc::split_message has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 5 (12 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::discord::markers::repair_brackets (cognitive 30) crates/zeroclaw-channels/src/discord/markers.rs:670— zeroclaw_channels::discord::markers::repair_brackets has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 3 (9 pts), loops 3 (5 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::whatsapp_web::parse_link_destination (cognitive 28) crates/zeroclaw-channels/src/whatsapp_web.rs:3398— zeroclaw_channels::whatsapp_web::parse_link_destination has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4 (7 pts), match/switch 3 (7 pts), boolean chains 5 (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.
zeroclaw_channels::matrix::outbound::deliver_attachments (cognitive 26) crates/zeroclaw-channels/src/matrix.rs:3500— zeroclaw_channels::matrix::outbound::deliver_attachments has cognitive complexity 26 (threshold 15). Drivers by points: match/switch 7 (17 pts), if/else 5 (7 pts), loops 2 (nesting depth added 12). 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.
zeroclaw_channels::matrix::outbound::opus_duration (cognitive 26) crates/zeroclaw-channels/src/matrix.rs:4077— zeroclaw_channels::matrix::outbound::opus_duration has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::orchestrator::run_draft_updater_with_leak_detection (cognitive 25) crates/zeroclaw-channels/src/orchestrator/mod.rs:6449— zeroclaw_channels::orchestrator::run_draft_updater_with_leak_detection has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (22 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_channels::wecom_ws::extract_quote_context (cognitive 25) crates/zeroclaw-channels/src/wecom_ws.rs:2482— zeroclaw_channels::wecom_ws::extract_quote_context has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 1 (3 pts), match/switch 1 (nesting depth added 15). 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.
zeroclaw_channels::git::providers::gitea::provider::translate_to_gitea (cognitive 24) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:248— zeroclaw_channels::git::providers::gitea::provider::translate_to_gitea has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_channels::orchestrator::maybe_restart_managed_daemon_service (cognitive 24) crates/zeroclaw-channels/src/orchestrator/mod.rs:12985— zeroclaw_channels::orchestrator::maybe_restart_managed_daemon_service has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_channels::wecom_ws::strip_edge_mentions (cognitive 24) crates/zeroclaw-channels/src/wecom_ws.rs:2264— zeroclaw_channels::wecom_ws::strip_edge_mentions has cognitive complexity 24 (threshold 15). Drivers by points: loops 6 (10 pts), if/else 5 (8 pts), boolean chains 6 (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.
zeroclaw_channels::wecom_ws::split_markdown_chunks (cognitive 23) crates/zeroclaw-channels/src/wecom_ws.rs:2585— zeroclaw_channels::wecom_ws::split_markdown_chunks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (14 lines × 2) apps/zerocode/src/config_manager.rs:2559— apps/zerocode/src/config_manager.rs:2559-2572 | apps/zerocode/src/config_manager.rs:2681-2694 — both copies are in the same file, so extract the 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) apps/zerocode/src/config_manager.rs:3463— apps/zerocode/src/config_manager.rs:3463-3476 | apps/zerocode/src/config_manager.rs:3717-3731 — both copies are in the same file, so extract the 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) apps/zerocode/src/jsonrpc.rs:247— apps/zerocode/src/jsonrpc.rs:247-260 | crates/zeroclaw-api/src/jsonrpc.rs:376-389 — before extracting anything, compare `apps/zerocode/src/jsonrpc.rs` and `crates/zeroclaw-api/src/jsonrpc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/acp_channel.rs:98— crates/zeroclaw-channels/src/acp_channel.rs:98-111 | crates/zeroclaw-channels/src/acp_channel.rs:500-513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2641— crates/zeroclaw-channels/src/discord/mod.rs:2641-2654 | crates/zeroclaw-channels/src/discord/mod.rs:3053-3066 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/matrix.rs:4637— crates/zeroclaw-channels/src/matrix.rs:4637-4650 | crates/zeroclaw-channels/src/matrix.rs:4705-4718 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/telegram.rs:847— crates/zeroclaw-channels/src/telegram.rs:847-860 | crates/zeroclaw-channels/src/wechat.rs:305-318 — before extracting anything, compare `crates/zeroclaw-channels/src/telegram.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 158 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) crates/zeroclaw-channels/src/wecom_ws.rs:1135— crates/zeroclaw-channels/src/wecom_ws.rs:1135-1148 | crates/zeroclaw-channels/src/wecom_ws.rs:1170-1183 — both copies are in the same file, so extract the 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) crates/zeroclaw-channels/src/wecom_ws.rs:1207— crates/zeroclaw-channels/src/wecom_ws.rs:1207-1220 | crates/zeroclaw-channels/src/wecom_ws.rs:2528-2541 — both copies are in the same file, so extract the 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) crates/zeroclaw-hardware/src/gpio.rs:92— crates/zeroclaw-hardware/src/gpio.rs:92-105 | crates/zeroclaw-hardware/src/gpio.rs:195-208 — both copies are in the same file, so extract the 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) crates/zeroclaw-infra/src/session_sqlite.rs:637— crates/zeroclaw-infra/src/session_sqlite.rs:637-650 | crates/zeroclaw-infra/src/session_sqlite.rs: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.
Duplicated block (14 lines × 2) crates/zeroclaw-memory/src/knowledge_graph.rs:489— crates/zeroclaw-memory/src/knowledge_graph.rs:489-502 | crates/zeroclaw-memory/src/knowledge_graph.rs:522-535 — both copies are in the same file, so extract the 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) crates/zeroclaw-memory/src/sqlite.rs:772— crates/zeroclaw-memory/src/sqlite.rs:772-785 | crates/zeroclaw-memory/src/sqlite.rs:928-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.
Duplicated block (14 lines × 2) crates/zeroclaw-providers/src/auth/mod.rs:1271— crates/zeroclaw-providers/src/auth/mod.rs:1271-1284 | crates/zeroclaw-providers/src/auth/mod.rs:1526-1539 — both copies are in the same file, so extract the 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) crates/zeroclaw-providers/src/auth/mod.rs:1768— crates/zeroclaw-providers/src/auth/mod.rs:1768-1781 | crates/zeroclaw-providers/src/auth/mod.rs:1832-1845 — both copies are in the same file, so extract the 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) crates/zeroclaw-providers/src/auth/mod.rs:1783— crates/zeroclaw-providers/src/auth/mod.rs:1783-1796 | crates/zeroclaw-providers/src/auth/mod.rs:1848-1861 — both copies are in the same file, so extract the 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) crates/zeroclaw-providers/src/dispatch.rs:911— crates/zeroclaw-providers/src/dispatch.rs:911-924 | crates/zeroclaw-providers/src/dispatch.rs:1293-1306 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/agent/agent.rs:1857— crates/zeroclaw-runtime/src/agent/agent.rs:1857-1870 | crates/zeroclaw-runtime/src/agent/agent.rs:3977-3990 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/agent/loop_.rs:2430— crates/zeroclaw-runtime/src/agent/loop_.rs:2430-2443 | crates/zeroclaw-runtime/src/agent/loop_.rs:3108-3121 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/daemon/mod.rs:491— crates/zeroclaw-runtime/src/daemon/mod.rs:491-504 | crates/zeroclaw-runtime/src/daemon/mod.rs:526-539 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/rpc/dispatch.rs:10107— crates/zeroclaw-runtime/src/rpc/dispatch.rs:10107-10120 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:10216-10229 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/rpc/session.rs:1662— crates/zeroclaw-runtime/src/rpc/session.rs:1662-1675 | crates/zeroclaw-runtime/src/rpc/session.rs:2275-2288 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/skills/mod.rs:2982— crates/zeroclaw-runtime/src/skills/mod.rs:2982-2995 | crates/zeroclaw-runtime/src/skills/mod.rs:3197-3210 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/skills/mod.rs:3159— crates/zeroclaw-runtime/src/skills/mod.rs:3159-3172 | crates/zeroclaw-runtime/src/skills/mod.rs:3281-3294 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/sop/engine.rs:5468— crates/zeroclaw-runtime/src/sop/engine.rs:5468-5481 | crates/zeroclaw-runtime/src/sop/engine.rs:5560-5573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
zeroclaw_runtime::agent::turn::run_tool_call_loop_impl (cyclomatic 142) crates/zeroclaw-runtime/src/agent/turn/mod.rs:1615— zeroclaw_runtime::agent::turn::run_tool_call_loop_impl has cyclomatic complexity 142 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::loop_::run (cyclomatic 115) crates/zeroclaw-runtime/src/agent/loop_.rs:1526— zeroclaw_runtime::agent::loop_::run has cyclomatic complexity 115 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::tools::all_tools_with_runtime_on_thread (cyclomatic 110) crates/zeroclaw-runtime/src/tools/mod.rs:1548— zeroclaw_runtime::tools::all_tools_with_runtime_on_thread has cyclomatic complexity 110 (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.
zeroclaw_runtime::agent::turn::stream_consume::consume_provider_streaming_response_with_policy (cyclomatic 95) crates/zeroclaw-runtime/src/agent/turn/stream_consume.rs:121— zeroclaw_runtime::agent::turn::stream_consume::consume_provider_streaming_response_with_policy has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::identity::aieos_to_system_prompt (cyclomatic 70) crates/zeroclaw-runtime/src/identity.rs:719— zeroclaw_runtime::identity::aieos_to_system_prompt has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered (cyclomatic 55) crates/zeroclaw-runtime/src/sop/dispatch.rs:655— zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered has cyclomatic complexity 55 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zeroclaw_runtime::daemon::run_with_authority (cyclomatic 45) crates/zeroclaw-runtime/src/daemon/mod.rs:715— zeroclaw_runtime::daemon::run_with_authority has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::doctor::check_config_semantics (cyclomatic 45) crates/zeroclaw-runtime/src/doctor/mod.rs:1163— zeroclaw_runtime::doctor::check_config_semantics has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::sop::parse_steps (cyclomatic 45) crates/zeroclaw-runtime/src/sop/mod.rs:1309— zeroclaw_runtime::sop::parse_steps has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::turn::max_iter::finish_after_max_iterations (cyclomatic 41) crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:71— zeroclaw_runtime::agent::turn::max_iter::finish_after_max_iterations has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::turn::drive_live_sop_actions (cyclomatic 40) crates/zeroclaw-runtime/src/agent/turn/mod.rs:4049— zeroclaw_runtime::agent::turn::drive_live_sop_actions has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::turn::provider_call::call_provider (cyclomatic 38) crates/zeroclaw-runtime/src/agent/turn/provider_call.rs:302— zeroclaw_runtime::agent::turn::provider_call::call_provider has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::daemon::run_heartbeat_worker (cyclomatic 36) crates/zeroclaw-runtime/src/daemon/mod.rs:2379— zeroclaw_runtime::daemon::run_heartbeat_worker 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.
zeroclaw_runtime::agent::loop_::process_message_inner (cyclomatic 31) crates/zeroclaw-runtime/src/agent/loop_.rs:3614— zeroclaw_runtime::agent::loop_::process_message_inner has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_runtime::quickstart::apply_channels (cyclomatic 31) crates/zeroclaw-runtime/src/quickstart/mod.rs:1645— zeroclaw_runtime::quickstart::apply_channels has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::system_prompt::build_system_prompt_with_mode_and_effective_tools (cyclomatic 30) crates/zeroclaw-runtime/src/agent/system_prompt.rs:253— zeroclaw_runtime::agent::system_prompt::build_system_prompt_with_mode_and_effective_tools has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_runtime::quickstart::apply_model_provider (cyclomatic 27) crates/zeroclaw-runtime/src/quickstart/mod.rs:1233— zeroclaw_runtime::quickstart::apply_model_provider has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::turn::approval_gate::gate_tool_approval (cyclomatic 25) crates/zeroclaw-runtime/src/agent/turn/approval_gate.rs:22— zeroclaw_runtime::agent::turn::approval_gate::gate_tool_approval 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.
zeroclaw_runtime::agent::turn::call_prep::prepare_tool_calls (cyclomatic 23) crates/zeroclaw-runtime/src/agent/turn/call_prep.rs:130— zeroclaw_runtime::agent::turn::call_prep::prepare_tool_calls 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.
zeroclaw_runtime::sop::executor::drive_headless_run (cyclomatic 23) crates/zeroclaw-runtime/src/sop/executor.rs:876— zeroclaw_runtime::sop::executor::drive_headless_run has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
zeroclaw_runtime::skills::parse_simple_frontmatter (cyclomatic 22) crates/zeroclaw-runtime/src/skills/mod.rs:1451— zeroclaw_runtime::skills::parse_simple_frontmatter 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.
zeroclaw_runtime::sop::render_step_bullets (cyclomatic 22) crates/zeroclaw-runtime/src/sop/mod.rs:1681— zeroclaw_runtime::sop::render_step_bullets has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: SopStepSyntaxKey::bullet_prefixes (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
zeroclaw_runtime::agent::memory_inject::render_memory_context (cyclomatic 21) crates/zeroclaw-runtime/src/agent/memory_inject.rs:269— zeroclaw_runtime::agent::memory_inject::render_memory_context 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.
zeroclaw_runtime::agent_lifecycle::cascade_owned_state (cyclomatic 21) crates/zeroclaw-runtime/src/agent_lifecycle.rs:192— zeroclaw_runtime::agent_lifecycle::cascade_owned_state has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
zeroclaw_runtime::observability::otel_logs::otel_attributes (cyclomatic 21) crates/zeroclaw-runtime/src/observability/otel_logs.rs:192— zeroclaw_runtime::observability::otel_logs::otel_attributes has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: zeroclaw_runtime::observability::otel_logs::otel_severity (cyclomatic 24) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Duplicated block (13 lines × 2) apps/zerocode/src/client.rs:1840— apps/zerocode/src/client.rs:1840-1852 | apps/zerocode/src/client.rs:2134-2146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) apps/zerocode/src/logs.rs:1626— apps/zerocode/src/logs.rs:1626-1638 | apps/zerocode/src/logs.rs:1695-1707 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) apps/zerocode/src/wire.rs:210— apps/zerocode/src/wire.rs:210-222 | crates/zeroclaw-config/src/traits.rs:427-439 — 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 (13 lines × 2) crates/zeroclaw-api/src/elicitation.rs:133— crates/zeroclaw-api/src/elicitation.rs:133-145 | crates/zeroclaw-api/src/elicitation.rs:172-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-channels/src/lark.rs:1874— crates/zeroclaw-channels/src/lark.rs:1874-1886 | crates/zeroclaw-channels/src/lark.rs:2011-2023 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-channels/src/mochat.rs:155— crates/zeroclaw-channels/src/mochat.rs:155-167 | crates/zeroclaw-channels/src/twitter.rs:254-266 — before extracting anything, compare `crates/zeroclaw-channels/src/mochat.rs` and `crates/zeroclaw-channels/src/twitter.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) crates/zeroclaw-channels/src/slack.rs:1273— crates/zeroclaw-channels/src/slack.rs:1273-1285 | crates/zeroclaw-channels/src/slack.rs:1329-1341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-channels/src/telegram.rs:8035— crates/zeroclaw-channels/src/telegram.rs:8035-8047 | crates/zeroclaw-channels/src/telegram.rs:8061-8073 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-config/src/schema.rs:21708— crates/zeroclaw-config/src/schema.rs:21708-21720 | crates/zeroclaw-config/src/schema.rs:21723-21735 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-gateway/src/api_config.rs:1091— crates/zeroclaw-gateway/src/api_config.rs:1091-1103 | crates/zeroclaw-gateway/src/api_config.rs:2551-2563 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-gateway/src/api_sop_author.rs:441— crates/zeroclaw-gateway/src/api_sop_author.rs:441-453 | crates/zeroclaw-gateway/src/api_sop_author.rs:701-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.
Duplicated block (13 lines × 2) crates/zeroclaw-memory/src/sqlite.rs:1036— crates/zeroclaw-memory/src/sqlite.rs:1036-1048 | crates/zeroclaw-memory/src/sqlite.rs:2525-2537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-providers/src/gemini_cli.rs:255— crates/zeroclaw-providers/src/gemini_cli.rs:255-267 | crates/zeroclaw-providers/src/kilocli.rs:252-264 — before extracting anything, compare `crates/zeroclaw-providers/src/gemini_cli.rs` and `crates/zeroclaw-providers/src/kilocli.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) crates/zeroclaw-providers/src/glm.rs:225— crates/zeroclaw-providers/src/glm.rs:225-237 | crates/zeroclaw-providers/src/telnyx.rs:246-258 — before extracting anything, compare `crates/zeroclaw-providers/src/glm.rs` and `crates/zeroclaw-providers/src/telnyx.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) crates/zeroclaw-providers/src/openai.rs:1380— crates/zeroclaw-providers/src/openai.rs:1380-1392 | crates/zeroclaw-providers/src/openai.rs:1454-1466 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:4072— crates/zeroclaw-runtime/src/agent/agent.rs:4072-4084 | crates/zeroclaw-runtime/src/agent/agent.rs:4628-4640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:394— crates/zeroclaw-runtime/src/agent/loop_.rs:394-406 | src/main.rs:105-117 — 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 (13 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:3013— crates/zeroclaw-runtime/src/agent/turn/mod.rs:3013-3025 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3045-3057 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:183— crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:183-195 | crates/zeroclaw-tool-call-parser/src/lib.rs:707-719 — 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 (13 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5901— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5901-5913 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5915-5927 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/rpc/session.rs:1642— crates/zeroclaw-runtime/src/rpc/session.rs:1642-1654 | crates/zeroclaw-runtime/src/rpc/session.rs:2257-2269 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:1280— crates/zeroclaw-runtime/src/skills/mod.rs:1280-1292 | crates/zeroclaw-runtime/src/skills/mod.rs:2928-2940 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:4602— crates/zeroclaw-runtime/src/sop/engine.rs:4602-4614 | crates/zeroclaw-runtime/src/sop/engine.rs:5663-5675 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-tools/src/file_write.rs:222— crates/zeroclaw-tools/src/file_write.rs:222-234 | crates/zeroclaw-tools/src/file_write.rs:242-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:121— crates/zeroclaw-tools/src/model_routing_config.rs:121-133 | crates/zeroclaw-tools/src/proxy_config.rs:50-62 — before extracting anything, compare `crates/zeroclaw-tools/src/model_routing_config.rs` and `crates/zeroclaw-tools/src/proxy_config.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
zeroclaw_config::policy::split_unquoted_segments (cognitive 89) crates/zeroclaw-config/src/policy.rs:1046— zeroclaw_config::policy::split_unquoted_segments has cognitive complexity 89 (threshold 15). Drivers by points: if/else 27 (80 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::policy::split_shell_words_with_metadata (cognitive 85) crates/zeroclaw-config/src/policy.rs:1218— zeroclaw_config::policy::split_shell_words_with_metadata has cognitive complexity 85 (threshold 15). Drivers by points: if/else 27 (69 pts), match/switch 4 (13 pts), boolean chains 2, loops 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::v2::synthesize_agent_brains (cognitive 57) crates/zeroclaw-config/src/schema/v2.rs:1958— zeroclaw_config::schema::v2::synthesize_agent_brains has cognitive complexity 57 (threshold 15). Drivers by points: if/else 22 (47 pts), match/switch 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 28). 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.
zeroclaw_config::policy::contains_unmodeled_shell_word_expansion (cognitive 52) crates/zeroclaw-config/src/policy.rs:2241— zeroclaw_config::policy::contains_unmodeled_shell_word_expansion has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (37 pts), boolean chains 9, match/switch 2 (5 pts), loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::policy::powershell_variables_are_simple (cognitive 45) crates/zeroclaw-config/src/policy.rs:2820— zeroclaw_config::policy::powershell_variables_are_simple has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 4 (8 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::policy::split_powershell_pipeline_syntax (cognitive 44) crates/zeroclaw-config/src/policy.rs:2665— zeroclaw_config::policy::split_powershell_pipeline_syntax has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (37 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::alias_refs::collect_provider_refs (cognitive 42) crates/zeroclaw-config/src/alias_refs.rs:996— zeroclaw_config::alias_refs::collect_provider_refs has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 8 (17 pts), match/switch 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::v2::source_identity_matches_inner (cognitive 42) crates/zeroclaw-config/src/schema/v2.rs:968— zeroclaw_config::schema::v2::source_identity_matches_inner has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 9, loops 1, match/switch 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_config::agent_bundle::plan_export (cognitive 40) crates/zeroclaw-config/src/agent_bundle.rs:290— zeroclaw_config::agent_bundle::plan_export has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 5 (6 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::v2::fold_providers_globals_into_models (cognitive 39) crates/zeroclaw-config/src/schema/v2.rs:1261— zeroclaw_config::schema::v2::fold_providers_globals_into_models has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (24 pts), match/switch 6 (8 pts), boolean chains 5, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::alias_refs::collect_channel_refs (cognitive 34) crates/zeroclaw-config/src/alias_refs.rs:1106— zeroclaw_config::alias_refs::collect_channel_refs has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 7 (10 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::policy::contains_unquoted_shell_variable_expansion (cognitive 34) crates/zeroclaw-config/src/policy.rs:2158— zeroclaw_config::policy::contains_unquoted_shell_variable_expansion has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (30 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::v2::rewrite_dangling_peer_group_agents (cognitive 34) crates/zeroclaw-config/src/schema/v2.rs:2273— zeroclaw_config::schema::v2::rewrite_dangling_peer_group_agents has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (25 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::alias_refs::collect_agent_refs (cognitive 33) crates/zeroclaw-config/src/alias_refs.rs:1195— zeroclaw_config::alias_refs::collect_agent_refs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 6 (10 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::validate_mcp_config (cognitive 30) crates/zeroclaw-config/src/schema.rs:11433— zeroclaw_config::schema::validate_mcp_config has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::alias_refs::rewrite_model_provider_refs (cognitive 28) crates/zeroclaw-config/src/alias_refs.rs:785— zeroclaw_config::alias_refs::rewrite_model_provider_refs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 6 (7 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.
zeroclaw_config::policy::contains_unquoted_single_ampersand (cognitive 26) crates/zeroclaw-config/src/policy.rs:1973— zeroclaw_config::policy::contains_unquoted_single_ampersand has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::policy::contains_unquoted_char (cognitive 26) crates/zeroclaw-config/src/policy.rs:2027— zeroclaw_config::policy::contains_unquoted_char has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::v2::normalize_provider_type (cognitive 26) crates/zeroclaw-config/src/schema/v2.rs:616— zeroclaw_config::schema::v2::normalize_provider_type has cognitive complexity 26 (threshold 15). Drivers by points: if/else 25, match/switch 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.
zeroclaw_config::schema_markdown::field_table (cognitive 26) crates/zeroclaw-config/src/schema_markdown.rs:206— zeroclaw_config::schema_markdown::field_table has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::alias_refs::rewrite_agent_refs (cognitive 25) crates/zeroclaw-config/src/alias_refs.rs:712— zeroclaw_config::alias_refs::rewrite_agent_refs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 5 (8 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.
zeroclaw_config::schema_markdown::type_label (cognitive 25) crates/zeroclaw-config/src/schema_markdown.rs:694— zeroclaw_config::schema_markdown::type_label has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::agent_bundle::collect_risk_flags (cognitive 23) crates/zeroclaw-config/src/agent_bundle.rs:1087— zeroclaw_config::agent_bundle::collect_risk_flags has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::ws_connect_via_proxy (cognitive 23) crates/zeroclaw-config/src/schema.rs:12349— zeroclaw_config::schema::ws_connect_via_proxy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_config::schema::resolve_ws_proxy_url (cognitive 22) crates/zeroclaw-config/src/schema.rs:12184— zeroclaw_config::schema::resolve_ws_proxy_url has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TooManyMethods: RpcDispatcher crates/zeroclaw-runtime/src/rpc/dispatch.rs:1129— TooManyMethods — 225 methods. The bar is 30 methods; this is 195 over it, 7.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: SopEngine crates/zeroclaw-runtime/src/sop/engine.rs:31— TooManyMethods — 201 methods. The bar is 30 methods; this is 171 over it, 6.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: TelegramChannel crates/zeroclaw-channels/src/telegram.rs:970— TooManyMethods — 172 methods. The bar is 30 methods; this is 142 over it, 5.73× 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: SlackChannel crates/zeroclaw-channels/src/slack.rs:124— TooManyMethods — 157 methods. The bar is 30 methods; this is 127 over it, 5.23× 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: ChatState apps/zerocode/src/chat.rs:9746— TooManyMethods — 135 methods. The bar is 30 methods; this is 105 over it, 4.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: App apps/zerocode/src/config_manager.rs:444— TooManyMethods — 126 methods. The bar is 30 methods; this is 96 over it, 4.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Chat apps/zerocode/src/chat.rs:502— TooManyMethods — 117 methods. The bar is 30 methods; this is 87 over it, 3.90× 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: Config crates/zeroclaw-config/src/schema.rs:146— TooManyMethods — 103 methods. The bar is 30 methods; this is 73 over it, 3.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: DelegateTool crates/zeroclaw-runtime/src/tools/delegate.rs:268— TooManyMethods — 102 methods. The bar is 30 methods; this is 72 over it, 3.40× 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: RpcClient apps/zerocode/src/client.rs:870— TooManyMethods — 97 methods. The bar is 30 methods; this is 67 over it, 3.23× 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: Agent crates/zeroclaw-runtime/src/agent/agent.rs:477— TooManyMethods — 94 methods. The bar is 30 methods; this is 64 over it, 3.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SessionStore crates/zeroclaw-runtime/src/rpc/session.rs:306— TooManyMethods — 92 methods. The bar is 30 methods; this is 62 over it, 3.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: AcpSessionStore REDACTED:70— TooManyMethods — 74 methods. The bar is 30 methods; this is 44 over it, 2.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InputBarState apps/zerocode/src/input_bar.rs:699— TooManyMethods — 71 methods. The bar is 30 methods; this is 41 over it, 2.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Dashboard apps/zerocode/src/dashboard.rs:95— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SopPane REDACTED:22— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ZerocodePane apps/zerocode/src/zerocode_pane.rs:137— TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.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: WhatsAppWebChannel crates/zeroclaw-channels/src/whatsapp_web.rs:357— TooManyMethods — 60 methods. The bar is 30 methods; this is 30 over it, 2.00× 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: AcpServer crates/zeroclaw-channels/src/orchestrator/acp_server.rs:128— TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× 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: LarkChannel crates/zeroclaw-channels/src/lark.rs:725— TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× 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: Logs apps/zerocode/src/logs.rs:534— TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× 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: AnthropicModelProvider crates/zeroclaw-providers/src/anthropic.rs:87— TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WeChatChannel crates/zeroclaw-channels/src/wechat.rs:714— TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.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.
TooManyMethods: OpenAiCompatibleModelProvider crates/zeroclaw-providers/src/compatible.rs:48— TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.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.
TooManyMethods: SecurityPolicy crates/zeroclaw-config/src/policy.rs:321— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× 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.
zeroclaw::async_main_inner (cognitive 888) src/main.rs:9516— zeroclaw::async_main_inner has cognitive complexity 888 (threshold 15). Drivers by points: if/else 242 (575 pts), match/switch 59 (182 pts), loops 35 (105 pts), boolean chains 26 (nesting depth added 526). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::run_quickstart_cli (cognitive 353) src/main.rs:1779— zeroclaw::run_quickstart_cli has cognitive complexity 353 (threshold 15). Drivers by points: if/else 87 (275 pts), match/switch 22 (45 pts), loops 7 (20 pts), boolean chains 13 (nesting depth added 224). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::skills::handle_command (cognitive 95) src/skills/mod.rs:56— zeroclaw::skills::handle_command has cognitive complexity 95 (threshold 15). Drivers by points: if/else 32 (65 pts), loops 5 (15 pts), match/switch 5 (11 pts), boolean chains 4 (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.
zeroclaw::cron::handle_command (cognitive 76) src/cron/mod.rs:133— zeroclaw::cron::handle_command has cognitive complexity 76 (threshold 15). Drivers by points: if/else 34 (67 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 36). 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.
zeroclaw::sop::handle_command (cognitive 61) src/sop/mod.rs:7— zeroclaw::sop::handle_command has cognitive complexity 61 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 6 (16 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 35). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
zeroclaw::run_plugin_update (cognitive 35) src/main.rs:6413— zeroclaw::run_plugin_update has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 5, loops 3 (5 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
zeroclaw::tokenize_exec_line (cognitive 34) src/main.rs:9107— zeroclaw::tokenize_exec_line has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (9 pts), match/switch 2 (9 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::handle_auth_command (cognitive 34) src/main.rs:15372— zeroclaw::handle_auth_command has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 4 (7 pts), loops 3 (6 pts) (nesting depth added 16). 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.
zeroclaw::channel_instance_readiness_lines_with_admission (cognitive 32) src/main.rs:4701— zeroclaw::channel_instance_readiness_lines_with_admission has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 1 (4 pts), boolean chains 3, 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.
zeroclaw::quickstart_plugins::install_one (cognitive 30) REDACTED:1314— zeroclaw::quickstart_plugins::install_one has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 7 (9 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
zeroclaw::alias_cli::handle_providers (cognitive 29) src/alias_cli/mod.rs:912— zeroclaw::alias_cli::handle_providers has cognitive complexity 29 (threshold 15). Drivers by points: loops 3 (12 pts), if/else 3 (10 pts), match/switch 3 (6 pts), boolean chains 1 (nesting depth added 19). 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.
zeroclaw::issue_wss_client_cert (cognitive 29) src/main.rs:8108— zeroclaw::issue_wss_client_cert has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 5, 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.
zeroclaw::update_one_plugin (cognitive 25) src/main.rs:6812— zeroclaw::update_one_plugin has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 7 (9 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::quickstart_plugins::collect_settings (cognitive 25) REDACTED:2062— zeroclaw::quickstart_plugins::collect_settings has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (6 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::alias_cli::handle_agents (cognitive 23) src/alias_cli/mod.rs:566— zeroclaw::alias_cli::handle_agents has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 4 (7 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
zeroclaw::alias_cli::export::copy_tree (cognitive 23) src/alias_cli/export.rs:1240— zeroclaw::alias_cli::export::copy_tree has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::commands::update::install_companion_artifacts (cognitive 23) src/commands/update.rs:997— zeroclaw::commands::update::install_companion_artifacts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 3 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::sop_admin_request (cognitive 21) src/main.rs:14381— zeroclaw::sop_admin_request has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
zeroclaw::prompt_for_field (cognitive 20) src/main.rs:3286— zeroclaw::prompt_for_field has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::peripherals::handle_command (cognitive 19) src/peripherals/mod.rs:9— zeroclaw::peripherals::handle_command has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
zeroclaw::skills::discovery::extract_zip (cognitive 19) src/skills/discovery.rs:574— zeroclaw::skills::discovery::extract_zip has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::handle_estop_command (cognitive 18) src/main.rs:14025— zeroclaw::handle_estop_command has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::handle_oidc_command (cognitive 18) src/main.rs:15210— zeroclaw::handle_oidc_command has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::quickstart_plugins::keep_installed (cognitive 18) REDACTED:1623— zeroclaw::quickstart_plugins::keep_installed has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw::existing_egress_grant_lines (cognitive 17) src/main.rs:4160— zeroclaw::existing_egress_grant_lines has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Duplicated block (9 lines × 3) apps/zerocode/src/file_explorer.rs:304— apps/zerocode/src/file_explorer.rs:304-312 | apps/zerocode/src/file_explorer.rs:378-386 | apps/zerocode/src/file_explorer.rs:446-454 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/discord/markers.rs:21— crates/zeroclaw-channels/src/discord/markers.rs:21-29 | crates/zeroclaw-channels/src/telegram.rs:742-750 | crates/zeroclaw-channels/src/wechat.rs:113-121 — before extracting anything, compare `crates/zeroclaw-channels/src/telegram.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 158 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/matrix.rs:3550— crates/zeroclaw-channels/src/matrix.rs:3550-3559 | crates/zeroclaw-channels/src/matrix.rs:3569-3578 | crates/zeroclaw-channels/src/slack.rs:3344-3352 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:950— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:950-958 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1184-1192 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1521-1529 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1045— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1045-1053 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1393-1401 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1686-1694 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1101— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1101-1109 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1416-1424 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1709-1717 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/slack.rs:4607— crates/zeroclaw-channels/src/slack.rs:4607-4615 | crates/zeroclaw-channels/src/slack.rs:6052-6060 | crates/zeroclaw-channels/src/slack.rs:6171-6179 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-gateway/src/api_config.rs:1484— crates/zeroclaw-gateway/src/api_config.rs:1484-1492 | crates/zeroclaw-gateway/src/api_config.rs:1778-1788 | crates/zeroclaw-gateway/src/api_config.rs:2121-2131 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-hardware/src/rpi.rs:413— crates/zeroclaw-hardware/src/rpi.rs:413-421 | crates/zeroclaw-hardware/src/rpi.rs:497-505 | crates/zeroclaw-hardware/src/rpi.rs:607-615 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-log/src/reader.rs:810— crates/zeroclaw-log/src/reader.rs:810-822 | crates/zeroclaw-log/src/reader.rs:1007-1015 | crates/zeroclaw-log/src/reader.rs:1073-1081 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-macros/src/lib.rs:562— crates/zeroclaw-macros/src/lib.rs:562-570 | crates/zeroclaw-macros/src/lib.rs:992-1000 | crates/zeroclaw-macros/src/lib.rs:1689-1698 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-macros/src/lib.rs:1454— crates/zeroclaw-macros/src/lib.rs:1454-1462 | crates/zeroclaw-macros/src/lib.rs:1479-1487 | crates/zeroclaw-macros/src/lib.rs:1506-1514 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-macros/src/lib.rs:1887— crates/zeroclaw-macros/src/lib.rs:1887-1895 | crates/zeroclaw-macros/src/lib.rs:1908-1916 | crates/zeroclaw-macros/src/lib.rs:1929-1938 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-providers/src/glm.rs:201— crates/zeroclaw-providers/src/glm.rs:201-209 | crates/zeroclaw-providers/src/openrouter.rs:696-704 | crates/zeroclaw-providers/src/telnyx.rs:211-219 — before extracting anything, compare `crates/zeroclaw-providers/src/glm.rs` and `crates/zeroclaw-providers/src/telnyx.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-providers/src/glm.rs:256— crates/zeroclaw-providers/src/glm.rs:256-264 | crates/zeroclaw-providers/src/openrouter.rs:769-777 | crates/zeroclaw-providers/src/telnyx.rs:278-286 — before extracting anything, compare `crates/zeroclaw-providers/src/glm.rs` and `crates/zeroclaw-providers/src/telnyx.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 68 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/agent/agent.rs:1864— crates/zeroclaw-runtime/src/agent/agent.rs:1864-1872 | crates/zeroclaw-runtime/src/agent/agent.rs:2154-2162 | crates/zeroclaw-runtime/src/agent/agent.rs:3984-3992 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/daemon/mod.rs:1188— crates/zeroclaw-runtime/src/daemon/mod.rs:1188-1196 | crates/zeroclaw-runtime/src/daemon/mod.rs:1213-1221 | crates/zeroclaw-runtime/src/daemon/mod.rs:1238-1246 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/tools/mod.rs:1981— crates/zeroclaw-runtime/src/tools/mod.rs:1981-1989 | crates/zeroclaw-runtime/src/tools/mod.rs:2029-2037 | crates/zeroclaw-runtime/src/tools/mod.rs:2134-2142 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-tools/src/file_download.rs:579— crates/zeroclaw-tools/src/file_download.rs:579-587 | crates/zeroclaw-tools/src/http_request.rs:598-609 | crates/zeroclaw-tools/src/web_fetch.rs:464-475 — before extracting anything, compare `crates/zeroclaw-tools/src/http_request.rs` and `crates/zeroclaw-tools/src/web_fetch.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:2773— crates/zeroclaw-channels/src/discord/mod.rs:2773-2785 | crates/zeroclaw-channels/src/discord/mod.rs:2820-2830 | crates/zeroclaw-channels/src/discord/mod.rs:2874-2882 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/tools/cron_add.rs:474— crates/zeroclaw-runtime/src/tools/cron_add.rs:474-482 | crates/zeroclaw-runtime/src/tools/cron_update.rs:228-238 | crates/zeroclaw-tools/src/llm_task.rs:161-169 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/cron_add.rs` and `crates/zeroclaw-runtime/src/tools/cron_update.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-tools/src/jira_tool.rs:1122— crates/zeroclaw-tools/src/jira_tool.rs:1122-1131 | crates/zeroclaw-tools/src/jira_tool.rs:1179-1188 | crates/zeroclaw-tools/src/notion_tool.rs:262-270 — before extracting anything, compare `crates/zeroclaw-tools/src/jira_tool.rs` and `crates/zeroclaw-tools/src/notion_tool.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-tools/src/jira_tool.rs:1103— crates/zeroclaw-tools/src/jira_tool.rs:1103-1111 | crates/zeroclaw-tools/src/jira_tool.rs:1141-1149 | crates/zeroclaw-tools/src/notion_tool.rs:303-311 — before extracting anything, compare `crates/zeroclaw-tools/src/jira_tool.rs` and `crates/zeroclaw-tools/src/notion_tool.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-providers/src/auth/email_oauth2.rs:96— crates/zeroclaw-providers/src/auth/email_oauth2.rs:96-104 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:144-152 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:241-249 — before extracting anything, compare `crates/zeroclaw-providers/src/auth/email_oauth2.rs` and `crates/zeroclaw-providers/src/auth/openai_oauth.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/tts.rs:131— crates/zeroclaw-channels/src/tts.rs:131-139 | crates/zeroclaw-channels/src/tts.rs:261-269 | crates/zeroclaw-channels/src/tts.rs:972-980 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) apps/zerocode/src/app.rs:3319— apps/zerocode/src/app.rs:3319-3326 | apps/zerocode/src/dashboard.rs:1322-1329 | apps/zerocode/src/dashboard.rs:3212-3219 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 3) apps/zerocode/src/config_manager.rs:4683— apps/zerocode/src/config_manager.rs:4683-4690 | apps/zerocode/src/config_manager.rs:4837-4844 | apps/zerocode/src/config_manager.rs:5163-5170 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:2439— crates/zeroclaw-channels/src/discord/mod.rs:2439-2446 | crates/zeroclaw-channels/src/discord/mod.rs:2638-2645 | crates/zeroclaw-channels/src/discord/mod.rs:3050-3057 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/lark.rs:2460— crates/zeroclaw-channels/src/lark.rs:2460-2467 | crates/zeroclaw-channels/src/lark.rs:2508-2515 | crates/zeroclaw-channels/src/lark.rs:3702-3709 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/lark.rs:2649— crates/zeroclaw-channels/src/lark.rs:2649-2657 | crates/zeroclaw-channels/src/nextcloud_talk.rs:263-270 | crates/zeroclaw-channels/src/nextcloud_talk.rs:392-399 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1879— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1879-1887 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3107-3114 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3139-3147 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:10713— crates/zeroclaw-channels/src/orchestrator/mod.rs:10713-10720 | crates/zeroclaw-runtime/src/agent/loop_.rs:1294-1302 | crates/zeroclaw-runtime/src/agent/loop_.rs:3393-3400 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/voice_wake.rs:405— crates/zeroclaw-channels/src/voice_wake.rs:405-412 | crates/zeroclaw-memory/src/lib.rs:624-631 | crates/zeroclaw-runtime/src/skills/review.rs:221-228 — before extracting anything, compare `crates/zeroclaw-channels/src/voice_wake.rs` and `crates/zeroclaw-memory/src/lib.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 3) crates/zeroclaw-hardware/src/pico_code.rs:169— crates/zeroclaw-hardware/src/pico_code.rs:169-176 | crates/zeroclaw-hardware/src/pico_code.rs:290-297 | crates/zeroclaw-hardware/src/pico_code.rs:475-482 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-infra/src/session_store.rs:405— crates/zeroclaw-infra/src/session_store.rs:405-412 | crates/zeroclaw-runtime/src/doctor/mod.rs:566-573 | crates/zeroclaw-runtime/src/sop/mod.rs:801-808 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (8 lines × 3) crates/zeroclaw-log/src/writer.rs:828— crates/zeroclaw-log/src/writer.rs:828-835 | crates/zeroclaw-log/src/writer.rs:857-864 | crates/zeroclaw-log/src/writer.rs:887-894 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-macros/src/lib.rs:664— crates/zeroclaw-macros/src/lib.rs:664-671 | crates/zeroclaw-macros/src/lib.rs:700-707 | crates/zeroclaw-macros/src/lib.rs:751-759 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-memory/src/knowledge_graph.rs:381— crates/zeroclaw-memory/src/knowledge_graph.rs:381-388 | crates/zeroclaw-memory/src/knowledge_graph.rs:411-418 | crates/zeroclaw-memory/src/knowledge_graph.rs:441-448 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-providers/src/azure_openai.rs:547— crates/zeroclaw-providers/src/azure_openai.rs:547-554 | crates/zeroclaw-providers/src/azure_openai.rs:618-625 | crates/zeroclaw-providers/src/azure_openai.rs:683-690 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/agent/agent.rs:3926— crates/zeroclaw-runtime/src/agent/agent.rs:3926-3933 | crates/zeroclaw-runtime/src/agent/agent.rs:4372-4379 | crates/zeroclaw-runtime/src/agent/agent.rs:4454-4461 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:182— crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:182-189 | crates/zeroclaw-tool-call-parser/src/lib.rs:501-508 | crates/zeroclaw-tool-call-parser/src/lib.rs:706-713 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/observability/broadcast.rs:102— crates/zeroclaw-runtime/src/observability/broadcast.rs:102-109 | crates/zeroclaw-runtime/src/observability/broadcast.rs:126-133 | crates/zeroclaw-runtime/src/observability/broadcast.rs:146-153 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/service/mod.rs:3147— crates/zeroclaw-runtime/src/service/mod.rs:3147-3155 | crates/zeroclaw-runtime/src/service/mod.rs:3238-3245 | crates/zeroclaw-runtime/src/service/mod.rs:3266-3273 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:2620— crates/zeroclaw-runtime/src/sop/engine.rs:2620-2627 | crates/zeroclaw-runtime/src/sop/engine.rs:4911-4918 | crates/zeroclaw-runtime/src/sop/engine.rs:5781-5788 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-tools/src/file_write.rs:83— crates/zeroclaw-tools/src/file_write.rs:83-91 | crates/zeroclaw-tools/src/knowledge_tool.rs:188-195 | crates/zeroclaw-tools/src/memory_store.rs:62-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) crates/zeroclaw-tools/src/backup_tool.rs:803— crates/zeroclaw-tools/src/backup_tool.rs:803-810 | crates/zeroclaw-tools/src/data_management.rs:252-259 | crates/zeroclaw-tools/src/file_write.rs:342-349 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:384— crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:384-391 | crates/zeroclaw-tools/src/memory_store.rs:97-104 | crates/zeroclaw-tools/src/reaction.rs:188-198 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (8 lines × 3) crates/zeroclaw-memory/src/sqlite.rs:1963— crates/zeroclaw-memory/src/sqlite.rs:1963-1971 | crates/zeroclaw-memory/src/sqlite.rs:2031-2039 | crates/zeroclaw-memory/src/sqlite.rs:2156-2163 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/hooks/runner.rs:203— crates/zeroclaw-runtime/src/hooks/runner.rs:203-210 | crates/zeroclaw-runtime/src/hooks/runner.rs:230-237 | crates/zeroclaw-runtime/src/hooks/runner.rs:262-269 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/sop/metrics.rs:158— crates/zeroclaw-runtime/src/sop/metrics.rs:158-165 | crates/zeroclaw-runtime/src/sop/metrics.rs:184-191 | crates/zeroclaw-runtime/src/sop/metrics.rs:206-213 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-channels/src/discord/markers.rs:856— crates/zeroclaw-channels/src/discord/markers.rs:856-861 | crates/zeroclaw-channels/src/matrix.rs:3362-3367 | crates/zeroclaw-channels/src/whatsapp_web.rs:3119-3124 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 3) crates/zeroclaw-channels/src/matrix.rs:2266— crates/zeroclaw-channels/src/matrix.rs:2266-2271 | crates/zeroclaw-channels/src/matrix.rs:3725-3730 | crates/zeroclaw-channels/src/voice_wake.rs:474-482 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/voice_wake.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1210— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1210-1215 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1547-1552 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2414-2419 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:6516— crates/zeroclaw-channels/src/orchestrator/mod.rs:6516-6521 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6535-6543 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6566-6571 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:16742— crates/zeroclaw-channels/src/orchestrator/mod.rs:16742-16747 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16768-16773 | crates/zeroclaw-config/src/cost/tracker.rs:939-944 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) crates/zeroclaw-config/src/schema/v2.rs:2215— crates/zeroclaw-config/src/schema/v2.rs:2215-2220 | crates/zeroclaw-config/src/schema/v2.rs:2630-2635 | crates/zeroclaw-config/src/schema/v2.rs:2879-2884 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-gateway/src/api_plugins.rs:161— crates/zeroclaw-gateway/src/api_plugins.rs:161-166 | crates/zeroclaw-gateway/src/api_plugins.rs:230-235 | crates/zeroclaw-gateway/src/api_plugins.rs:251-256 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-gateway/src/lib.rs:1364— crates/zeroclaw-gateway/src/lib.rs:1364-1369 | crates/zeroclaw-runtime/src/cron/scheduler.rs:640-645 | crates/zeroclaw-runtime/src/cron/scheduler.rs:689-694 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 3) crates/zeroclaw-gateway/src/lib.rs:4754— crates/zeroclaw-gateway/src/lib.rs:4754-4759 | crates/zeroclaw-gateway/src/lib.rs:4884-4889 | crates/zeroclaw-gateway/src/lib.rs:5024-5029 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-hardware/src/peripherals/rpi.rs:98— crates/zeroclaw-hardware/src/peripherals/rpi.rs:98-103 | crates/zeroclaw-hardware/src/peripherals/serial.rs:268-273 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:98-103 — before extracting anything, compare `crates/zeroclaw-hardware/src/peripherals/serial.rs` and `crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) crates/zeroclaw-hardware/src/peripherals/rpi.rs:169— crates/zeroclaw-hardware/src/peripherals/rpi.rs:169-174 | crates/zeroclaw-hardware/src/peripherals/serial.rs:327-332 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:174-179 — before extracting anything, compare `crates/zeroclaw-hardware/src/peripherals/serial.rs` and `crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) REDACTED:1322— REDACTED:1322-1327 | REDACTED:1404-1409 | REDACTED:2910-2915 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-providers/src/compatible.rs:3500— crates/zeroclaw-providers/src/compatible.rs:3500-3505 | crates/zeroclaw-providers/src/hailo_ollama.rs:555-560 | crates/zeroclaw-providers/src/ollama.rs:409-414 — before extracting anything, compare `crates/zeroclaw-providers/src/hailo_ollama.rs` and `crates/zeroclaw-providers/src/ollama.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3555— crates/zeroclaw-runtime/src/rpc/dispatch.rs:3555-3560 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:3591-3596 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:3613-3618 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/sop/dispatch.rs:674— crates/zeroclaw-runtime/src/sop/dispatch.rs:674-679 | crates/zeroclaw-runtime/src/sop/dispatch.rs:736-741 | crates/zeroclaw-runtime/src/sop/dispatch.rs:786-791 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:1191— crates/zeroclaw-runtime/src/sop/engine.rs:1191-1196 | crates/zeroclaw-runtime/src/sop/engine.rs:6458-6465 | crates/zeroclaw-runtime/src/sop/engine.rs:6514-6520 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:2553— crates/zeroclaw-runtime/src/sop/engine.rs:2553-2558 | crates/zeroclaw-runtime/src/sop/engine.rs:2864-2869 | crates/zeroclaw-runtime/src/sop/engine.rs:5630-5635 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-tools/src/backup_tool.rs:1148— crates/zeroclaw-tools/src/backup_tool.rs:1148-1153 | crates/zeroclaw-tools/src/backup_tool.rs:1189-1194 | crates/zeroclaw-tools/src/backup_tool.rs:1289-1294 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-tools/src/cloud_ops.rs:57— crates/zeroclaw-tools/src/cloud_ops.rs:57-62 | crates/zeroclaw-tools/src/cloud_ops.rs:79-84 | crates/zeroclaw-tools/src/cloud_ops.rs:95-100 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-tools/src/linkedin_client.rs:88— crates/zeroclaw-tools/src/linkedin_client.rs:88-93 | crates/zeroclaw-tools/src/linkedin_client.rs:903-908 | crates/zeroclaw-tools/src/pushover.rs:63-68 — before extracting anything, compare `crates/zeroclaw-tools/src/linkedin_client.rs` and `crates/zeroclaw-tools/src/pushover.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) apps/zerocode/src/enroll.rs:206— apps/zerocode/src/enroll.rs:206-211 | crates/zeroclaw-runtime/src/enroll/mod.rs:623-628 | crates/zeroclaw-runtime/src/security/cert_ledger.rs:1483-1488 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) xtask/src/generate/mod.rs:177— xtask/src/generate/mod.rs:177-182 | xtask/src/generate/review_docs.rs:80-85 | xtask/src/generate/sop_syntax.rs:16-21 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 3) src/alias_cli/export.rs:808— src/alias_cli/export.rs:808-818 | src/alias_cli/export.rs:918-923 | src/alias_cli/export.rs:929-934 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:374— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:374-379 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:389-394 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:424-433 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:1272— crates/zeroclaw-channels/src/orchestrator/mod.rs:1272-1277 | crates/zeroclaw-channels/src/orchestrator/mod.rs:12603-12611 | crates/zeroclaw-gateway/src/lib.rs:3258-3263 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-gateway/src/lib.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 3) crates/zeroclaw-channels/src/line.rs:568— crates/zeroclaw-channels/src/line.rs:568-577 | crates/zeroclaw-channels/src/telegram.rs:4577-4583 | crates/zeroclaw-channels/src/wechat.rs:2584-2590 — before extracting anything, compare `crates/zeroclaw-channels/src/line.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/nextcloud_talk.rs:750— crates/zeroclaw-channels/src/nextcloud_talk.rs:750-758 | crates/zeroclaw-channels/src/telegram.rs:8105-8112 | src/commands/update.rs:303-309 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1132— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1132-1138 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1478-1484 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1760-1766 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/slack.rs:2185— crates/zeroclaw-channels/src/slack.rs:2185-2191 | crates/zeroclaw-channels/src/slack.rs:4819-4825 | crates/zeroclaw-channels/src/slack.rs:5052-5058 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/telegram.rs:2190— crates/zeroclaw-channels/src/telegram.rs:2190-2196 | crates/zeroclaw-channels/src/telegram.rs:2252-2258 | crates/zeroclaw-channels/src/telegram.rs:2330-2336 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/telegram.rs:2202— crates/zeroclaw-channels/src/telegram.rs:2202-2208 | crates/zeroclaw-channels/src/telegram.rs:2265-2271 | crates/zeroclaw-channels/src/telegram.rs:2344-2350 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/wechat.rs:1894— crates/zeroclaw-channels/src/wechat.rs:1894-1900 | crates/zeroclaw-channels/src/wechat.rs:1917-1923 | crates/zeroclaw-channels/src/wechat.rs:1933-1939 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-gateway/src/api_oidc.rs:383— crates/zeroclaw-gateway/src/api_oidc.rs:383-389 | crates/zeroclaw-gateway/src/api_oidc.rs:453-459 | crates/zeroclaw-gateway/src/api_oidc.rs:563-572 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-hardware/src/datasheet.rs:514— crates/zeroclaw-hardware/src/datasheet.rs:514-520 | crates/zeroclaw-hardware/src/datasheet.rs:566-572 | crates/zeroclaw-hardware/src/datasheet.rs:639-645 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-macros/src/lib.rs:1788— crates/zeroclaw-macros/src/lib.rs:1788-1794 | crates/zeroclaw-macros/src/lib.rs:1819-1826 | crates/zeroclaw-macros/src/lib.rs:1839-1845 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/agent/turn/mod.rs:4642— crates/zeroclaw-runtime/src/agent/turn/mod.rs:4642-4648 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:4682-4688 | crates/zeroclaw-runtime/src/sop/executor.rs:1213-1219 — before extracting anything, compare `crates/zeroclaw-runtime/src/agent/turn/mod.rs` and `crates/zeroclaw-runtime/src/sop/executor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 3) crates/zeroclaw-runtime/src/observability/log.rs:117— crates/zeroclaw-runtime/src/observability/log.rs:117-130 | crates/zeroclaw-runtime/src/observability/log.rs:141-150 | crates/zeroclaw-runtime/src/observability/log.rs:216-222 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5846— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5846-5852 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5901-5907 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5915-5921 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/skills/mod.rs:1249— crates/zeroclaw-runtime/src/skills/mod.rs:1249-1255 | crates/zeroclaw-runtime/src/skills/mod.rs:1287-1293 | crates/zeroclaw-runtime/src/skills/mod.rs:2935-2941 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:4154— crates/zeroclaw-runtime/src/sop/engine.rs:4154-4160 | crates/zeroclaw-runtime/src/sop/engine.rs:4743-4749 | crates/zeroclaw-runtime/src/sop/engine.rs:5189-5195 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-tools/src/linkedin_client.rs:288— crates/zeroclaw-tools/src/linkedin_client.rs:288-294 | crates/zeroclaw-tools/src/linkedin_client.rs:382-388 | crates/zeroclaw-tools/src/linkedin_client.rs:724-730 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-tools/src/linkedin_client.rs:315— crates/zeroclaw-tools/src/linkedin_client.rs:315-323 | crates/zeroclaw-tools/src/linkedin_client.rs:450-456 | crates/zeroclaw-tools/src/linkedin_client.rs:494-500 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-tools/src/microsoft365/auth.rs:165— crates/zeroclaw-tools/src/microsoft365/auth.rs:165-171 | crates/zeroclaw-tools/src/microsoft365/auth.rs:206-212 | crates/zeroclaw-tools/src/microsoft365/auth.rs:320-326 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/mattermost.rs:1215— crates/zeroclaw-channels/src/mattermost.rs:1215-1221 | crates/zeroclaw-channels/src/telegram.rs:8572-8578 | crates/zeroclaw-channels/src/wechat.rs:3467-3473 — before extracting anything, compare `crates/zeroclaw-channels/src/mattermost.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) crates/zeroclaw-providers/src/gemini_cli.rs:45— crates/zeroclaw-providers/src/gemini_cli.rs:45-51 | crates/zeroclaw-providers/src/grok_cli.rs:351-357 | crates/zeroclaw-providers/src/kilocli.rs:45-51 — before extracting anything, compare `crates/zeroclaw-providers/src/gemini_cli.rs` and `crates/zeroclaw-providers/src/kilocli.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/lark.rs:3589— crates/zeroclaw-channels/src/lark.rs:3589-3595 | crates/zeroclaw-channels/src/lark.rs:3608-3617 | crates/zeroclaw-channels/src/lark.rs:3626-3632 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/wechat.rs:1792— crates/zeroclaw-channels/src/wechat.rs:1792-1798 | crates/zeroclaw-runtime/src/sop/engine.rs:6263-6269 | crates/zeroclaw-runtime/src/sop/executor.rs:1151-1160 — before extracting anything, compare `crates/zeroclaw-runtime/src/sop/engine.rs` and `crates/zeroclaw-runtime/src/sop/executor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) REDACTED:1264— REDACTED:1264-1270 | REDACTED:1331-1337 | REDACTED:2919-2925 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 3) crates/zeroclaw-tools/src/ask_user.rs:102— crates/zeroclaw-tools/src/ask_user.rs:102-108 | crates/zeroclaw-tools/src/escalate.rs:188-194 | crates/zeroclaw-tools/src/poll.rs:198-204 — before extracting anything, compare `crates/zeroclaw-tools/src/ask_user.rs` and `crates/zeroclaw-tools/src/escalate.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/notion.rs:164— crates/zeroclaw-channels/src/notion.rs:164-170 | crates/zeroclaw-channels/src/qq.rs:568-574 | crates/zeroclaw-channels/src/qq.rs:598-604 — 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.
+ 4 more in this group — see findings.md.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×28
Members sharing a duplicated core (4 members, 50+ identical tokens) apps/zerocode/src/config_manager.rs:1544— apps/zerocode/src/config_manager.rs:1544-1556 | apps/zerocode/src/config_manager.rs:1626-1636 | apps/zerocode/src/config_manager.rs:3147-3283 | apps/zerocode/src/config_manager.rs:5022-5185 — 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) apps/zerocode/src/config_manager.rs:2409— apps/zerocode/src/config_manager.rs:2409-2451 | apps/zerocode/src/config_manager.rs:2489-2613 | apps/zerocode/src/config_manager.rs:3147-3283 | apps/zerocode/src/config_manager.rs:4377-4414 — 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) crates/zeroclaw-api/src/model_provider.rs:869— crates/zeroclaw-api/src/model_provider.rs:869-920 | crates/zeroclaw-providers/src/compatible.rs:3731-3753 | crates/zeroclaw-providers/src/hailo_ollama.rs:939-962 | crates/zeroclaw-providers/src/ollama.rs:501-523 — 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) crates/zeroclaw-channels/src/discord/mod.rs:3560— crates/zeroclaw-channels/src/discord/mod.rs:3560-3731 | crates/zeroclaw-channels/src/signal.rs:695-891 | crates/zeroclaw-runtime/src/security/landlock.rs:297-327 | crates/zeroclaw-tools/src/microsoft365/auth.rs:101-134 — 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) crates/zeroclaw-channels/src/git/channel.rs:458— crates/zeroclaw-channels/src/git/channel.rs:458-575 | crates/zeroclaw-memory/src/lib.rs:826-892 | crates/zeroclaw-runtime/src/daemon/mod.rs:725-1471 | crates/zeroclaw-runtime/src/sop/engine.rs:1712-1759 — 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) crates/zeroclaw-channels/src/gmail_push.rs:186— crates/zeroclaw-channels/src/gmail_push.rs:186-245 | crates/zeroclaw-channels/src/gmail_push.rs:260-328 | crates/zeroclaw-channels/src/gmail_push.rs:331-361 | crates/zeroclaw-channels/src/gmail_push.rs:560-623 — 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) crates/zeroclaw-channels/src/lark.rs:3269— crates/zeroclaw-channels/src/lark.rs:3269-3319 | crates/zeroclaw-channels/src/telegram.rs:2169-2214 | crates/zeroclaw-channels/src/telegram.rs:2231-2278 | crates/zeroclaw-channels/src/telegram.rs:2306-2358 — 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) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:596— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:596-644 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1878-2402 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2782-2812 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2842-2871 — 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:1936— crates/zeroclaw-channels/src/orchestrator/mod.rs:1936-2092 | crates/zeroclaw-channels/src/orchestrator/mod.rs:7540-7605 | crates/zeroclaw-channels/src/util.rs:188-360 | crates/zeroclaw-tool-call-parser/src/lib.rs:1069-1089 — 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) crates/zeroclaw-channels/src/orchestrator/mod.rs:9270— crates/zeroclaw-channels/src/orchestrator/mod.rs:9270-11501 | crates/zeroclaw-runtime/src/skills/mod.rs:1216-1271 | crates/zeroclaw-runtime/src/skills/mod.rs:1273-1309 | crates/zeroclaw-runtime/src/skills/mod.rs:2922-2957 — 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) crates/zeroclaw-channels/src/telegram.rs:4881— crates/zeroclaw-channels/src/telegram.rs:4881-5011 | crates/zeroclaw-gateway/src/api_upload.rs:91-184 | crates/zeroclaw-runtime/src/agent/agent.rs:2823-3240 | crates/zeroclaw-runtime/src/agent_lifecycle.rs:122-167 — 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) crates/zeroclaw-channels/src/telegram.rs:8121— crates/zeroclaw-channels/src/telegram.rs:8121-8169 | crates/zeroclaw-tools/src/microsoft365/auth.rs:139-187 | crates/zeroclaw-tools/src/microsoft365/auth.rs:189-289 | crates/zeroclaw-tools/src/microsoft365/auth.rs:295-344 — 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) crates/zeroclaw-config/src/pairing.rs:242— crates/zeroclaw-config/src/pairing.rs:242-278 | crates/zeroclaw-providers/src/gemini.rs:925-995 | crates/zeroclaw-tools/src/http_request.rs:564-753 | crates/zeroclaw-tools/src/web_fetch.rs:447-589 — 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) crates/zeroclaw-gateway/src/acp.rs:36— crates/zeroclaw-gateway/src/acp.rs:36-60 | crates/zeroclaw-gateway/src/canvas.rs:163-208 | crates/zeroclaw-gateway/src/ws.rs:145-215 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:30-70 — 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) crates/zeroclaw-gateway/src/lib.rs:1330— crates/zeroclaw-gateway/src/lib.rs:1330-2990 | crates/zeroclaw-hardware/src/rpi.rs:270-304 | crates/zeroclaw-runtime/src/cron/scheduler.rs:630-684 | crates/zeroclaw-runtime/src/cron/scheduler.rs:686-750 — 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) REDACTED:345— REDACTED:345-375 | REDACTED:381-411 | REDACTED:416-449 | REDACTED:529-567 — 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) REDACTED:2022— REDACTED:2022-2044 | REDACTED:2182-2203 | REDACTED:2209-2223 | REDACTED:2362-2391 — 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) crates/zeroclaw-providers/src/auth/gemini_oauth.rs:458— crates/zeroclaw-providers/src/auth/gemini_oauth.rs:458-501 | crates/zeroclaw-runtime/src/tools/security_ops.rs:28-98 | crates/zeroclaw-runtime/src/tools/security_ops.rs:188-228 | crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:165-221 — 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) crates/zeroclaw-providers/src/azure_openai.rs:395— crates/zeroclaw-providers/src/azure_openai.rs:395-465 | crates/zeroclaw-providers/src/copilot.rs:372-439 | crates/zeroclaw-providers/src/openai.rs:373-443 | crates/zeroclaw-providers/src/openrouter.rs:311-383 — 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) crates/zeroclaw-providers/src/azure_openai.rs:542— crates/zeroclaw-providers/src/azure_openai.rs:542-606 | crates/zeroclaw-providers/src/glm.rs:161-215 | crates/zeroclaw-providers/src/openai.rs:494-559 | crates/zeroclaw-providers/src/telnyx.rs:159-225 — 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) crates/zeroclaw-providers/src/compatible.rs:3339— crates/zeroclaw-providers/src/compatible.rs:3339-3367 | crates/zeroclaw-providers/src/compatible.rs:3369-3391 | crates/zeroclaw-providers/src/compatible.rs:3402-3441 | crates/zeroclaw-providers/src/openrouter.rs:414-448 — 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) crates/zeroclaw-runtime/src/agent/agent.rs:2087— crates/zeroclaw-runtime/src/agent/agent.rs:2087-2113 | crates/zeroclaw-runtime/src/agent/agent.rs:3925-4361 | crates/zeroclaw-runtime/src/agent/agent.rs:4368-4414 | crates/zeroclaw-runtime/src/agent/agent.rs:4450-5252 — 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) crates/zeroclaw-runtime/src/agent/system_prompt.rs:704— crates/zeroclaw-runtime/src/agent/system_prompt.rs:704-739 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:1619-3606 | crates/zeroclaw-runtime/src/live_config_authority.rs:240-268 | crates/zeroclaw-runtime/src/live_config_authority.rs:274-303 — 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) crates/zeroclaw-runtime/src/agent/tool_execution.rs:154— crates/zeroclaw-runtime/src/agent/tool_execution.rs:154-503 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3611-3635 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3654-3691 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:60-196 — 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) crates/zeroclaw-runtime/src/browse.rs:67— crates/zeroclaw-runtime/src/browse.rs:67-110 | crates/zeroclaw-runtime/src/browse.rs:133-156 | crates/zeroclaw-runtime/src/browse.rs:255-282 | crates/zeroclaw-runtime/src/browse.rs:291-321 — 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.
zeroclaw_channels::orchestrator::process_channel_message_body (cyclomatic 179) crates/zeroclaw-channels/src/orchestrator/mod.rs:9263— zeroclaw_channels::orchestrator::process_channel_message_body has cyclomatic complexity 179 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::orchestrator::collect_configured_channels_with_authority (cyclomatic 152) crates/zeroclaw-channels/src/orchestrator/mod.rs:14691— zeroclaw_channels::orchestrator::collect_configured_channels_with_authority has cyclomatic complexity 152 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::orchestrator::start_channels_with_authority_and_plugin_webhooks (cyclomatic 64) crates/zeroclaw-channels/src/orchestrator/mod.rs:16966— zeroclaw_channels::orchestrator::start_channels_with_authority_and_plugin_webhooks has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::orchestrator::build_channel_by_id (cyclomatic 54) crates/zeroclaw-channels/src/orchestrator/mod.rs:13134— zeroclaw_channels::orchestrator::build_channel_by_id has cyclomatic complexity 54 (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.
zeroclaw_channels::line::handle_webhook (cyclomatic 48) crates/zeroclaw-channels/src/line.rs:294— zeroclaw_channels::line::handle_webhook has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::orchestrator::run_message_dispatch_loop_until_cancelled (cyclomatic 41) crates/zeroclaw-channels/src/orchestrator/mod.rs:12275— zeroclaw_channels::orchestrator::run_message_dispatch_loop_until_cancelled has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::orchestrator::handle_runtime_command_for_delivery (cyclomatic 36) crates/zeroclaw-channels/src/orchestrator/mod.rs:5244— zeroclaw_channels::orchestrator::handle_runtime_command_for_delivery has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::util::strip_tool_call_tags (cyclomatic 34) crates/zeroclaw-channels/src/util.rs:188— zeroclaw_channels::util::strip_tool_call_tags has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 11 of the 34 points are its own statements and the rest belongs to 5 function items inside it that branch (matching_close_tag, extract_first_json_end, looks_like_prose, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
zeroclaw_channels::matrix::inbound::handle_message (cyclomatic 31) crates/zeroclaw-channels/src/matrix.rs:2279— zeroclaw_channels::matrix::inbound::handle_message has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::orchestrator::deliver_announcement (cyclomatic 30) crates/zeroclaw-channels/src/orchestrator/mod.rs:17842— zeroclaw_channels::orchestrator::deliver_announcement has cyclomatic complexity 30 (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.
zeroclaw_channels::orchestrator::dispatch_channel_sop_gate (cyclomatic 28) crates/zeroclaw-channels/src/orchestrator/mod.rs:11875— zeroclaw_channels::orchestrator::dispatch_channel_sop_gate has cyclomatic complexity 28 (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.
zeroclaw_channels::whatsapp_web::parse_link_destination (cyclomatic 27) crates/zeroclaw-channels/src/whatsapp_web.rs:3398— zeroclaw_channels::whatsapp_web::parse_link_destination has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zeroclaw_channels::orchestrator::strip_tool_call_tags (cyclomatic 26) crates/zeroclaw-channels/src/orchestrator/mod.rs:1936— zeroclaw_channels::orchestrator::strip_tool_call_tags has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 4 function items inside it that branch (extract_first_json_end, looks_like_prose, strip_leading_close_tags, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
zeroclaw_channels::orchestrator::run_matrix_single_message_draft_updater (cyclomatic 23) crates/zeroclaw-channels/src/orchestrator/mod.rs:8942— zeroclaw_channels::orchestrator::run_matrix_single_message_draft_updater has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zeroclaw_channels::discord::process_attachments (cyclomatic 18) crates/zeroclaw-channels/src/discord/mod.rs:1207— zeroclaw_channels::discord::process_attachments 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.
zeroclaw_channels::matrix::streaming::normalize_matrix_progress (cyclomatic 18) crates/zeroclaw-channels/src/matrix.rs:829— zeroclaw_channels::matrix::streaming::normalize_matrix_progress 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.
zeroclaw_channels::orchestrator::acp_server::notification_for_turn_event (cyclomatic 18) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3482— zeroclaw_channels::orchestrator::acp_server::notification_for_turn_event 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.
zeroclaw_channels::git::events::event_to_message (cyclomatic 17) crates/zeroclaw-channels/src/git/events.rs:242— zeroclaw_channels::git::events::event_to_message 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.
zeroclaw_channels::lark::handle_lark_http_event (cyclomatic 17) crates/zeroclaw-channels/src/lark.rs:918— zeroclaw_channels::lark::handle_lark_http_event has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_channels::matrix::outbound::opus_duration (cyclomatic 17) crates/zeroclaw-channels/src/matrix.rs:4077— zeroclaw_channels::matrix::outbound::opus_duration 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.
zeroclaw_channels::orchestrator::parse_runtime_command (cyclomatic 17) crates/zeroclaw-channels/src/orchestrator/mod.rs:2783— zeroclaw_channels::orchestrator::parse_runtime_command has cyclomatic complexity 17 (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.
zeroclaw_channels::orchestrator::hydrate_session_transcript (cyclomatic 17) crates/zeroclaw-channels/src/orchestrator/mod.rs:16737— zeroclaw_channels::orchestrator::hydrate_session_transcript 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.
zeroclaw_channels::wecom_ws::strip_edge_mentions (cyclomatic 17) crates/zeroclaw-channels/src/wecom_ws.rs:2264— zeroclaw_channels::wecom_ws::strip_edge_mentions has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zeroclaw_channels::discord::slash::reconcile_one_endpoint (cyclomatic 16) crates/zeroclaw-channels/src/discord/slash.rs:608— zeroclaw_channels::discord::slash::reconcile_one_endpoint 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.
zeroclaw_channels::irc::split_message (cyclomatic 16) crates/zeroclaw-channels/src/irc.rs:151— zeroclaw_channels::irc::split_message 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.
Duplicated block (15 lines × 2) apps/zerocode/src/dashboard.rs:296— apps/zerocode/src/dashboard.rs:296-310 | apps/zerocode/src/dashboard.rs:365-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) apps/zerocode/src/dashboard.rs:2002— apps/zerocode/src/dashboard.rs:2002-2016 | apps/zerocode/src/dashboard.rs:2059-2073 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) apps/zerocode/src/jsonrpc.rs:231— apps/zerocode/src/jsonrpc.rs:231-245 | crates/zeroclaw-api/src/jsonrpc.rs:360-374 — before extracting anything, compare `apps/zerocode/src/jsonrpc.rs` and `crates/zeroclaw-api/src/jsonrpc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) crates/zeroclaw-channels/src/dingtalk.rs:248— crates/zeroclaw-channels/src/dingtalk.rs:248-262 | crates/zeroclaw-channels/src/dingtalk.rs:339-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-channels/src/git/providers/gitea/api.rs:280— crates/zeroclaw-channels/src/git/providers/gitea/api.rs:280-294 | crates/zeroclaw-channels/src/git/providers/github/api.rs:530-544 — `crates/zeroclaw-channels/src/git/providers/gitea/api.rs` and `crates/zeroclaw-channels/src/git/providers/github/api.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 2) crates/zeroclaw-channels/src/imessage.rs:306— crates/zeroclaw-channels/src/imessage.rs:306-320 | crates/zeroclaw-channels/src/irc.rs:667-681 — before extracting anything, compare `crates/zeroclaw-channels/src/imessage.rs` and `crates/zeroclaw-channels/src/irc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1429— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1429-1443 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1722-1736 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-config/src/policy.rs:2702— crates/zeroclaw-config/src/policy.rs:2702-2716 | crates/zeroclaw-config/src/policy.rs:2718-2732 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-gateway/src/api_webauthn.rs:110— crates/zeroclaw-gateway/src/api_webauthn.rs:110-124 | crates/zeroclaw-gateway/src/api_webauthn.rs:201-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-infra/src/net_guard.rs:899— crates/zeroclaw-infra/src/net_guard.rs:899-913 | crates/zeroclaw-infra/src/net_guard.rs:977-991 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-memory/src/qdrant.rs:202— crates/zeroclaw-memory/src/qdrant.rs:202-216 | crates/zeroclaw-memory/src/qdrant.rs:905-919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-memory/src/qdrant.rs:790— crates/zeroclaw-memory/src/qdrant.rs:790-804 | crates/zeroclaw-memory/src/qdrant.rs:1182-1196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4639— crates/zeroclaw-providers/src/compatible.rs:4639-4653 | crates/zeroclaw-providers/src/compatible.rs:5064-5078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-providers/src/multimodal.rs:2883— crates/zeroclaw-providers/src/multimodal.rs:2883-2897 | crates/zeroclaw-providers/src/multimodal.rs:2936-2950 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-providers/src/reliable.rs:3276— crates/zeroclaw-providers/src/reliable.rs:3276-3290 | crates/zeroclaw-providers/src/reliable.rs:3648-3662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/i18n.rs:251— crates/zeroclaw-runtime/src/i18n.rs:251-265 | crates/zeroclaw-tools/src/i18n.rs:120-134 — before extracting anything, compare `crates/zeroclaw-runtime/src/i18n.rs` and `crates/zeroclaw-tools/src/i18n.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/rpc/session.rs:1252— crates/zeroclaw-runtime/src/rpc/session.rs:1252-1266 | crates/zeroclaw-runtime/src/rpc/session.rs:1301-1315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/security/bubblewrap.rs:68— crates/zeroclaw-runtime/src/security/bubblewrap.rs:68-82 | crates/zeroclaw-runtime/src/security/firejail.rs:164-178 — before extracting anything, compare `crates/zeroclaw-runtime/src/security/bubblewrap.rs` and `crates/zeroclaw-runtime/src/security/firejail.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/skills/improver.rs:169— crates/zeroclaw-runtime/src/skills/improver.rs:169-183 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:767-781 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:869— crates/zeroclaw-runtime/src/sop/engine.rs:869-883 | crates/zeroclaw-runtime/src/sop/engine.rs:933-947 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:2493— crates/zeroclaw-tool-call-parser/src/lib.rs:2493-2507 | crates/zeroclaw-tool-call-parser/src/lib.rs:2523-2537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-tools/src/backup_tool.rs:1149— crates/zeroclaw-tools/src/backup_tool.rs:1149-1163 | crates/zeroclaw-tools/src/backup_tool.rs:1290-1304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:312— crates/zeroclaw-tools/src/model_routing_config.rs:312-326 | crates/zeroclaw-tools/src/proxy_config.rs:128-142 — before extracting anything, compare `crates/zeroclaw-tools/src/model_routing_config.rs` and `crates/zeroclaw-tools/src/proxy_config.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) xtask/src/generate/container.rs:32— xtask/src/generate/container.rs:32-46 | xtask/src/generate/packaging.rs:16-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/rpc/local.rs:810— crates/zeroclaw-runtime/src/rpc/local.rs:810-824 | crates/zeroclaw-runtime/src/rpc/wss.rs:1259-1273 — before extracting anything, compare `crates/zeroclaw-runtime/src/rpc/local.rs` and `crates/zeroclaw-runtime/src/rpc/wss.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
zerocode::app::run (cognitive 437) apps/zerocode/src/app.rs:1673— zerocode::app::run has cognitive complexity 437 (threshold 15). Drivers by points: if/else 93 (274 pts), match/switch 75 (137 pts), boolean chains 25, loops 1 (nesting depth added 243). 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.
zerocode::quickstart_pane::draw_modal (cognitive 142) apps/zerocode/src/quickstart_pane.rs:2913— zerocode::quickstart_pane::draw_modal has cognitive complexity 142 (threshold 15). Drivers by points: if/else 59 (118 pts), loops 6 (15 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::markdown_to_lines (cognitive 79) apps/zerocode/src/chat.rs:8733— zerocode::chat::markdown_to_lines has cognitive complexity 79 (threshold 15). Drivers by points: if/else 25 (58 pts), match/switch 5 (16 pts), boolean chains 4, loops 1 (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::render_tool_entry (cognitive 76) apps/zerocode/src/chat.rs:7016— zerocode::chat::render_tool_entry has cognitive complexity 76 (threshold 15). Drivers by points: if/else 40 (63 pts), loops 3 (5 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::client::dial_through_relay_unbounded (cognitive 54) apps/zerocode/src/client.rs:1415— zerocode::client::dial_through_relay_unbounded has cognitive complexity 54 (threshold 15). Drivers by points: if/else 9 (30 pts), match/switch 7 (21 pts), loops 2, boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::wrap_table_cell (cognitive 50) apps/zerocode/src/chat.rs:9209— zerocode::chat::wrap_table_cell has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 7 (16 pts), boolean chains 7 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::render_table (cognitive 47) apps/zerocode/src/chat.rs:9306— zerocode::chat::render_table has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 10 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 20). Of this number, 46 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.
zerocode::run (cognitive 44) apps/zerocode/src/main.rs:879— zerocode::run has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 9 (17 pts), boolean chains 6 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::input_bar::push_wrapped_physical_line (cognitive 42) apps/zerocode/src/input_bar.rs:357— zerocode::input_bar::push_wrapped_physical_line has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 3 (6 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::config::load_persisted (cognitive 36) apps/zerocode/src/config/mod.rs:736— zerocode::config::load_persisted has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 5 (10 pts), loops 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::render_with_plan_placement (cognitive 35) apps/zerocode/src/chat.rs:6366— zerocode::chat::render_with_plan_placement has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 4, match/switch 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::render_conversation (cognitive 35) apps/zerocode/src/chat.rs:7913— zerocode::chat::render_conversation has cognitive complexity 35 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 7, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
zerocode::chat::render_queue_sidebar (cognitive 29) apps/zerocode/src/chat.rs:6697— zerocode::chat::render_queue_sidebar has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::dashboard::overview_status_lines (cognitive 29) apps/zerocode/src/dashboard.rs:3091— zerocode::dashboard::overview_status_lines has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::project_url_hit_regions (cognitive 27) apps/zerocode/src/chat.rs:7615— zerocode::chat::project_url_hit_regions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::diff::diff_lines_limited (cognitive 25) apps/zerocode/src/diff.rs:254— zerocode::diff::diff_lines_limited has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 pts), match/switch 2 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::recognized_url_ranges (cognitive 22) apps/zerocode/src/chat.rs:9034— zerocode::chat::recognized_url_ranges has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 2 (7 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::diff::highlight_all (cognitive 22) apps/zerocode/src/diff.rs:116— zerocode::diff::highlight_all has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::chat::style_recognized_urls (cognitive 19) apps/zerocode/src/chat.rs:9100— zerocode::chat::style_recognized_urls has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 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.
zerocode::chat::render_entry_into (cognitive 18) apps/zerocode/src/chat.rs:7300— zerocode::chat::render_entry_into has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::app::draw_help_modal (cognitive 17) apps/zerocode/src/app.rs:3469— zerocode::app::draw_help_modal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
zerocode::diff::highlight_all_no_bg (cognitive 17) apps/zerocode/src/diff.rs:198— zerocode::diff::highlight_all_no_bg has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::compatible::sse_bytes_to_events_for_contract (cognitive 134) crates/zeroclaw-providers/src/compatible.rs:2832— zeroclaw_providers::compatible::sse_bytes_to_events_for_contract has cognitive complexity 134 (threshold 15). Drivers by points: if/else 21 (101 pts), loops 6 (21 pts), match/switch 4 (10 pts), boolean chains 2 (nesting depth added 101). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::openai::run_responses_sse (cognitive 56) crates/zeroclaw-providers/src/openai.rs:890— zeroclaw_providers::openai::run_responses_sse has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (39 pts), loops 4 (9 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::openai_codex::process_responses_stream_event (cognitive 54) crates/zeroclaw-providers/src/openai_codex.rs:720— zeroclaw_providers::openai_codex::process_responses_stream_event has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (44 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::openai_codex::build_responses_input (cognitive 46) crates/zeroclaw-providers/src/openai_codex.rs:361— zeroclaw_providers::openai_codex::build_responses_input has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 3 (8 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::compatible::sse_bytes_to_chunks (cognitive 37) crates/zeroclaw-providers/src/compatible.rs:2717— zeroclaw_providers::compatible::sse_bytes_to_chunks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (22 pts), match/switch 4 (10 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::multimodal::jpeg_frame_header (cognitive 33) crates/zeroclaw-providers/src/multimodal.rs:3184— zeroclaw_providers::multimodal::jpeg_frame_header has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (6 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::multimodal::jpeg_first_scan (cognitive 33) crates/zeroclaw-providers/src/multimodal.rs:3273— zeroclaw_providers::multimodal::jpeg_first_scan has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::openai_codex::extract_responses_text (cognitive 24) crates/zeroclaw-providers/src/openai_codex.rs:541— zeroclaw_providers::openai_codex::extract_responses_text has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::reliable::provider_error_diagnostic (cognitive 24) crates/zeroclaw-providers/src/reliable.rs:1343— zeroclaw_providers::reliable::provider_error_diagnostic has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 7 (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.
zeroclaw_providers::multimodal::prepare_messages_inner (cognitive 23) crates/zeroclaw-providers/src/multimodal.rs:1893— zeroclaw_providers::multimodal::prepare_messages_inner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::grok_cli::acp::rpc_request (cognitive 22) crates/zeroclaw-providers/src/grok_cli/acp.rs:432— zeroclaw_providers::grok_cli::acp::rpc_request has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::pricing::assemble_snapshot (cognitive 22) crates/zeroclaw-providers/src/pricing.rs:391— zeroclaw_providers::pricing::assemble_snapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 5 (9 pts), match/switch 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::catalog::model_catalog_with_config_result (cognitive 21) crates/zeroclaw-providers/src/catalog.rs:300— zeroclaw_providers::catalog::model_catalog_with_config_result has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (5 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::multimodal::parse_image_markers_inner (cognitive 20) crates/zeroclaw-providers/src/multimodal.rs:694— zeroclaw_providers::multimodal::parse_image_markers_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::multimodal::count_latest_user_resolvable_image_markers (cognitive 19) crates/zeroclaw-providers/src/multimodal.rs:1054— zeroclaw_providers::multimodal::count_latest_user_resolvable_image_markers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::multimodal::jpeg_retained_metadata_allocation (cognitive 19) crates/zeroclaw-providers/src/multimodal.rs:3372— zeroclaw_providers::multimodal::jpeg_retained_metadata_allocation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::compatible::openai_assistant_content_plaintext (cognitive 18) crates/zeroclaw-providers/src/compatible.rs:2089— zeroclaw_providers::compatible::openai_assistant_content_plaintext has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 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.
zeroclaw_providers::factory::apply_compat_options (cognitive 17) crates/zeroclaw-providers/src/factory.rs:294— zeroclaw_providers::factory::apply_compat_options has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_providers::multimodal::marker_span_class (cognitive 17) crates/zeroclaw-providers/src/multimodal.rs:503— zeroclaw_providers::multimodal::marker_span_class has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::multimodal::trim_images_by_age (cognitive 17) crates/zeroclaw-providers/src/multimodal.rs:2237— zeroclaw_providers::multimodal::trim_images_by_age has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_providers::auth::is_non_retryable_oauth_refresh_error (cognitive 16) crates/zeroclaw-providers/src/auth/mod.rs:808— zeroclaw_providers::auth::is_non_retryable_oauth_refresh_error has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
zeroclaw_providers::pricing::refresh_once (cognitive 16) crates/zeroclaw-providers/src/pricing.rs:469— zeroclaw_providers::pricing::refresh_once has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::handle_mouse_inner (cognitive 99) apps/zerocode/src/config_manager.rs:1128— App::handle_mouse_inner has cognitive complexity 99 (threshold 15). Drivers by points: if/else 33 (88 pts), boolean chains 10, match/switch 1 (nesting depth added 55). 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.
App::handle_personality_tab (cognitive 53) apps/zerocode/src/config_manager.rs:3357— App::handle_personality_tab has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (29 pts), match/switch 7 (23 pts), boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::zeroclaw_help_context (cognitive 46) apps/zerocode/src/config_manager.rs:5715— App::zeroclaw_help_context has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (42 pts), match/switch 2 (4 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::handle_alias_rename (cognitive 43) apps/zerocode/src/config_manager.rs:3003— App::handle_alias_rename has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (31 pts), match/switch 4 (11 pts), boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::handle_field_list (cognitive 37) apps/zerocode/src/config_manager.rs:3147— App::handle_field_list has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 4 (8 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::handle_skills_tab (cognitive 37) apps/zerocode/src/config_manager.rs:3619— App::handle_skills_tab has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 5 (17 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::draw_field_list (cognitive 35) apps/zerocode/src/config_manager.rs:5016— App::draw_field_list has cognitive complexity 35 (threshold 15). Drivers by points: if/else 24 (28 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 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.
App::handle_alias_list (cognitive 34) apps/zerocode/src/config_manager.rs:2489— App::handle_alias_list has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 4 (7 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::draw_field_edit (cognitive 34) apps/zerocode/src/config_manager.rs:5372— App::draw_field_edit has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 2 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::draw_alias_list (cognitive 31) apps/zerocode/src/config_manager.rs:4707— App::draw_alias_list has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
App::handle_paste (cognitive 30) apps/zerocode/src/config_manager.rs:5554— App::handle_paste has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
App::visible_count (cognitive 28) apps/zerocode/src/config_manager.rs:1393— App::visible_count has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 13). 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.
App::set_visible_cursor (cognitive 28) apps/zerocode/src/config_manager.rs:1559— App::set_visible_cursor has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
App::handle_field_edit (cognitive 28) apps/zerocode/src/config_manager.rs:4249— App::handle_field_edit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 4 (8 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::draw_sections_pane (cognitive 26) apps/zerocode/src/config_manager.rs:4502— App::draw_sections_pane has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::bottom_hint (cognitive 23) apps/zerocode/src/config_manager.rs:773— App::bottom_hint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::handle_key_inner (cognitive 21) apps/zerocode/src/config_manager.rs:1011— App::handle_key_inner has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 3, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::visible_cursor (cognitive 21) apps/zerocode/src/config_manager.rs:1487— App::visible_cursor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
App::activate_alias_list (cognitive 21) apps/zerocode/src/config_manager.rs:2624— App::activate_alias_list has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::load_fields (cognitive 19) apps/zerocode/src/config_manager.rs:1964— App::load_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::activate_mouse (cognitive 18) apps/zerocode/src/config_manager.rs:1653— App::activate_mouse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
App::handle_alias_create (cognitive 17) apps/zerocode/src/config_manager.rs:2882— App::handle_alias_create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 2 (4 pts), boolean chains 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.
TooManyFields: Config crates/zeroclaw-config/src/schema.rs:146— TooManyFields — 100 stored fields beside 103 methods. The bar is 30 stored fields; this is 70 over it, 3.33× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ModelProviders crates/zeroclaw-config/src/providers.rs:237— TooManyFields — 79 stored fields beside 13 methods. The bar is 30 stored fields; this is 49 over it, 2.63× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ChatState apps/zerocode/src/chat.rs:9746— TooManyFields — 70 stored fields beside 135 methods. The bar is 30 stored fields; this is 40 over it, 2.33× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: App apps/zerocode/src/config_manager.rs:444— TooManyFields — 59 stored fields beside 126 methods. The bar is 30 stored fields; this is 29 over it, 1.97× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ChannelRuntimeContext crates/zeroclaw-channels/src/orchestrator/mod.rs:682— TooManyFields — 58 stored fields. The bar is 30 stored fields; this is 28 over it, 1.93× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Agent crates/zeroclaw-runtime/src/agent/agent.rs:477— TooManyFields — 54 stored fields beside 94 methods. The bar is 30 stored fields; this is 24 over it, 1.80× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Dashboard apps/zerocode/src/dashboard.rs:95— TooManyFields — 53 stored fields beside 64 methods. The bar is 30 stored fields; this is 23 over it, 1.77× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: MemoryConfig crates/zeroclaw-config/src/schema.rs:12706— TooManyFields — 53 stored fields. The bar is 30 stored fields; this is 23 over it, 1.77× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ChannelsConfig crates/zeroclaw-config/src/schema.rs:15936— TooManyFields — 46 stored fields beside 6 methods. The bar is 30 stored fields; this is 16 over it, 1.53× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: AgentBuilder crates/zeroclaw-runtime/src/agent/agent.rs:755— TooManyFields — 45 stored fields beside 45 methods. The bar is 30 stored fields; this is 15 over it, 1.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: AppState crates/zeroclaw-gateway/src/lib.rs:676— TooManyFields — 45 stored fields beside 2 methods. The bar is 30 stored fields; this is 15 over it, 1.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Logs apps/zerocode/src/logs.rs:534— TooManyFields — 36 stored fields beside 53 methods. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: SopPane REDACTED:22— TooManyFields — 35 stored fields beside 64 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: SlackChannel crates/zeroclaw-channels/src/slack.rs:124— TooManyFields — 34 stored fields beside 157 methods. The bar is 30 stored fields; this is 4 over it, 1.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Chat apps/zerocode/src/chat.rs:502— TooManyFields — 34 stored fields beside 117 methods. The bar is 30 stored fields; this is 4 over it, 1.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: TelegramChannel crates/zeroclaw-channels/src/telegram.rs:970— TooManyFields — 33 stored fields beside 172 methods. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ZerocodePane apps/zerocode/src/zerocode_pane.rs:137— TooManyFields — 33 stored fields beside 62 methods. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: WhatsAppWebChannel crates/zeroclaw-channels/src/whatsapp_web.rs:357— TooManyFields — 32 stored fields beside 60 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: OpenAiCompatibleModelProvider crates/zeroclaw-providers/src/compatible.rs:48— TooManyFields — 32 stored fields beside 50 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: OpenAiCompatibleBuilder crates/zeroclaw-providers/src/compatible.rs:517— TooManyFields — 32 stored fields beside 31 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: RuntimeProfileConfig crates/zeroclaw-config/src/schema.rs:14754— TooManyFields — 32 stored fields. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: DiscordChannel crates/zeroclaw-channels/src/discord/mod.rs:69— TooManyFields — 31 stored fields beside 36 methods. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TodoComment firmware/pico/src/main.rs:77— // TODO: implement dynamic GPIO pin drivers — 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 firmware/esp32/src/main.rs:104— // TODO: implement input pin read — requires storing InputPin drivers per pin — 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 crates/zeroclaw-tools/src/browser_open.rs:195— // TODO(compat): remove Brave fallback after default-browser launch has been stable across macOS environments. — 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 crates/zeroclaw-tools/src/browser_open.rs:233— // TODO(compat): remove Brave fallback commands (brave-browser/brave) once default launcher coverage is validated. — 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 crates/zeroclaw-tools/src/browser_open.rs:251— // TODO(compat): remove Brave fallback after default-browser launch has been stable across Windows environments. — 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 crates/zeroclaw-runtime/src/tools/todo_write.rs:7— /// todo list on every invocation (whole-list replace). The tool only — 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 crates/zeroclaw-runtime/src/agent/turn/mod.rs:1747— // TODO(PR C): hand this turn to the SOP run the gate names. — 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 crates/zeroclaw-runtime/src/agent/turn/mod.rs:1956— // TODO(PR C): route this steering message into the gated — 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 crates/zeroclaw-providers/src/grok_cli.rs:975— // TODO(grok-cli-vision): Grok Build through 0.2.118 still advertises — 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 crates/zeroclaw-gateway/src/voice_duplex.rs:69— // TODO: wire into session abort mechanism (ref upstream — 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 crates/zeroclaw-config/src/pairing.rs:355— // TODO: I've just made this work with parking_lot but it should use either flume or tokio's async mutexes — 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 crates/zeroclaw-config/src/pairing.rs:651— // TODO: make this function the main one without spawning a task — 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 crates/zeroclaw-channels/src/transcription.rs:907— // call is ~2× max_audio_bytes. TODO: replace with streaming upload once — 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 crates/zeroclaw-channels/src/wechat.rs:3476— // TODO: Re-enable placeholder if WeChat adds message edit/revoke support. — 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 crates/zeroclaw-channels/src/whatsapp_storage.rs:1498— /// TODO(wacore-0.6): wire to a periodic cleanup cron in the daemon. The — 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 apps/zerocode/src/i18n.rs:516— // Todo tracker section — 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 apps/zerocode/src/zerocode_pane.rs:101— // ── Todo tracker fields (Task 7) ──────────────────────────────────────── — 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 apps/zerocode/src/zerocode_pane.rs:818— // ── Todo tracker section (Task 7) ─────────────────────────────── — 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 apps/zerocode/src/zerocode_pane.rs:1384— // ── Todo tracker activate / edit (Task 7) ─────────────────────── — 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 apps/zerocode/src/config/mod.rs:398— // ── Todo tracker ────────────────────────────────────────────────────────────── — 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 apps/zerocode/src/config/mod.rs:2516— // ── Todo tracker persistence tests ────────────────────────────────────── — 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.
zeroclaw_config::schema::v2::normalize_provider_type (cyclomatic 56) crates/zeroclaw-config/src/schema/v2.rs:616— zeroclaw_config::schema::v2::normalize_provider_type has cyclomatic complexity 56 (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.
zeroclaw_config::policy::split_shell_words_with_metadata (cyclomatic 39) crates/zeroclaw-config/src/policy.rs:1218— zeroclaw_config::policy::split_shell_words_with_metadata has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_config::policy::split_unquoted_segments (cyclomatic 34) crates/zeroclaw-config/src/policy.rs:1046— zeroclaw_config::policy::split_unquoted_segments has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_config::policy::contains_unmodeled_shell_word_expansion (cyclomatic 32) crates/zeroclaw-config/src/policy.rs:2241— zeroclaw_config::policy::contains_unmodeled_shell_word_expansion has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_config::schema::v2::fold_providers_globals_into_models (cyclomatic 30) crates/zeroclaw-config/src/schema/v2.rs:1261— zeroclaw_config::schema::v2::fold_providers_globals_into_models has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_config::schema::v2::source_identity_matches_inner (cyclomatic 28) crates/zeroclaw-config/src/schema/v2.rs:968— zeroclaw_config::schema::v2::source_identity_matches_inner 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.
zeroclaw_config::schema::v2::synthesize_agent_brains (cyclomatic 28) crates/zeroclaw-config/src/schema/v2.rs:1958— zeroclaw_config::schema::v2::synthesize_agent_brains 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.
zeroclaw_config::agent_bundle::plan_export (cyclomatic 27) crates/zeroclaw-config/src/agent_bundle.rs:290— zeroclaw_config::agent_bundle::plan_export has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_config::typed_value::coerce_for_set_prop (cyclomatic 27) crates/zeroclaw-config/src/typed_value.rs:20— zeroclaw_config::typed_value::coerce_for_set_prop has cyclomatic complexity 27 (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.
zeroclaw_config::schema::v2::rewrite_dangling_peer_group_agents (cyclomatic 24) crates/zeroclaw-config/src/schema/v2.rs:2273— zeroclaw_config::schema::v2::rewrite_dangling_peer_group_agents 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.
zeroclaw_config::policy::powershell_variables_are_simple (cyclomatic 23) crates/zeroclaw-config/src/policy.rs:2820— zeroclaw_config::policy::powershell_variables_are_simple 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.
zeroclaw_config::policy::split_powershell_pipeline_syntax (cyclomatic 22) crates/zeroclaw-config/src/policy.rs:2665— zeroclaw_config::policy::split_powershell_pipeline_syntax 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.
zeroclaw_config::policy::git_delegates_to_external_command (cyclomatic 21) crates/zeroclaw-config/src/policy.rs:1693— zeroclaw_config::policy::git_delegates_to_external_command has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zeroclaw_config::alias_refs::collect_provider_refs (cyclomatic 20) crates/zeroclaw-config/src/alias_refs.rs:996— zeroclaw_config::alias_refs::collect_provider_refs 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.
zeroclaw_config::schema_markdown::type_label (cyclomatic 20) crates/zeroclaw-config/src/schema_markdown.rs:694— zeroclaw_config::schema_markdown::type_label 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.
zeroclaw_config::alias_refs::collect_channel_refs (cyclomatic 19) crates/zeroclaw-config/src/alias_refs.rs:1106— zeroclaw_config::alias_refs::collect_channel_refs 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.
zeroclaw_config::alias_refs::collect_agent_refs (cyclomatic 19) crates/zeroclaw-config/src/alias_refs.rs:1195— zeroclaw_config::alias_refs::collect_agent_refs 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.
zeroclaw_config::alias_refs::rewrite_model_provider_refs (cyclomatic 18) crates/zeroclaw-config/src/alias_refs.rs:785— zeroclaw_config::alias_refs::rewrite_model_provider_refs 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.
zeroclaw_config::agent_bundle::collect_risk_flags (cyclomatic 16) crates/zeroclaw-config/src/agent_bundle.rs:1087— zeroclaw_config::agent_bundle::collect_risk_flags 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.
zeroclaw_config::policy::contains_unquoted_shell_variable_expansion (cyclomatic 16) crates/zeroclaw-config/src/policy.rs:2158— zeroclaw_config::policy::contains_unquoted_shell_variable_expansion 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.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/telegram.rs:3977— crates/zeroclaw-channels/src/telegram.rs:3977-3986 | crates/zeroclaw-channels/src/telegram.rs:4046-4055 | crates/zeroclaw-channels/src/whatsapp_web.rs:3655-3664 — before extracting anything, compare `crates/zeroclaw-channels/src/telegram.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/telegram.rs:6270— crates/zeroclaw-channels/src/telegram.rs:6270-6279 | crates/zeroclaw-channels/src/telegram.rs:6738-6747 | crates/zeroclaw-channels/src/telegram.rs:6780-6789 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-gateway/src/api_skills.rs:255— crates/zeroclaw-gateway/src/api_skills.rs:255-264 | crates/zeroclaw-gateway/src/api_skills.rs:285-294 | crates/zeroclaw-gateway/src/api_skills.rs:313-322 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-memory/src/sqlite.rs:2009— crates/zeroclaw-memory/src/sqlite.rs:2009-2018 | crates/zeroclaw-memory/src/sqlite.rs:2058-2067 | crates/zeroclaw-memory/src/sqlite.rs:2197-2206 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-providers/src/gemini.rs:1221— crates/zeroclaw-providers/src/gemini.rs:1221-1230 | crates/zeroclaw-providers/src/gemini.rs:1303-1312 | crates/zeroclaw-providers/src/gemini.rs:1549-1558 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-providers/src/openai.rs:498— crates/zeroclaw-providers/src/openai.rs:498-507 | crates/zeroclaw-providers/src/openai.rs:586-595 | crates/zeroclaw-providers/src/openai.rs:682-691 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-providers/src/reliable.rs:4005— crates/zeroclaw-providers/src/reliable.rs:4005-4014 | crates/zeroclaw-providers/src/reliable.rs:4115-4124 | crates/zeroclaw-providers/src/reliable.rs:4205-4214 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-runtime/src/tools/deliver_file.rs:242— crates/zeroclaw-runtime/src/tools/deliver_file.rs:242-251 | crates/zeroclaw-runtime/src/tools/file_read.rs:127-136 | crates/zeroclaw-tools/src/file_upload.rs:231-240 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/deliver_file.rs` and `crates/zeroclaw-runtime/src/tools/file_read.rs` 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) crates/zeroclaw-tools/src/notion_tool.rs:64— crates/zeroclaw-tools/src/notion_tool.rs:64-73 | crates/zeroclaw-tools/src/notion_tool.rs:113-122 | crates/zeroclaw-tools/src/notion_tool.rs:161-170 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) apps/zerocode/src/chat.rs:6830— apps/zerocode/src/chat.rs:6830-6839 | crates/zeroclaw-tools/src/content_search.rs:1089-1098 | crates/zeroclaw-tools/src/file_upload_bundle.rs:39-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (10 lines × 3) src/alias_cli/mod.rs:17— src/alias_cli/mod.rs:17-26 | src/main.rs:128-137 | src/skills/mod.rs:13-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/matrix.rs:3551— crates/zeroclaw-channels/src/matrix.rs:3551-3563 | crates/zeroclaw-channels/src/matrix.rs:3570-3582 | crates/zeroclaw-channels/src/matrix.rs:3598-3607 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/matrix.rs:5130— crates/zeroclaw-channels/src/matrix.rs:5130-5140 | crates/zeroclaw-channels/src/matrix.rs:5179-5188 | crates/zeroclaw-channels/src/matrix.rs:5263-5272 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/dingtalk.rs:267— crates/zeroclaw-channels/src/dingtalk.rs:267-277 | crates/zeroclaw-channels/src/slack.rs:4334-4343 | crates/zeroclaw-channels/src/slack.rs:4368-4378 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10 lines × 3) crates/zeroclaw-memory/src/sqlite.rs:2263— crates/zeroclaw-memory/src/sqlite.rs:2263-2272 | crates/zeroclaw-memory/src/sqlite.rs:2279-2288 | crates/zeroclaw-memory/src/sqlite.rs:2317-2327 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/slack.rs:4247— crates/zeroclaw-channels/src/slack.rs:4247-4256 | crates/zeroclaw-channels/src/slack.rs:4276-4285 | crates/zeroclaw-channels/src/slack.rs:4634-4643 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-plugins/src/wasm_memory.rs:228— crates/zeroclaw-plugins/src/wasm_memory.rs:228-237 | crates/zeroclaw-plugins/src/wasm_memory.rs:521-530 | crates/zeroclaw-plugins/src/wasm_memory.rs:684-693 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-config/src/schema.rs:11929— crates/zeroclaw-config/src/schema.rs:11929-11938 | crates/zeroclaw-config/src/schema.rs:11961-11970 | crates/zeroclaw-config/src/schema.rs:11997-12006 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:3770— crates/zeroclaw-runtime/src/sop/engine.rs:3770-3779 | crates/zeroclaw-runtime/src/sop/engine.rs:3824-3833 | crates/zeroclaw-runtime/src/sop/engine.rs:3865-3874 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 3) crates/zeroclaw-tools/src/codex_cli.rs:113— crates/zeroclaw-tools/src/codex_cli.rs:113-122 | crates/zeroclaw-tools/src/gemini_cli.rs:93-102 | crates/zeroclaw-tools/src/opencode_cli.rs:93-102 — before extracting anything, compare `crates/zeroclaw-tools/src/codex_cli.rs` and `crates/zeroclaw-tools/src/gemini_cli.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:3887— crates/zeroclaw-channels/src/discord/mod.rs:3887-3891 | crates/zeroclaw-channels/src/mattermost.rs:847-851 | crates/zeroclaw-channels/src/mattermost.rs:922-927 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/lark.rs:3430— crates/zeroclaw-channels/src/lark.rs:3430-3434 | crates/zeroclaw-channels/src/lark.rs:3452-3459 | crates/zeroclaw-channels/src/lark.rs:3586-3590 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/line.rs:1209— crates/zeroclaw-channels/src/line.rs:1209-1213 | crates/zeroclaw-channels/src/voice_call.rs:469-473 | crates/zeroclaw-channels/src/webhook.rs:153-157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/matrix.rs:1948— crates/zeroclaw-channels/src/matrix.rs:1948-1952 | crates/zeroclaw-channels/src/matrix.rs:1969-1973 | crates/zeroclaw-channels/src/matrix.rs:2019-2024 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/matrix.rs:4799— crates/zeroclaw-channels/src/matrix.rs:4799-4803 | crates/zeroclaw-channels/src/matrix.rs:5182-5189 | crates/zeroclaw-channels/src/matrix.rs:5266-5273 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:6756— crates/zeroclaw-channels/src/orchestrator/mod.rs:6756-6760 | crates/zeroclaw-channels/src/orchestrator/mod.rs:8222-8226 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10822-10829 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-config/src/schema.rs:23274— crates/zeroclaw-config/src/schema.rs:23274-23278 | crates/zeroclaw-config/src/schema.rs:23318-23322 | crates/zeroclaw-runtime/src/daemon/mod.rs:884-888 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) crates/zeroclaw-memory/src/lib.rs:829— crates/zeroclaw-memory/src/lib.rs:829-833 | crates/zeroclaw-memory/src/lib.rs:844-848 | crates/zeroclaw-runtime/src/enroll/mod.rs:570-575 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) crates/zeroclaw-runtime/src/plugin_state.rs:104— crates/zeroclaw-runtime/src/plugin_state.rs:104-108 | crates/zeroclaw-runtime/src/plugin_state.rs:141-145 | crates/zeroclaw-runtime/src/plugin_state.rs:217-221 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-runtime/src/tools/skill_manage.rs:713— crates/zeroclaw-runtime/src/tools/skill_manage.rs:713-717 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:730-734 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:741-745 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) src/main.rs:14391— src/main.rs:14391-14395 | src/main.rs:14458-14462 | src/main.rs:14590-14594 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-runtime/src/cron/scheduler.rs:329— crates/zeroclaw-runtime/src/cron/scheduler.rs:329-338 | crates/zeroclaw-runtime/src/cron/scheduler.rs:414-418 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1071-1075 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/git/channel.rs:555— crates/zeroclaw-channels/src/git/channel.rs:555-563 | crates/zeroclaw-memory/src/lib.rs:875-880 | crates/zeroclaw-runtime/src/daemon/mod.rs:1041-1045 — before extracting anything, compare `crates/zeroclaw-memory/src/lib.rs` and `crates/zeroclaw-runtime/src/daemon/mod.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 3) crates/zeroclaw-channels/src/discord/mod.rs:1369— crates/zeroclaw-channels/src/discord/mod.rs:1369-1373 | crates/zeroclaw-channels/src/line.rs:1246-1250 | crates/zeroclaw-providers/src/bedrock.rs:1271-1279 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (5 lines × 3) crates/zeroclaw-plugins/src/registry.rs:69— crates/zeroclaw-plugins/src/registry.rs:69-74 | src/alias_cli/export.rs:535-539 | src/alias_cli/export.rs:545-549 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/line.rs:1246— crates/zeroclaw-channels/src/line.rs:1246-1250 | crates/zeroclaw-channels/src/orchestrator/media_pipeline.rs:202-207 | crates/zeroclaw-channels/src/transcription.rs:1361-1365 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/acp_channel.rs:92— crates/zeroclaw-channels/src/acp_channel.rs:92-96 | crates/zeroclaw-channels/src/acp_channel.rs:147-151 | crates/zeroclaw-runtime/src/rpc/approval_channel.rs:238-242 — before extracting anything, compare `crates/zeroclaw-channels/src/acp_channel.rs` and `crates/zeroclaw-runtime/src/rpc/approval_channel.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 3) crates/zeroclaw-channels/src/telegram.rs:3896— crates/zeroclaw-channels/src/telegram.rs:3896-3900 | crates/zeroclaw-channels/src/telegram.rs:6964-6968 | crates/zeroclaw-channels/src/telegram.rs:7024-7028 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/telegram.rs:5894— crates/zeroclaw-channels/src/telegram.rs:5894-5898 | crates/zeroclaw-channels/src/telegram.rs:5904-5908 | crates/zeroclaw-channels/src/telegram.rs:5956-5960 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 3) crates/zeroclaw-runtime/src/enroll/mod.rs:422— crates/zeroclaw-runtime/src/enroll/mod.rs:422-426 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:1007-1011 | crates/zeroclaw-runtime/src/security/cert_ledger.rs:905-909 — 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.
zeroclaw_gateway::ws::handle_socket (cognitive 176) crates/zeroclaw-gateway/src/ws.rs:471— zeroclaw_gateway::ws::handle_socket has cognitive complexity 176 (threshold 15). Drivers by points: if/else 47 (129 pts), match/switch 17 (41 pts), boolean chains 4, loops 2 (nesting depth added 106). 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.
zeroclaw_gateway::run_gateway_with_plugin_webhooks (cognitive 144) crates/zeroclaw-gateway/src/lib.rs:1314— zeroclaw_gateway::run_gateway_with_plugin_webhooks has cognitive complexity 144 (threshold 15). Drivers by points: if/else 53 (70 pts), match/switch 29 (61 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 53). 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.
zeroclaw_gateway::ws::process_chat_message (cognitive 129) crates/zeroclaw-gateway/src/ws.rs:1821— zeroclaw_gateway::ws::process_chat_message has cognitive complexity 129 (threshold 15). Drivers by points: if/else 35 (95 pts), match/switch 11 (28 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 78). 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.
zeroclaw_gateway::api_config::handle_patch (cognitive 64) crates/zeroclaw-gateway/src/api_config.rs:2575— zeroclaw_gateway::api_config::handle_patch has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (37 pts), match/switch 12 (22 pts), loops 3, boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_gateway::api_sections::select_section (cognitive 50) crates/zeroclaw-gateway/src/api_sections.rs:900— zeroclaw_gateway::api_sections::select_section has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (27 pts), match/switch 10 (16 pts), boolean chains 7 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_gateway::api_config::handle_migrate (cognitive 34) crates/zeroclaw-gateway/src/api_config.rs:2979— zeroclaw_gateway::api_config::handle_migrate has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 11 (17 pts) (nesting depth added 16). 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.
zeroclaw_gateway::run_gateway_chat_streaming_response (cognitive 28) crates/zeroclaw-gateway/src/lib.rs:4233— zeroclaw_gateway::run_gateway_chat_streaming_response has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 4 (7 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_gateway::api::handle_api_cron_patch (cognitive 27) crates/zeroclaw-gateway/src/api.rs:718— zeroclaw_gateway::api::handle_api_cron_patch has cognitive complexity 27 (threshold 15). Drivers by points: match/switch 7 (12 pts), if/else 9 (11 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_gateway::nodes::handle_node_socket (cognitive 27) crates/zeroclaw-gateway/src/nodes.rs:297— zeroclaw_gateway::nodes::handle_node_socket has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), match/switch 4 (8 pts), loops 2, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_gateway::acp::handle_socket (cognitive 24) crates/zeroclaw-gateway/src/acp.rs:62— zeroclaw_gateway::acp::handle_socket has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (5 pts), loops 2, 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.
zeroclaw_gateway::api::handle_api_cron_add (cognitive 22) crates/zeroclaw-gateway/src/api.rs:458— zeroclaw_gateway::api::handle_api_cron_add has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 8 (13 pts), if/else 6 (7 pts), boolean chains 2 (nesting depth added 6). 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.
zeroclaw_gateway::api_sop_author::handle_sop_decide (cognitive 22) crates/zeroclaw-gateway/src/api_sop_author.rs:460— zeroclaw_gateway::api_sop_author::handle_sop_decide has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 8 (10 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.
zeroclaw_gateway::handle_webhook (cognitive 21) crates/zeroclaw-gateway/src/lib.rs:3862— zeroclaw_gateway::handle_webhook has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 4, boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
zeroclaw_gateway::api_config::handle_rename_map_key (cognitive 21) crates/zeroclaw-gateway/src/api_config.rs:2051— zeroclaw_gateway::api_config::handle_rename_map_key has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 6 (12 pts), if/else 5 (9 pts) (nesting depth added 10). 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.
zeroclaw_gateway::api_config::rename_agent_cascade (cognitive 21) crates/zeroclaw-gateway/src/api_config.rs:2298— zeroclaw_gateway::api_config::rename_agent_cascade has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7, match/switch 3 (6 pts), boolean chains 4, loops 2 (4 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.
zeroclaw_gateway::api_sop_author::handle_sop_run (cognitive 20) crates/zeroclaw-gateway/src/api_sop_author.rs:197— zeroclaw_gateway::api_sop_author::handle_sop_run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (7 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_gateway::api_config::handle_map_key (cognitive 19) crates/zeroclaw-gateway/src/api_config.rs:1740— zeroclaw_gateway::api_config::handle_map_key has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 4 (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.
zeroclaw_gateway::ws_sop_runs::handle_socket (cognitive 18) crates/zeroclaw-gateway/src/ws_sop_runs.rs:72— zeroclaw_gateway::ws_sop_runs::handle_socket has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 5 (8 pts), if/else 4 (6 pts), loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_gateway::handle_admin_paircode_new (cognitive 17) crates/zeroclaw-gateway/src/lib.rs:5402— zeroclaw_gateway::handle_admin_paircode_new has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::markdown_to_telegram_html (cognitive 62) crates/zeroclaw-channels/src/telegram.rs:5862— TelegramChannel::markdown_to_telegram_html has cognitive complexity 62 (threshold 15). Drivers by points: if/else 17 (43 pts), boolean chains 12, loops 3 (4 pts), match/switch 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.
TelegramChannel::listen (cognitive 47) crates/zeroclaw-channels/src/telegram.rs:8226— TelegramChannel::listen has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (34 pts), match/switch 5 (11 pts), loops 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::finalize_multi_message_draft (cognitive 44) crates/zeroclaw-channels/src/telegram.rs:2987— TelegramChannel::finalize_multi_message_draft has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 2 (5 pts), boolean chains 4, match/switch 1 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::handle_unauthorized_message (cognitive 36) crates/zeroclaw-channels/src/telegram.rs:4497— TelegramChannel::handle_unauthorized_message has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 2 (8 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::process_model_picker_callback (cognitive 26) crates/zeroclaw-channels/src/telegram.rs:1942— TelegramChannel::process_model_picker_callback has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::handle_model_picker_callback (cognitive 24) crates/zeroclaw-channels/src/telegram.rs:2378— TelegramChannel::handle_model_picker_callback has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), match/switch 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::try_parse_voice_message (cognitive 22) crates/zeroclaw-channels/src/telegram.rs:5323— TelegramChannel::try_parse_voice_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17, match/switch 4 (5 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TelegramChannel::parse_update_message (cognitive 22) crates/zeroclaw-channels/src/telegram.rs:5740— TelegramChannel::parse_update_message has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
TelegramChannel::update_draft (cognitive 21) crates/zeroclaw-channels/src/telegram.rs:7742— TelegramChannel::update_draft has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TelegramChannel::finalize_draft (cognitive 21) crates/zeroclaw-channels/src/telegram.rs:7910— TelegramChannel::finalize_draft has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 4, loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::register_bot_commands (cognitive 20) crates/zeroclaw-channels/src/telegram.rs:3751— TelegramChannel::register_bot_commands has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::process_queued_updates (cognitive 20) crates/zeroclaw-channels/src/telegram.rs:7404— TelegramChannel::process_queued_updates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::flush_unsent (cognitive 19) crates/zeroclaw-channels/src/telegram.rs:2849— TelegramChannel::flush_unsent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::try_queue_voice_reply (cognitive 19) crates/zeroclaw-channels/src/telegram.rs:3915— TelegramChannel::try_queue_voice_reply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TelegramChannel::find_bot_mention_spans (cognitive 19) crates/zeroclaw-channels/src/telegram.rs:4268— TelegramChannel::find_bot_mention_spans has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::process_update (cognitive 19) crates/zeroclaw-channels/src/telegram.rs:7076— TelegramChannel::process_update has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 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.
TelegramChannel::handle_approval_callback (cognitive 18) crates/zeroclaw-channels/src/telegram.rs:6849— TelegramChannel::handle_approval_callback has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 4 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::try_parse_media_group_with_unsupported (cognitive 16) crates/zeroclaw-channels/src/telegram.rs:5144— TelegramChannel::try_parse_media_group_with_unsupported has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TelegramChannel::send_text_chunks (cognitive 16) crates/zeroclaw-channels/src/telegram.rs:6029— TelegramChannel::send_text_chunks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::handle_mouse_inner (cyclomatic 45) apps/zerocode/src/config_manager.rs:1128— App::handle_mouse_inner has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App::handle_field_list (cyclomatic 31) apps/zerocode/src/config_manager.rs:3147— App::handle_field_list has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App::handle_alias_list (cyclomatic 27) apps/zerocode/src/config_manager.rs:2489— App::handle_alias_list has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App::handle_field_edit (cyclomatic 24) apps/zerocode/src/config_manager.rs:4249— App::handle_field_edit 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.
App::zeroclaw_help_context (cyclomatic 24) apps/zerocode/src/config_manager.rs:5715— App::zeroclaw_help_context 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.
App::handle_personality_tab (cyclomatic 23) apps/zerocode/src/config_manager.rs:3357— App::handle_personality_tab 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.
App::handle_key_inner (cyclomatic 22) apps/zerocode/src/config_manager.rs:1011— App::handle_key_inner 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.
App::handle_alias_rename (cyclomatic 22) apps/zerocode/src/config_manager.rs:3003— App::handle_alias_rename 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.
App::draw_alias_list (cyclomatic 22) apps/zerocode/src/config_manager.rs:4707— App::draw_alias_list has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
App::draw_field_list (cyclomatic 22) apps/zerocode/src/config_manager.rs:5016— App::draw_field_list has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
App::set_visible_cursor (cyclomatic 20) apps/zerocode/src/config_manager.rs:1559— App::set_visible_cursor 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.
App::handle_skills_tab (cyclomatic 20) apps/zerocode/src/config_manager.rs:3619— App::handle_skills_tab 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.
App::bottom_hint (cyclomatic 18) apps/zerocode/src/config_manager.rs:773— App::bottom_hint 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.
App::handle_filter_key (cyclomatic 17) apps/zerocode/src/config_manager.rs:4111— App::handle_filter_key has cyclomatic complexity 17 (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.
App::handle_paste (cyclomatic 17) apps/zerocode/src/config_manager.rs:5554— App::handle_paste 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.
App::draw_field_edit (cyclomatic 16) apps/zerocode/src/config_manager.rs:5372— App::draw_field_edit 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.
RpcDispatcher::session_new_with_mode (cognitive 155) crates/zeroclaw-runtime/src/rpc/dispatch.rs:4386— RpcDispatcher::session_new_with_mode has cognitive complexity 155 (threshold 15). Drivers by points: if/else 60 (114 pts), match/switch 12 (26 pts), boolean chains 11, loops 1 (4 pts) (nesting depth added 71). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::run_session_prompt (cognitive 114) crates/zeroclaw-runtime/src/rpc/dispatch.rs:6339— RpcDispatcher::run_session_prompt has cognitive complexity 114 (threshold 15). Drivers by points: if/else 44 (69 pts), match/switch 20 (32 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::handle_session_messages (cognitive 58) crates/zeroclaw-runtime/src/rpc/dispatch.rs:8370— RpcDispatcher::handle_session_messages has cognitive complexity 58 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 7, match/switch 2 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::prepare_live_sessions_refresh (cognitive 37) crates/zeroclaw-runtime/src/rpc/dispatch.rs:9628— RpcDispatcher::prepare_live_sessions_refresh has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 4, match/switch 2 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::handle_sops_run (cognitive 28) crates/zeroclaw-runtime/src/rpc/dispatch.rs:12183— RpcDispatcher::handle_sops_run has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 3 (11 pts), boolean chains 2, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::rehydrate_reaped_session_under_guard (cognitive 27) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5764— RpcDispatcher::rehydrate_reaped_session_under_guard has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (19 pts), match/switch 5 (6 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RpcDispatcher::handle_config_alias_rename (cognitive 24) crates/zeroclaw-runtime/src/rpc/dispatch.rs:10416— RpcDispatcher::handle_config_alias_rename has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::process_line (cognitive 23) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3420— RpcDispatcher::process_line has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 6 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::handle_session_kill (cognitive 23) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5562— RpcDispatcher::handle_session_kill has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 5 (7 pts), boolean chains 5 (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.
RpcDispatcher::resolve_session_record_for_mode (cognitive 21) crates/zeroclaw-runtime/src/rpc/dispatch.rs:2517— RpcDispatcher::resolve_session_record_for_mode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (3 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::handle_session_delete (cognitive 21) crates/zeroclaw-runtime/src/rpc/dispatch.rs:8671— RpcDispatcher::handle_session_delete has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5 (7 pts), boolean chains 5 (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.
RpcDispatcher::dispatch_method (cognitive 18) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3530— RpcDispatcher::dispatch_method has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (11 pts), if/else 4 (7 pts) (nesting depth added 8). 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.
RpcDispatcher::run (cognitive 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3354— RpcDispatcher::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (7 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::handle_session_close_bound (cognitive 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5406— RpcDispatcher::handle_session_close_bound has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
RpcDispatcher::handle_config_map_key_delete (cognitive 16) crates/zeroclaw-runtime/src/rpc/dispatch.rs:10140— RpcDispatcher::handle_config_map_key_delete has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcDispatcher::handle_config_map_key_rename (cognitive 16) crates/zeroclaw-runtime/src/rpc/dispatch.rs:10283— RpcDispatcher::handle_config_map_key_rename has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×16
Members sharing a duplicated core (5 members, 50+ identical tokens) apps/zerocode/src/dashboard.rs:782— apps/zerocode/src/dashboard.rs:782-801 | apps/zerocode/src/dashboard.rs:954-974 | apps/zerocode/src/dashboard.rs:1127-1163 | apps/zerocode/src/dashboard.rs:1631-1650 | apps/zerocode/src/logs.rs:879-1020 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/discord/markers.rs:787— crates/zeroclaw-channels/src/discord/markers.rs:787-899 | crates/zeroclaw-channels/src/matrix.rs:3280-3405 | crates/zeroclaw-channels/src/whatsapp_web.rs:3069-3152 | crates/zeroclaw-providers/src/auth/mod.rs:1257-1308 | crates/zeroclaw-providers/src/auth/mod.rs:1511-1571 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/lark.rs:922— crates/zeroclaw-channels/src/lark.rs:922-1082 | crates/zeroclaw-channels/src/orchestrator/mod.rs:1372-1392 | crates/zeroclaw-runtime/src/sop/approval/timeout.rs:18-84 | crates/zeroclaw-runtime/src/sop/executor.rs:883-1292 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:128-395 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:646— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:646-698 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:870-1151 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1153-1493 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1495-1774 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2408-2430 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/slack.rs:1559— crates/zeroclaw-channels/src/slack.rs:1559-1614 | crates/zeroclaw-channels/src/slack.rs:2150-2231 | crates/zeroclaw-channels/src/slack.rs:2644-2698 | crates/zeroclaw-channels/src/slack.rs:4746-4846 | crates/zeroclaw-channels/src/slack.rs:4925-5099 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/transcription.rs:176— crates/zeroclaw-channels/src/transcription.rs:176-201 | crates/zeroclaw-channels/src/transcription.rs:283-308 | crates/zeroclaw-channels/src/transcription.rs:387-411 | crates/zeroclaw-channels/src/transcription.rs:505-522 | crates/zeroclaw-channels/src/transcription.rs:680-703 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-gateway/src/api_pairing.rs:587— crates/zeroclaw-gateway/src/api_pairing.rs:587-632 | crates/zeroclaw-tools/src/claude_code.rs:87-307 | crates/zeroclaw-tools/src/knowledge_tool.rs:159-247 | crates/zeroclaw-tools/src/knowledge_tool.rs:249-328 | crates/zeroclaw-tools/src/knowledge_tool.rs:448-487 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-runtime/src/agent/turn/approval_gate.rs:28— crates/zeroclaw-runtime/src/agent/turn/approval_gate.rs:28-292 | crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:98-551 | crates/zeroclaw-runtime/src/agent/turn/parse_response.rs:203-335 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:60-196 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:211-256 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:150— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:150-180 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:186-238 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:244-282 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:284-320 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:327-371 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-runtime/src/tools/sop_advance.rs:69— crates/zeroclaw-runtime/src/tools/sop_advance.rs:69-281 | crates/zeroclaw-runtime/src/tools/sop_approve.rs:62-216 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:70-196 | crates/zeroclaw-runtime/src/tools/sop_list.rs:43-122 | crates/zeroclaw-runtime/src/tools/sop_status.rs:73-211 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:52— crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:52-123 | crates/zeroclaw-runtime/src/tunnel/ngrok.rs:31-116 | crates/zeroclaw-runtime/src/tunnel/openvpn.rs:55-151 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:28-165 | crates/zeroclaw-tools/src/mcp_transport.rs:618-682 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-tools/src/microsoft365/graph_client.rs:56— crates/zeroclaw-tools/src/microsoft365/graph_client.rs:56-102 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:136-171 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:263-291 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:326-365 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:416-433 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-tools/src/model_routing_config.rs:190— crates/zeroclaw-tools/src/model_routing_config.rs:190-222 | crates/zeroclaw-tools/src/model_routing_config.rs:311-341 | crates/zeroclaw-tools/src/proxy_config.rs:93-125 | crates/zeroclaw-tools/src/proxy_config.rs:127-157 | crates/zeroclaw-tools/src/proxy_config.rs:247-368 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-tools/src/notion_tool.rs:58— crates/zeroclaw-tools/src/notion_tool.rs:58-80 | crates/zeroclaw-tools/src/notion_tool.rs:83-100 | crates/zeroclaw-tools/src/notion_tool.rs:107-129 | crates/zeroclaw-tools/src/notion_tool.rs:136-155 | crates/zeroclaw-tools/src/notion_tool.rs:158-177 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-tools/src/reaction.rs:71— crates/zeroclaw-tools/src/reaction.rs:71-202 | crates/zeroclaw-tools/src/sessions.rs:424-511 | crates/zeroclaw-tools/src/sessions.rs:622-727 | crates/zeroclaw-tools/src/sessions.rs:875-938 | crates/zeroclaw-tools/src/sessions.rs:996-1071 — 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.
Members sharing a duplicated core (5 members, 50+ identical tokens) xtask/src/generate/container.rs:31— xtask/src/generate/container.rs:31-49 | xtask/src/generate/docs.rs:221-246 | xtask/src/generate/install_sh.rs:683-708 | xtask/src/generate/packaging.rs:15-33 | xtask/src/generate/setup_bat.rs:222-241 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Duplicated block (18 lines × 2) apps/zerocode/src/chat.rs:4060— apps/zerocode/src/chat.rs:4060-4077 | apps/zerocode/src/chat.rs:4088-4105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2603— crates/zeroclaw-channels/src/discord/mod.rs:2603-2620 | crates/zeroclaw-channels/src/discord/mod.rs:3025-3042 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:67— crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:67-84 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:127-144 — `crates/zeroclaw-channels/src/git/providers/gitea/provider.rs` and `crates/zeroclaw-channels/src/git/providers/github/provider.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 52 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (18 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2178— crates/zeroclaw-channels/src/telegram.rs:2178-2195 | crates/zeroclaw-channels/src/telegram.rs:2240-2257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-log/src/reader.rs:283— crates/zeroclaw-log/src/reader.rs:283-300 | crates/zeroclaw-log/src/reader.rs:838-855 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-memory/src/consolidation.rs:249— crates/zeroclaw-memory/src/consolidation.rs:249-266 | crates/zeroclaw-memory/src/consolidation.rs:382-399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-providers/src/multimodal.rs:2905— crates/zeroclaw-providers/src/multimodal.rs:2905-2922 | crates/zeroclaw-providers/src/multimodal.rs:2979-2996 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-providers/src/openai.rs:633— crates/zeroclaw-providers/src/openai.rs:633-650 | crates/zeroclaw-providers/src/openai.rs:721-738 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-providers/src/openrouter.rs:682— crates/zeroclaw-providers/src/openrouter.rs:682-699 | crates/zeroclaw-providers/src/openrouter.rs:755-772 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-runtime/src/rpc/local.rs:826— crates/zeroclaw-runtime/src/rpc/local.rs:826-843 | crates/zeroclaw-runtime/src/rpc/wss.rs:1275-1292 — before extracting anything, compare `crates/zeroclaw-runtime/src/rpc/local.rs` and `crates/zeroclaw-runtime/src/rpc/wss.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) crates/zeroclaw-runtime/src/tools/schedule.rs:452— crates/zeroclaw-runtime/src/tools/schedule.rs:452-469 | crates/zeroclaw-runtime/src/tools/schedule.rs:509-526 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-tools/src/hardware_board_info.rs:93— crates/zeroclaw-tools/src/hardware_board_info.rs:93-110 | crates/zeroclaw-tools/src/hardware_memory_map.rs:76-93 — 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 (18 lines × 2) crates/zeroclaw-tools/src/microsoft365/mod.rs:175— crates/zeroclaw-tools/src/microsoft365/mod.rs:175-192 | crates/zeroclaw-tools/src/microsoft365/mod.rs:491-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:136— crates/zeroclaw-tools/src/model_routing_config.rs:136-153 | crates/zeroclaw-tools/src/proxy_config.rs:65-82 — before extracting anything, compare `crates/zeroclaw-tools/src/model_routing_config.rs` and `crates/zeroclaw-tools/src/proxy_config.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) crates/zeroclaw-tools/src/a2a_client.rs:1158— crates/zeroclaw-tools/src/a2a_client.rs:1158-1176 | crates/zeroclaw-tools/src/a2a_client.rs:1200-1217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) apps/zerocode/src/client_crypto.rs:97— apps/zerocode/src/client_crypto.rs:97-113 | crates/zeroclaw-tls/src/lib.rs:512-528 — 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 (17 lines × 2) crates/zeroclaw-config/src/presets.rs:234— crates/zeroclaw-config/src/presets.rs:234-250 | crates/zeroclaw-config/src/presets.rs:258-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/zeroclaw-gateway/src/api_config.rs:1081— crates/zeroclaw-gateway/src/api_config.rs:1081-1097 | crates/zeroclaw-gateway/src/api_config.rs:1171-1187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/zeroclaw-hardware/src/device.rs:440— crates/zeroclaw-hardware/src/device.rs:440-456 | crates/zeroclaw-hardware/src/lib.rs:258-274 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17 lines × 2) crates/zeroclaw-providers/src/azure_openai.rs:449— crates/zeroclaw-providers/src/azure_openai.rs:449-465 | crates/zeroclaw-providers/src/openai.rs:427-443 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) crates/zeroclaw-providers/src/compatible.rs:3978— crates/zeroclaw-providers/src/compatible.rs:3978-3994 | crates/zeroclaw-providers/src/compatible.rs:4081-4097 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4024— crates/zeroclaw-providers/src/compatible.rs:4024-4040 | crates/zeroclaw-providers/src/compatible.rs:4127-4143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/zeroclaw-providers/src/glm.rs:188— crates/zeroclaw-providers/src/glm.rs:188-204 | crates/zeroclaw-providers/src/glm.rs:243-259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/zeroclaw-providers/src/hailo_ollama.rs:624— crates/zeroclaw-providers/src/hailo_ollama.rs:624-640 | crates/zeroclaw-providers/src/ollama.rs:479-495 — before extracting anything, compare `crates/zeroclaw-providers/src/hailo_ollama.rs` and `crates/zeroclaw-providers/src/ollama.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:1289— crates/zeroclaw-runtime/src/cron/store.rs:1289-1305 | crates/zeroclaw-runtime/src/cron/store.rs:1337-1353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:191— crates/zeroclaw-tools/src/model_routing_config.rs:191-207 | crates/zeroclaw-tools/src/proxy_config.rs:94-110 — before extracting anything, compare `crates/zeroclaw-tools/src/model_routing_config.rs` and `crates/zeroclaw-tools/src/proxy_config.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:1271— crates/zeroclaw-tools/src/model_routing_config.rs:1271-1287 | crates/zeroclaw-tools/src/model_routing_config.rs:1304-1320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) src/cron/mod.rs:233— src/cron/mod.rs:233-249 | src/cron/mod.rs: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.
Duplicated block (17 lines × 2) src/alias_cli/mod.rs:452— src/alias_cli/mod.rs:452-468 | src/alias_cli/mod.rs:546-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) crates/zeroclaw-runtime/src/tools/sop_advance.rs:260— crates/zeroclaw-runtime/src/tools/sop_advance.rs:260-276 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:175-191 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/sop_advance.rs` and `crates/zeroclaw-runtime/src/tools/sop_execute.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
zerocode::app::run (cyclomatic 275) apps/zerocode/src/app.rs:1673— zerocode::app::run has cyclomatic complexity 275 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zerocode::chat::markdown_to_lines (cyclomatic 67) apps/zerocode/src/chat.rs:8733— zerocode::chat::markdown_to_lines has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zerocode::quickstart_pane::draw_modal (cyclomatic 56) apps/zerocode/src/quickstart_pane.rs:2913— zerocode::quickstart_pane::draw_modal has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zerocode::chat::render_tool_entry (cyclomatic 39) apps/zerocode/src/chat.rs:7016— zerocode::chat::render_tool_entry has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zerocode::client::dial_through_relay_unbounded (cyclomatic 31) apps/zerocode/src/client.rs:1415— zerocode::client::dial_through_relay_unbounded has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zerocode::run (cyclomatic 28) apps/zerocode/src/main.rs:879— zerocode::run has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zerocode::chat::render_table (cyclomatic 26) apps/zerocode/src/chat.rs:9306— zerocode::chat::render_table has cyclomatic complexity 26 (threshold 15). Of this number, 24 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.
zerocode::chat::render_with_plan_placement (cyclomatic 24) apps/zerocode/src/chat.rs:6366— zerocode::chat::render_with_plan_placement 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.
zerocode::chat::render_conversation (cyclomatic 24) apps/zerocode/src/chat.rs:7913— zerocode::chat::render_conversation has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zerocode::chat::wrap_table_cell (cyclomatic 24) apps/zerocode/src/chat.rs:9209— zerocode::chat::wrap_table_cell 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.
zerocode::config::load_persisted (cyclomatic 20) apps/zerocode/src/config/mod.rs:736— zerocode::config::load_persisted 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.
zerocode::chat::recognized_url_ranges (cyclomatic 19) apps/zerocode/src/chat.rs:9034— zerocode::chat::recognized_url_ranges has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zerocode::input_bar::push_wrapped_physical_line (cyclomatic 19) apps/zerocode/src/input_bar.rs:357— zerocode::input_bar::push_wrapped_physical_line 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.
Chat::handle_mouse (cognitive 208) apps/zerocode/src/chat.rs:5231— Chat::handle_mouse has cognitive complexity 208 (threshold 15). Drivers by points: if/else 53 (142 pts), match/switch 15 (51 pts), boolean chains 15 (nesting depth added 125). 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.
Chat::handle_key (cognitive 201) apps/zerocode/src/chat.rs:3934— Chat::handle_key has cognitive complexity 201 (threshold 15). Drivers by points: if/else 77 (152 pts), match/switch 16 (32 pts), boolean chains 17 (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Chat::after_session_start (cognitive 54) apps/zerocode/src/chat.rs:2391— Chat::after_session_start has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (38 pts), match/switch 3 (7 pts), boolean chains 5, loops 2 (4 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.
Chat::execute_context_menu_request (cognitive 43) apps/zerocode/src/chat.rs:3393— Chat::execute_context_menu_request has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (33 pts), match/switch 4 (8 pts), boolean chains 2 (nesting depth added 23). 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.
Chat::start_session_with_cancel (cognitive 37) apps/zerocode/src/chat.rs:2195— Chat::start_session_with_cancel has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (29 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Chat::drain_prompt_completions (cognitive 32) apps/zerocode/src/chat.rs:2793— Chat::drain_prompt_completions has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 3, loops 2, match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Chat::apply_session_resync_result (cognitive 31) apps/zerocode/src/chat.rs:3077— Chat::apply_session_resync_result has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 2, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Chat::close_session (cognitive 27) apps/zerocode/src/chat.rs:1291— Chat::close_session has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (20 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Chat::help_context (cognitive 25) apps/zerocode/src/chat.rs:5931— Chat::help_context has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 2 (3 pts) (nesting depth added 13). 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.
Chat::drain_notifications (cognitive 24) apps/zerocode/src/chat.rs:2694— Chat::drain_notifications has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Chat::drain_entry_retry_results (cognitive 19) apps/zerocode/src/chat.rs:2105— Chat::drain_entry_retry_results has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Chat::handle_queue_mouse (cognitive 18) apps/zerocode/src/chat.rs:5192— Chat::handle_queue_mouse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 1 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Chat::init_with_cancel (cognitive 17) apps/zerocode/src/chat.rs:1594— Chat::init_with_cancel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (11 lines × 3) crates/zeroclaw-channels/src/slack.rs:3956— crates/zeroclaw-channels/src/slack.rs:3956-3966 | crates/zeroclaw-channels/src/slack.rs:4188-4198 | crates/zeroclaw-channels/src/slack.rs:5383-5393 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-gateway/src/api.rs:2015— crates/zeroclaw-gateway/src/api.rs:2015-2025 | crates/zeroclaw-gateway/src/api.rs:2099-2109 | crates/zeroclaw-gateway/src/api.rs:2181-2191 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-macros/src/lib.rs:2687— crates/zeroclaw-macros/src/lib.rs:2687-2697 | crates/zeroclaw-macros/src/lib.rs:2779-2789 | crates/zeroclaw-macros/src/lib.rs:3001-3011 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:1686— crates/zeroclaw-providers/src/auth/mod.rs:1686-1696 | crates/zeroclaw-providers/src/auth/mod.rs:1772-1782 | crates/zeroclaw-providers/src/auth/mod.rs:1836-1846 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-providers/src/openai.rs:530— crates/zeroclaw-providers/src/openai.rs:530-540 | crates/zeroclaw-providers/src/openai.rs:630-640 | crates/zeroclaw-providers/src/openai.rs:718-728 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-providers/src/reliable.rs:2895— crates/zeroclaw-providers/src/reliable.rs:2895-2905 | crates/zeroclaw-providers/src/reliable.rs:3346-3356 | crates/zeroclaw-providers/src/reliable.rs:3723-3733 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-tools/src/data_management.rs:297— crates/zeroclaw-tools/src/data_management.rs:297-307 | crates/zeroclaw-tools/src/data_management.rs:343-353 | crates/zeroclaw-tools/src/data_management.rs:386-396 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-hardware/src/datasheet.rs:515— crates/zeroclaw-hardware/src/datasheet.rs:515-526 | crates/zeroclaw-hardware/src/datasheet.rs:580-590 | crates/zeroclaw-hardware/src/datasheet.rs:640-651 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) apps/zerocode/src/dashboard.rs:1007— apps/zerocode/src/dashboard.rs:1007-1017 | apps/zerocode/src/dashboard.rs:1179-1189 | apps/zerocode/src/dashboard.rs:1676-1686 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-runtime/src/tools/cron_run.rs:162— crates/zeroclaw-runtime/src/tools/cron_run.rs:162-172 | crates/zeroclaw-tools/src/file_upload.rs:190-200 | crates/zeroclaw-tools/src/file_upload_bundle.rs:245-255 — before extracting anything, compare `crates/zeroclaw-tools/src/file_upload.rs` and `crates/zeroclaw-tools/src/file_upload_bundle.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 3) crates/zeroclaw-channels/src/telegram.rs:6281— crates/zeroclaw-channels/src/telegram.rs:6281-6291 | crates/zeroclaw-channels/src/telegram.rs:6749-6759 | crates/zeroclaw-channels/src/telegram.rs:6791-6801 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-tools/src/jira_tool.rs:1220— crates/zeroclaw-tools/src/jira_tool.rs:1220-1230 | crates/zeroclaw-tools/src/jira_tool.rs:1232-1242 | crates/zeroclaw-tools/src/jira_tool.rs:1244-1254 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) crates/zeroclaw-channels/src/discord/rest.rs:49— crates/zeroclaw-channels/src/discord/rest.rs:49-59 | crates/zeroclaw-channels/src/discord/rest.rs:77-87 | crates/zeroclaw-channels/src/discord/rest.rs:138-148 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) apps/zerocode/src/config_manager.rs:2417— apps/zerocode/src/config_manager.rs:2417-2422 | apps/zerocode/src/config_manager.rs:2529-2534 | apps/zerocode/src/config_manager.rs:3166-3171 | apps/zerocode/src/config_manager.rs:4380-4385 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:431— crates/zeroclaw-channels/src/discord/mod.rs:431-439 | crates/zeroclaw-channels/src/discord/mod.rs:611-616 | crates/zeroclaw-channels/src/discord/mod.rs:659-667 | crates/zeroclaw-channels/src/discord/mod.rs:757-762 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) crates/zeroclaw-channels/src/orchestrator/mod.rs:1964— crates/zeroclaw-channels/src/orchestrator/mod.rs:1964-1970 | crates/zeroclaw-channels/src/orchestrator/mod.rs:7559-7566 | crates/zeroclaw-channels/src/util.rs:224-230 | crates/zeroclaw-tool-call-parser/src/lib.rs:1075-1080 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/util.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 4) crates/zeroclaw-channels/src/telegram.rs:8157— crates/zeroclaw-channels/src/telegram.rs:8157-8162 | crates/zeroclaw-tools/src/microsoft365/auth.rs:165-170 | crates/zeroclaw-tools/src/microsoft365/auth.rs:206-211 | crates/zeroclaw-tools/src/microsoft365/auth.rs:320-325 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 4) crates/zeroclaw-providers/src/azure_openai.rs:396— crates/zeroclaw-providers/src/azure_openai.rs:396-401 | crates/zeroclaw-providers/src/copilot.rs:373-378 | crates/zeroclaw-providers/src/openai.rs:374-379 | crates/zeroclaw-providers/src/openrouter.rs:312-317 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) crates/zeroclaw-providers/src/dispatch.rs:769— crates/zeroclaw-providers/src/dispatch.rs:769-774 | crates/zeroclaw-providers/src/dispatch.rs:801-806 | crates/zeroclaw-providers/src/dispatch.rs:1147-1152 | crates/zeroclaw-providers/src/dispatch.rs:1179-1184 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) crates/zeroclaw-providers/src/reliable.rs:2603— crates/zeroclaw-providers/src/reliable.rs:2603-2608 | crates/zeroclaw-providers/src/reliable.rs:2900-2905 | crates/zeroclaw-providers/src/reliable.rs:3351-3356 | crates/zeroclaw-providers/src/reliable.rs:3728-3733 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) crates/zeroclaw-runtime/src/agent/system_prompt.rs:717— crates/zeroclaw-runtime/src/agent/system_prompt.rs:717-722 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:2312-2317 | crates/zeroclaw-runtime/src/live_config_authority.rs:255-260 | crates/zeroclaw-runtime/src/live_config_authority.rs:290-295 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 4) crates/zeroclaw-tools/src/linkedin_client.rs:118— crates/zeroclaw-tools/src/linkedin_client.rs:118-123 | crates/zeroclaw-tools/src/linkedin_client.rs:128-133 | crates/zeroclaw-tools/src/linkedin_client.rs:138-143 | crates/zeroclaw-tools/src/pushover.rs:90-95 — before extracting anything, compare `crates/zeroclaw-tools/src/linkedin_client.rs` and `crates/zeroclaw-tools/src/pushover.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) crates/zeroclaw-tools/src/web_search_tool.rs:437— crates/zeroclaw-tools/src/web_search_tool.rs:437-443 | crates/zeroclaw-tools/src/web_search_tool.rs:659-664 | crates/zeroclaw-tools/src/web_search_tool.rs:835-840 | crates/zeroclaw-tools/src/web_search_tool.rs:976-982 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) crates/zeroclaw-hardware/src/datasheet.rs:499— crates/zeroclaw-hardware/src/datasheet.rs:499-504 | crates/zeroclaw-hardware/src/datasheet.rs:514-519 | crates/zeroclaw-hardware/src/datasheet.rs:566-571 | crates/zeroclaw-hardware/src/datasheet.rs:639-644 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 4) apps/zerocode/src/dashboard.rs:1769— apps/zerocode/src/dashboard.rs:1769-1774 | apps/zerocode/src/dashboard.rs:1779-1784 | apps/zerocode/src/dashboard.rs:1792-1797 | apps/zerocode/src/logs.rs:380-385 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 4) crates/zeroclaw-runtime/src/agent/agent.rs:2090— crates/zeroclaw-runtime/src/agent/agent.rs:2090-2095 | crates/zeroclaw-runtime/src/agent/agent.rs:3927-3932 | crates/zeroclaw-runtime/src/agent/agent.rs:4373-4378 | crates/zeroclaw-runtime/src/agent/agent.rs:4455-4460 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:401— crates/zeroclaw-channels/src/discord/mod.rs:401-406 | crates/zeroclaw-channels/src/discord/mod.rs:736-741 | crates/zeroclaw-runtime/src/restart.rs:215-219 | crates/zeroclaw-runtime/src/skills/review.rs:224-228 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:1246— crates/zeroclaw-channels/src/discord/mod.rs:1246-1251 | crates/zeroclaw-channels/src/discord/mod.rs:1292-1297 | crates/zeroclaw-channels/src/discord/mod.rs:1369-1373 | crates/zeroclaw-channels/src/discord/mod.rs:1392-1396 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:632— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:632-636 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2376-2380 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2799-2804 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2858-2863 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2337— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2337-2341 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3256-3260 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3267-3271 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3278-3282 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/slack.rs:1596— crates/zeroclaw-channels/src/slack.rs:1596-1602 | crates/zeroclaw-channels/src/slack.rs:2680-2686 | crates/zeroclaw-channels/src/slack.rs:4833-4837 | crates/zeroclaw-channels/src/slack.rs:5066-5072 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/wechat.rs:2045— crates/zeroclaw-channels/src/wechat.rs:2045-2050 | crates/zeroclaw-runtime/src/skills/suggestions.rs:270-274 | crates/zeroclaw-runtime/src/sop/engine.rs:6287-6291 | crates/zeroclaw-runtime/src/sop/engine.rs:6323-6327 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 4) crates/zeroclaw-runtime/src/agent/loop_.rs:2150— crates/zeroclaw-runtime/src/agent/loop_.rs:2150-2157 | crates/zeroclaw-runtime/src/agent/loop_.rs:2743-2750 | crates/zeroclaw-runtime/src/agent/loop_.rs:4092-4096 | crates/zeroclaw-runtime/src/agent/thinking.rs:172-176 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 4) crates/zeroclaw-runtime/src/sop/engine.rs:2549— crates/zeroclaw-runtime/src/sop/engine.rs:2549-2553 | crates/zeroclaw-runtime/src/sop/engine.rs:4050-4057 | crates/zeroclaw-runtime/src/sop/engine.rs:4718-4725 | crates/zeroclaw-runtime/src/sop/engine.rs:6032-6036 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 4) crates/zeroclaw-runtime/src/agent/tool_execution.rs:186— crates/zeroclaw-runtime/src/agent/tool_execution.rs:186-194 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3665-3669 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:88-93 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:147-152 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 4) crates/zeroclaw-config/src/pairing.rs:250— crates/zeroclaw-config/src/pairing.rs:250-257 | crates/zeroclaw-providers/src/gemini.rs:958-962 | crates/zeroclaw-tools/src/http_request.rs:621-625 | crates/zeroclaw-tools/src/web_fetch.rs:487-491 — before extracting anything, compare `crates/zeroclaw-tools/src/http_request.rs` and `crates/zeroclaw-tools/src/web_fetch.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 4) crates/zeroclaw-memory/src/sqlite.rs:1465— crates/zeroclaw-memory/src/sqlite.rs:1465-1469 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1305-1310 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1326-1331 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1345-1350 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 4) crates/zeroclaw-providers/src/auth/gemini_oauth.rs:459— crates/zeroclaw-providers/src/auth/gemini_oauth.rs:459-463 | crates/zeroclaw-runtime/src/tools/security_ops.rs:29-33 | crates/zeroclaw-runtime/src/tools/security_ops.rs:189-193 | crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:166-170 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 4) crates/zeroclaw-config/src/migration.rs:50— crates/zeroclaw-config/src/migration.rs:50-54 | crates/zeroclaw-runtime/src/agent/agent.rs:3651-3655 | crates/zeroclaw-runtime/src/daemon/mod.rs:1071-1075 | crates/zeroclaw-runtime/src/tools/skill_http.rs:195-199 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
zeroclaw::async_main_inner (cyclomatic 371) src/main.rs:9516— zeroclaw::async_main_inner has cyclomatic complexity 371 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw::run_quickstart_cli (cyclomatic 129) src/main.rs:1779— zeroclaw::run_quickstart_cli has cyclomatic complexity 129 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw::skills::handle_command (cyclomatic 50) src/skills/mod.rs:56— zeroclaw::skills::handle_command has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw::cron::handle_command (cyclomatic 36) src/cron/mod.rs:133— zeroclaw::cron::handle_command 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.
zeroclaw::sop::handle_command (cyclomatic 30) src/sop/mod.rs:7— zeroclaw::sop::handle_command has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw::quickstart_plugins::install_one (cyclomatic 26) REDACTED:1314— zeroclaw::quickstart_plugins::install_one has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zeroclaw::run_plugin_update (cyclomatic 24) src/main.rs:6413— zeroclaw::run_plugin_update has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw::handle_auth_command (cyclomatic 24) src/main.rs:15372— zeroclaw::handle_auth_command 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.
zeroclaw::issue_wss_client_cert (cyclomatic 22) src/main.rs:8108— zeroclaw::issue_wss_client_cert has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw::commands::update::detect_arch_from_header (cyclomatic 20) src/commands/update.rs:766— zeroclaw::commands::update::detect_arch_from_header has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
zeroclaw::update_one_plugin (cyclomatic 20) src/main.rs:6812— zeroclaw::update_one_plugin has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
zeroclaw::channel_instance_readiness_lines_with_admission (cyclomatic 18) src/main.rs:4701— zeroclaw::channel_instance_readiness_lines_with_admission 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.
zeroclaw_tools::content_search::format_line_output (cognitive 59) crates/zeroclaw-tools/src/content_search.rs:863— zeroclaw_tools::content_search::format_line_output has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (52 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tools::embedded_resource::format_mcp_tool_result_for_model (cognitive 55) crates/zeroclaw-tools/src/embedded_resource.rs:538— zeroclaw_tools::embedded_resource::format_mcp_tool_result_for_model has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (33 pts), match/switch 7 (19 pts), boolean chains 2, 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.
zeroclaw_tools::jira_tool::parse_inline (cognitive 48) crates/zeroclaw-tools/src/jira_tool.rs:1520— zeroclaw_tools::jira_tool::parse_inline has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 3 (7 pts), match/switch 1 (4 pts), boolean chains 2 (nesting depth added 28). 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.
zeroclaw_tools::mcp_transport::read_first_jsonrpc_from_sse_response (cognitive 34) crates/zeroclaw-tools/src/mcp_transport.rs:1845— zeroclaw_tools::mcp_transport::read_first_jsonrpc_from_sse_response has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tools::content_search::visit_internal_search_path (cognitive 26) crates/zeroclaw-tools/src/content_search.rs:496— zeroclaw_tools::content_search::visit_internal_search_path has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tools::mcp_transport::read_bounded_line (cognitive 23) crates/zeroclaw-tools/src/mcp_transport.rs:792— zeroclaw_tools::mcp_transport::read_bounded_line has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (21 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.
zeroclaw_tools::a2a_client::select_interface (cognitive 22) crates/zeroclaw-tools/src/a2a_client.rs:790— zeroclaw_tools::a2a_client::select_interface has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tools::backup_tool::validate_copy_destination (cognitive 20) crates/zeroclaw-tools/src/backup_tool.rs:1181— zeroclaw_tools::backup_tool::validate_copy_destination has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (8 pts), match/switch 3 (8 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tools::jira_tool::shape_projects (cognitive 18) crates/zeroclaw-tools/src/jira_tool.rs:1457— zeroclaw_tools::jira_tool::shape_projects has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (6 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.
zeroclaw_tools::backup_tool::walk_and_hash (cognitive 17) crates/zeroclaw-tools/src/backup_tool.rs:1282— zeroclaw_tools::backup_tool::walk_and_hash has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tools::llm_task::validate_json_response (cognitive 16) crates/zeroclaw-tools/src/llm_task.rs:253— zeroclaw_tools::llm_task::validate_json_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tools::pipeline::interpolate_string (cognitive 16) crates/zeroclaw-tools/src/pipeline.rs:409— zeroclaw_tools::pipeline::interpolate_string has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::cmd::mdbook::peer_groups::parse_kv_args (cognitive 33) xtask/src/cmd/mdbook/peer_groups.rs:619— xtask::cmd::mdbook::peer_groups::parse_kv_args has cognitive complexity 33 (threshold 15). Drivers by points: loops 7 (15 pts), if/else 5 (10 pts), boolean chains 8 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
xtask::cmd::mdbook::sync::run (cognitive 31) xtask/src/cmd/mdbook/sync.rs:5— xtask::cmd::mdbook::sync::run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (28 pts), loops 2, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::cmd::fluent::scan::run (cognitive 29) xtask/src/cmd/fluent/scan.rs:6— xtask::cmd::fluent::scan::run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 8 (14 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
xtask::bin::web::collect_string_enum_members (cognitive 23) xtask/src/bin/web.rs:197— xtask::bin::web::collect_string_enum_members has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::cmd::mdbook::linkcheck::check_internal_links (cognitive 23) xtask/src/cmd/mdbook/linkcheck.rs:6— xtask::cmd::mdbook::linkcheck::check_internal_links has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (4 pts), 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.
xtask::cmd::mdbook::llms::strip_inline_markup (cognitive 23) xtask/src/cmd/mdbook/llms.rs:360— xtask::cmd::mdbook::llms::strip_inline_markup has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 3 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::cmd::mdbook::llms::first_paragraph (cognitive 22) xtask/src/cmd/mdbook/llms.rs:310— xtask::cmd::mdbook::llms::first_paragraph has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, 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.
xtask::cmd::fluent::fill::parse_ftl (cognitive 21) xtask/src/cmd/fluent/fill.rs:200— xtask::cmd::fluent::fill::parse_ftl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::cmd::fluent::check::run (cognitive 20) xtask/src/cmd/fluent/check.rs:5— xtask::cmd::fluent::check::run has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 5 (9 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
xtask::cmd::mdbook::seo::run (cognitive 19) xtask/src/cmd/mdbook/seo.rs:40— xtask::cmd::mdbook::seo::run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 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.
xtask::cmd::mdbook::check::parse_po_entries (cognitive 18) xtask/src/cmd/mdbook/check.rs:98— xtask::cmd::mdbook::check::parse_po_entries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xtask::generate::run (cognitive 17) xtask/src/generate/mod.rs:207— xtask::generate::run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (20 lines × 2) apps/zerocode/src/app.rs:3673— apps/zerocode/src/app.rs:3673-3692 | apps/zerocode/src/app.rs:3727-3746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/zeroclaw-channels/src/mochat.rs:64— crates/zeroclaw-channels/src/mochat.rs:64-83 | crates/zeroclaw-channels/src/twitter.rs:74-93 — before extracting anything, compare `crates/zeroclaw-channels/src/mochat.rs` and `crates/zeroclaw-channels/src/twitter.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) crates/zeroclaw-channels/src/qq.rs:1669— crates/zeroclaw-channels/src/qq.rs:1669-1688 | crates/zeroclaw-channels/src/qq.rs:1742-1761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/zeroclaw-channels/src/whatsapp_web.rs:4286— crates/zeroclaw-channels/src/whatsapp_web.rs:4286-4305 | crates/zeroclaw-channels/src/whatsapp_web.rs:4326-4345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/zeroclaw-memory/src/agent_scoped_markdown.rs:182— crates/zeroclaw-memory/src/agent_scoped_markdown.rs:182-201 | crates/zeroclaw-memory/src/agent_scoped_markdown.rs:235-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/zeroclaw-memory/src/consolidation.rs:217— crates/zeroclaw-memory/src/consolidation.rs:217-236 | crates/zeroclaw-memory/src/consolidation.rs:350-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/zeroclaw-runtime/src/daemon/mod.rs:2548— crates/zeroclaw-runtime/src/daemon/mod.rs:2548-2567 | crates/zeroclaw-runtime/src/daemon/mod.rs:2676-2695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/zeroclaw-runtime/src/quickstart/mod.rs:1848— crates/zeroclaw-runtime/src/quickstart/mod.rs:1848-1867 | crates/zeroclaw-runtime/src/quickstart/mod.rs:1870-1889 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) crates/zeroclaw-runtime/src/tools/skill_http.rs:50— crates/zeroclaw-runtime/src/tools/skill_http.rs:50-69 | crates/zeroclaw-runtime/src/tools/skill_tool.rs:118-137 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20 lines × 2) crates/zeroclaw-tools/src/file_upload.rs:238— crates/zeroclaw-tools/src/file_upload.rs:238-257 | crates/zeroclaw-tools/src/file_upload_bundle.rs:339-358 — before extracting anything, compare `crates/zeroclaw-tools/src/file_upload.rs` and `crates/zeroclaw-tools/src/file_upload_bundle.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) crates/zeroclaw-tools/src/file_upload.rs:336— crates/zeroclaw-tools/src/file_upload.rs:336-355 | crates/zeroclaw-tools/src/file_upload_bundle.rs:488-507 — before extracting anything, compare `crates/zeroclaw-tools/src/file_upload.rs` and `crates/zeroclaw-tools/src/file_upload_bundle.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (20 lines × 2) firmware/nucleo/src/main.rs:76— firmware/nucleo/src/main.rs:76-95 | firmware/pico/src/main.rs:78-97 — before extracting anything, compare `firmware/nucleo/src/main.rs` and `firmware/pico/src/main.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/discord/markers.rs:874— crates/zeroclaw-channels/src/discord/markers.rs:874-889 | crates/zeroclaw-channels/src/matrix.rs:3380-3395 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1199— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1199-1214 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1536-1551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10777— crates/zeroclaw-channels/src/orchestrator/mod.rs:10777-10792 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11257-11272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-channels/src/qq.rs:1700— crates/zeroclaw-channels/src/qq.rs:1700-1715 | crates/zeroclaw-channels/src/qq.rs:1773-1788 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-gateway/src/api_sop_author.rs:425— crates/zeroclaw-gateway/src/api_sop_author.rs:425-440 | crates/zeroclaw-gateway/src/api_sop_author.rs:499-514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-providers/src/dispatch.rs:720— crates/zeroclaw-providers/src/dispatch.rs:720-735 | crates/zeroclaw-providers/src/dispatch.rs:1100-1115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-providers/src/multimodal.rs:1398— crates/zeroclaw-providers/src/multimodal.rs:1398-1413 | crates/zeroclaw-providers/src/multimodal.rs:1558-1573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2221— crates/zeroclaw-runtime/src/agent/loop_.rs:2221-2236 | crates/zeroclaw-runtime/src/agent/loop_.rs:2843-2858 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-runtime/src/tools/schedule.rs:423— crates/zeroclaw-runtime/src/tools/schedule.rs:423-438 | crates/zeroclaw-runtime/src/tools/schedule.rs:457-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-tools/src/ask_user.rs:93— crates/zeroclaw-tools/src/ask_user.rs:93-108 | crates/zeroclaw-tools/src/poll.rs:189-204 — before extracting anything, compare `crates/zeroclaw-tools/src/ask_user.rs` and `crates/zeroclaw-tools/src/poll.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) crates/zeroclaw-tools/src/composio.rs:654— crates/zeroclaw-tools/src/composio.rs:654-669 | crates/zeroclaw-tools/src/composio.rs:704-719 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) crates/zeroclaw-hardware/src/peripherals/serial.rs:295— crates/zeroclaw-hardware/src/peripherals/serial.rs:295-310 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:142-157 — before extracting anything, compare `crates/zeroclaw-hardware/src/peripherals/serial.rs` and `crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
zeroclaw_gateway::run_gateway_with_plugin_webhooks (cyclomatic 84) crates/zeroclaw-gateway/src/lib.rs:1314— zeroclaw_gateway::run_gateway_with_plugin_webhooks has cyclomatic complexity 84 (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.
zeroclaw_gateway::ws::handle_socket (cyclomatic 77) crates/zeroclaw-gateway/src/ws.rs:471— zeroclaw_gateway::ws::handle_socket has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_gateway::ws::process_chat_message (cyclomatic 66) crates/zeroclaw-gateway/src/ws.rs:1821— zeroclaw_gateway::ws::process_chat_message has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_gateway::api_sections::select_section (cyclomatic 39) crates/zeroclaw-gateway/src/api_sections.rs:900— zeroclaw_gateway::api_sections::select_section has cyclomatic complexity 39 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
zeroclaw_gateway::api_config::handle_patch (cyclomatic 35) crates/zeroclaw-gateway/src/api_config.rs:2575— zeroclaw_gateway::api_config::handle_patch has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_gateway::api_sop_author::handle_sop_decide (cyclomatic 24) crates/zeroclaw-gateway/src/api_sop_author.rs:460— zeroclaw_gateway::api_sop_author::handle_sop_decide has cyclomatic complexity 24 (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.
zeroclaw_gateway::api::handle_api_cron_patch (cyclomatic 21) crates/zeroclaw-gateway/src/api.rs:718— zeroclaw_gateway::api::handle_api_cron_patch has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
zeroclaw_gateway::api_config::handle_migrate (cyclomatic 20) crates/zeroclaw-gateway/src/api_config.rs:2979— zeroclaw_gateway::api_config::handle_migrate has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
zeroclaw_gateway::handle_webhook (cyclomatic 18) crates/zeroclaw-gateway/src/lib.rs:3862— zeroclaw_gateway::handle_webhook 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.
zeroclaw_gateway::api_sop_author::handle_sop_run (cyclomatic 18) crates/zeroclaw-gateway/src/api_sop_author.rs:197— zeroclaw_gateway::api_sop_author::handle_sop_run 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.
zeroclaw_gateway::api::handle_api_cron_add (cyclomatic 16) crates/zeroclaw-gateway/src/api.rs:458— zeroclaw_gateway::api::handle_api_cron_add has cyclomatic complexity 16 (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.
Duplicated block (8 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:402— crates/zeroclaw-channels/src/discord/mod.rs:402-409 | crates/zeroclaw-channels/src/discord/mod.rs:434-441 | crates/zeroclaw-channels/src/discord/mod.rs:611-618 | crates/zeroclaw-channels/src/discord/mod.rs:662-669 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/zeroclaw-channels/src/orchestrator/mod.rs:10786— crates/zeroclaw-channels/src/orchestrator/mod.rs:10786-10793 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11266-11273 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11304-11311 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11438-11445 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/zeroclaw-channels/src/orchestrator/mod.rs:11176— crates/zeroclaw-channels/src/orchestrator/mod.rs:11176-11186 | crates/zeroclaw-runtime/src/skills/mod.rs:1257-1264 | crates/zeroclaw-runtime/src/skills/mod.rs:1295-1302 | crates/zeroclaw-runtime/src/skills/mod.rs:2943-2950 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 4) crates/zeroclaw-providers/src/compatible.rs:4853— crates/zeroclaw-providers/src/compatible.rs:4853-4860 | crates/zeroclaw-providers/src/compatible.rs:5031-5039 | crates/zeroclaw-providers/src/compatible.rs:5176-5183 | crates/zeroclaw-providers/src/openrouter.rs:975-983 — before extracting anything, compare `crates/zeroclaw-providers/src/compatible.rs` and `crates/zeroclaw-providers/src/openrouter.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) crates/zeroclaw-providers/src/openrouter.rs:656— crates/zeroclaw-providers/src/openrouter.rs:656-663 | crates/zeroclaw-providers/src/openrouter.rs:722-729 | crates/zeroclaw-providers/src/openrouter.rs:795-802 | crates/zeroclaw-providers/src/openrouter.rs:1000-1007 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5318— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5318-5325 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5800-5807 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5817-5824 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6018-6025 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/zeroclaw-memory/src/postgres.rs:249— crates/zeroclaw-memory/src/postgres.rs:249-256 | crates/zeroclaw-memory/src/qdrant.rs:545-552 | crates/zeroclaw-memory/src/sqlite.rs:505-512 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:8866-8873 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
Duplicated block (8 lines × 4) crates/zeroclaw-channels/src/matrix.rs:2681— crates/zeroclaw-channels/src/matrix.rs:2681-2691 | crates/zeroclaw-channels/src/whatsapp_web.rs:672-679 | crates/zeroclaw-hardware/src/uf2.rs:240-247 | crates/zeroclaw-providers/src/compatible.rs:954-961 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) crates/zeroclaw-memory/src/qdrant.rs:506— crates/zeroclaw-memory/src/qdrant.rs:506-514 | crates/zeroclaw-memory/src/qdrant.rs:633-641 | crates/zeroclaw-memory/src/qdrant.rs:992-999 | crates/zeroclaw-memory/src/qdrant.rs:1101-1109 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 4) crates/zeroclaw-runtime/src/tools/skill_tool.rs:263— crates/zeroclaw-runtime/src/tools/skill_tool.rs:263-270 | crates/zeroclaw-tools/src/browser_delegate.rs:287-294 | crates/zeroclaw-tools/src/screenshot.rs:134-141 | crates/zeroclaw-tools/src/text_browser.rs:395-402 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
Duplicated block (8 lines × 4) crates/zeroclaw-runtime/src/sop/metrics.rs:117— crates/zeroclaw-runtime/src/sop/metrics.rs:117-124 | crates/zeroclaw-runtime/src/sop/metrics.rs:157-164 | crates/zeroclaw-runtime/src/sop/metrics.rs:183-190 | crates/zeroclaw-runtime/src/sop/metrics.rs:205-212 — 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.
RpcDispatcher::dispatch_method (cyclomatic 113) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3530— RpcDispatcher::dispatch_method has cyclomatic complexity 113 (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.
RpcDispatcher::session_new_with_mode (cyclomatic 86) crates/zeroclaw-runtime/src/rpc/dispatch.rs:4386— RpcDispatcher::session_new_with_mode has cyclomatic complexity 86 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RpcDispatcher::run_session_prompt (cyclomatic 81) crates/zeroclaw-runtime/src/rpc/dispatch.rs:6339— RpcDispatcher::run_session_prompt has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RpcDispatcher::rehydrate_reaped_session_under_guard (cyclomatic 32) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5764— RpcDispatcher::rehydrate_reaped_session_under_guard has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Method::authz (cyclomatic 44) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
RpcDispatcher::handle_session_messages (cyclomatic 29) crates/zeroclaw-runtime/src/rpc/dispatch.rs:8370— RpcDispatcher::handle_session_messages has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Method::authz (cyclomatic 44) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
RpcDispatcher::prepare_live_sessions_refresh (cyclomatic 24) crates/zeroclaw-runtime/src/rpc/dispatch.rs:9628— RpcDispatcher::prepare_live_sessions_refresh 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. This is NOT this file's highest cyclomatic complexity: Method::authz (cyclomatic 44) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
RpcDispatcher::handle_session_kill (cyclomatic 22) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5562— RpcDispatcher::handle_session_kill has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Method::authz (cyclomatic 44) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
RpcDispatcher::handle_session_delete (cyclomatic 19) crates/zeroclaw-runtime/src/rpc/dispatch.rs:8671— RpcDispatcher::handle_session_delete 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. This is NOT this file's highest cyclomatic complexity: Method::authz (cyclomatic 44) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
RpcDispatcher::resolve_session_record_for_mode (cyclomatic 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:2517— RpcDispatcher::resolve_session_record_for_mode has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Method::authz (cyclomatic 44) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
RpcDispatcher::handle_sops_run (cyclomatic 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:12183— RpcDispatcher::handle_sops_run has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Method::authz (cyclomatic 44) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
TelegramChannel::markdown_to_telegram_html (cyclomatic 36) crates/zeroclaw-channels/src/telegram.rs:5862— TelegramChannel::markdown_to_telegram_html 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.
TelegramChannel::process_model_picker_callback (cyclomatic 21) crates/zeroclaw-channels/src/telegram.rs:1942— TelegramChannel::process_model_picker_callback 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.
TelegramChannel::finalize_multi_message_draft (cyclomatic 21) crates/zeroclaw-channels/src/telegram.rs:2987— TelegramChannel::finalize_multi_message_draft 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.
TelegramChannel::handle_unauthorized_message (cyclomatic 20) crates/zeroclaw-channels/src/telegram.rs:4497— TelegramChannel::handle_unauthorized_message 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.
TelegramChannel::try_parse_voice_message (cyclomatic 19) crates/zeroclaw-channels/src/telegram.rs:5323— TelegramChannel::try_parse_voice_message 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.
TelegramChannel::handle_approval_callback (cyclomatic 19) crates/zeroclaw-channels/src/telegram.rs:6849— TelegramChannel::handle_approval_callback 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.
TelegramChannel::send_attachment (cyclomatic 18) crates/zeroclaw-channels/src/telegram.rs:6300— TelegramChannel::send_attachment has cyclomatic complexity 18 (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.
TelegramChannel::finalize_draft (cyclomatic 18) crates/zeroclaw-channels/src/telegram.rs:7910— TelegramChannel::finalize_draft 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.
TelegramChannel::listen (cyclomatic 18) crates/zeroclaw-channels/src/telegram.rs:8226— TelegramChannel::listen 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.
TelegramChannel::try_queue_voice_reply (cyclomatic 17) crates/zeroclaw-channels/src/telegram.rs:3915— TelegramChannel::try_queue_voice_reply 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.
zeroclaw_providers::compatible::sse_bytes_to_events_for_contract (cyclomatic 35) crates/zeroclaw-providers/src/compatible.rs:2832— zeroclaw_providers::compatible::sse_bytes_to_events_for_contract has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_providers::openai_codex::process_responses_stream_event (cyclomatic 30) crates/zeroclaw-providers/src/openai_codex.rs:720— zeroclaw_providers::openai_codex::process_responses_stream_event has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_providers::reliable::provider_error_diagnostic (cyclomatic 24) crates/zeroclaw-providers/src/reliable.rs:1343— zeroclaw_providers::reliable::provider_error_diagnostic has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_providers::openai::run_responses_sse (cyclomatic 23) crates/zeroclaw-providers/src/openai.rs:890— zeroclaw_providers::openai::run_responses_sse 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.
zeroclaw_providers::openai_codex::build_responses_input (cyclomatic 22) crates/zeroclaw-providers/src/openai_codex.rs:361— zeroclaw_providers::openai_codex::build_responses_input 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.
zeroclaw_providers::factory::apply_compat_options (cyclomatic 18) crates/zeroclaw-providers/src/factory.rs:294— zeroclaw_providers::factory::apply_compat_options 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.
zeroclaw_providers::multimodal::jpeg_frame_header (cyclomatic 18) crates/zeroclaw-providers/src/multimodal.rs:3184— zeroclaw_providers::multimodal::jpeg_frame_header 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.
zeroclaw_providers::catalog::model_catalog_with_config_result (cyclomatic 17) crates/zeroclaw-providers/src/catalog.rs:300— zeroclaw_providers::catalog::model_catalog_with_config_result has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: zeroclaw_providers::catalog::catalog_source_for (cyclomatic 55) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
zeroclaw_providers::multimodal::jpeg_first_scan (cyclomatic 17) crates/zeroclaw-providers/src/multimodal.rs:3273— zeroclaw_providers::multimodal::jpeg_first_scan 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.
zeroclaw_providers::multimodal::jpeg_retained_metadata_allocation (cyclomatic 16) crates/zeroclaw-providers/src/multimodal.rs:3372— zeroclaw_providers::multimodal::jpeg_retained_metadata_allocation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Config::validate (cognitive 484) crates/zeroclaw-config/src/schema.rs:24274— Config::validate has cognitive complexity 484 (threshold 15). Drivers by points: if/else 179 (340 pts), loops 50 (79 pts), match/switch 15 (34 pts), boolean chains 31 (nesting depth added 209). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::load_or_init (cognitive 38) crates/zeroclaw-config/src/schema.rs:22920— Config::load_or_init has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 5 (10 pts), boolean chains 5 (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.
Config::validate_auth (cognitive 35) crates/zeroclaw-config/src/schema.rs:14228— Config::validate_auth has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 7 (11 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::extra_nested_model_provider_tables (cognitive 24) crates/zeroclaw-config/src/schema.rs:22853— Config::extra_nested_model_provider_tables has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::collect_context_compression_ignored_warnings (cognitive 24) crates/zeroclaw-config/src/schema.rs:23874— Config::collect_context_compression_ignored_warnings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::reachable_delegate_target_configs (cognitive 18) crates/zeroclaw-config/src/schema.rs:4550— Config::reachable_delegate_target_configs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::mcp_servers_for_bundles (cognitive 18) crates/zeroclaw-config/src/schema.rs:5244— Config::mcp_servers_for_bundles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::collect_cross_provider_summary_model_warnings (cognitive 17) crates/zeroclaw-config/src/schema.rs:23779— Config::collect_cross_provider_summary_model_warnings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config::resolve_alias_source (cognitive 16) crates/zeroclaw-config/src/schema.rs:4478— Config::resolve_alias_source has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Config::channel_agent_scope_admins (cognitive 16) crates/zeroclaw-config/src/schema.rs:22671— Config::channel_agent_scope_admins has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×10
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/bluesky.rs:514— crates/zeroclaw-channels/src/bluesky.rs:514-636 | crates/zeroclaw-channels/src/reddit.rs:375-436 | crates/zeroclaw-channels/src/slack.rs:4234-4647 | crates/zeroclaw-gateway/src/lib.rs:3868-4059 | crates/zeroclaw-hardware/src/loader.rs:20-144 | crates/zeroclaw-runtime/src/cron/scheduler.rs:455-589 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/dingtalk.rs:192— crates/zeroclaw-channels/src/dingtalk.rs:192-393 | crates/zeroclaw-channels/src/lark.rs:2336-2446 | crates/zeroclaw-channels/src/lark.rs:2623-2868 | crates/zeroclaw-channels/src/mattermost.rs:2235-2323 | crates/zeroclaw-channels/src/nextcloud_talk.rs:169-320 | crates/zeroclaw-channels/src/nextcloud_talk.rs:323-466 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/matrix.rs:3507— crates/zeroclaw-channels/src/matrix.rs:3507-3633 | crates/zeroclaw-channels/src/slack.rs:2150-2231 | crates/zeroclaw-channels/src/slack.rs:2856-2912 | crates/zeroclaw-channels/src/slack.rs:2928-3003 | crates/zeroclaw-channels/src/slack.rs:3280-3424 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1610-1677 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/orchestrator/mod.rs:9270— crates/zeroclaw-channels/src/orchestrator/mod.rs:9270-11501 | crates/zeroclaw-channels/src/signal.rs:695-891 | crates/zeroclaw-channels/src/wechat.rs:2100-2353 | crates/zeroclaw-memory/src/consolidation.rs:68-266 | crates/zeroclaw-memory/src/consolidation.rs:277-399 | crates/zeroclaw-runtime/src/routines/engine.rs:188-216 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-gateway/src/api_webauthn.rs:68— crates/zeroclaw-gateway/src/api_webauthn.rs:68-101 | crates/zeroclaw-gateway/src/api_webauthn.rs:108-155 | crates/zeroclaw-gateway/src/api_webauthn.rs:162-192 | crates/zeroclaw-gateway/src/api_webauthn.rs:199-241 | crates/zeroclaw-gateway/src/api_webauthn.rs:248-285 | crates/zeroclaw-gateway/src/api_webauthn.rs:293-320 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-providers/src/dispatch.rs:707— crates/zeroclaw-providers/src/dispatch.rs:707-752 | crates/zeroclaw-providers/src/dispatch.rs:763-787 | crates/zeroclaw-providers/src/dispatch.rs:795-819 | crates/zeroclaw-providers/src/dispatch.rs:1091-1132 | crates/zeroclaw-providers/src/dispatch.rs:1141-1165 | crates/zeroclaw-providers/src/dispatch.rs:1173-1197 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-runtime/src/hooks/runner.rs:298— crates/zeroclaw-runtime/src/hooks/runner.rs:298-325 | crates/zeroclaw-runtime/src/hooks/runner.rs:327-351 | crates/zeroclaw-runtime/src/hooks/runner.rs:357-386 | crates/zeroclaw-runtime/src/hooks/runner.rs:403-434 | crates/zeroclaw-runtime/src/hooks/runner.rs:439-463 | crates/zeroclaw-runtime/src/hooks/runner.rs:470-502 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-runtime/src/sop/engine.rs:2547— crates/zeroclaw-runtime/src/sop/engine.rs:2547-2760 | crates/zeroclaw-runtime/src/sop/engine.rs:2859-2872 | crates/zeroclaw-runtime/src/sop/engine.rs:4049-4148 | crates/zeroclaw-runtime/src/sop/engine.rs:4717-4889 | crates/zeroclaw-runtime/src/sop/engine.rs:5625-5686 | crates/zeroclaw-runtime/src/sop/engine.rs:6031-6072 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-tools/src/image_gen.rs:306— crates/zeroclaw-tools/src/image_gen.rs:306-476 | crates/zeroclaw-tools/src/linkedin_client.rs:598-677 | crates/zeroclaw-tools/src/linkedin_client.rs:937-991 | crates/zeroclaw-tools/src/linkedin_client.rs:1000-1054 | crates/zeroclaw-tools/src/linkedin_client.rs:1063-1112 | crates/zeroclaw-tools/src/linkedin_client.rs:1121-1173 — 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.
Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-tools/src/proxy_config.rs:22— crates/zeroclaw-tools/src/proxy_config.rs:22-62 | crates/zeroclaw-tools/src/web_search_tool.rs:387-452 | crates/zeroclaw-tools/src/web_search_tool.rs:609-673 | crates/zeroclaw-tools/src/web_search_tool.rs:785-849 | crates/zeroclaw-tools/src/web_search_tool.rs:924-991 | crates/zeroclaw-tools/src/web_search_tool.rs:1757-1815 — 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.
Duplicated block (13 lines × 3) crates/zeroclaw-channels/src/dingtalk.rs:372— crates/zeroclaw-channels/src/dingtalk.rs:372-384 | crates/zeroclaw-channels/src/mochat.rs:243-255 | crates/zeroclaw-channels/src/twitter.rs:356-368 — before extracting anything, compare `crates/zeroclaw-channels/src/mochat.rs` and `crates/zeroclaw-channels/src/twitter.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 3) crates/zeroclaw-macros/src/lib.rs:581— crates/zeroclaw-macros/src/lib.rs:581-593 | crates/zeroclaw-macros/src/lib.rs:1011-1023 | crates/zeroclaw-macros/src/lib.rs:1709-1721 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) crates/zeroclaw-providers/src/compatible.rs:4752— crates/zeroclaw-providers/src/compatible.rs:4752-4764 | crates/zeroclaw-providers/src/compatible.rs:4959-4971 | crates/zeroclaw-providers/src/compatible.rs:5113-5125 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) crates/zeroclaw-runtime/src/skills/mod.rs:803— crates/zeroclaw-runtime/src/skills/mod.rs:803-815 | crates/zeroclaw-runtime/src/skills/mod.rs:932-944 | crates/zeroclaw-runtime/src/skills/mod.rs:1063-1075 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) crates/zeroclaw-runtime/src/tools/schedule.rs:152— crates/zeroclaw-runtime/src/tools/schedule.rs:152-164 | crates/zeroclaw-runtime/src/tools/schedule.rs:175-187 | crates/zeroclaw-runtime/src/tools/schedule.rs:198-210 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) crates/zeroclaw-tools/src/http_request.rs:120— crates/zeroclaw-tools/src/http_request.rs:120-132 | crates/zeroclaw-tools/src/text_browser.rs:215-227 | crates/zeroclaw-tools/src/web_fetch.rs:711-723 — before extracting anything, compare `crates/zeroclaw-tools/src/http_request.rs` and `crates/zeroclaw-tools/src/web_fetch.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 3) src/cron/mod.rs:238— src/cron/mod.rs:238-250 | src/cron/mod.rs:327-339 | src/cron/mod.rs:418-430 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) REDACTED:1271— REDACTED:1271-1283 | REDACTED:1338-1350 | REDACTED:2926-2938 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) crates/zeroclaw-config/src/alias_refs.rs:347— crates/zeroclaw-config/src/alias_refs.rs:347-359 | crates/zeroclaw-config/src/alias_refs.rs:417-429 | crates/zeroclaw-config/src/alias_refs.rs:505-517 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) crates/zeroclaw-tools/src/composio.rs:661— crates/zeroclaw-tools/src/composio.rs:661-673 | crates/zeroclaw-tools/src/composio.rs:711-723 | crates/zeroclaw-tools/src/composio.rs:832-844 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–10 lines × 2) apps/zerocode/src/todo_tracker.rs:190— apps/zerocode/src/todo_tracker.rs:190-199 | apps/zerocode/src/todo_tracker.rs:228-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2133— crates/zeroclaw-channels/src/discord/mod.rs:2133-2141 | crates/zeroclaw-channels/src/qq.rs:1504-1513 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/qq.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–10 lines × 2) crates/zeroclaw-channels/src/line.rs:1113— crates/zeroclaw-channels/src/line.rs:1113-1122 | crates/zeroclaw-channels/src/line.rs:1150-1158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) crates/zeroclaw-channels/src/slack.rs:4816— crates/zeroclaw-channels/src/slack.rs:4816-4824 | crates/zeroclaw-channels/src/slack.rs:5048-5057 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) crates/zeroclaw-channels/src/telegram.rs:5021— crates/zeroclaw-channels/src/telegram.rs:5021-5029 | crates/zeroclaw-channels/src/telegram.rs:5777-5786 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) crates/zeroclaw-gateway/src/api_sop.rs:282— crates/zeroclaw-gateway/src/api_sop.rs:282-291 | crates/zeroclaw-gateway/src/ws.rs:424-432 — 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 (9–10 lines × 2) crates/zeroclaw-providers/src/auth/email_oauth2.rs:152— crates/zeroclaw-providers/src/auth/email_oauth2.rs:152-161 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:298-306 — before extracting anything, compare `crates/zeroclaw-providers/src/auth/email_oauth2.rs` and `crates/zeroclaw-providers/src/auth/xai_oauth.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9–10 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:1678— crates/zeroclaw-tool-call-parser/src/lib.rs:1678-1686 | crates/zeroclaw-tool-call-parser/src/lib.rs:1847-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.
Duplicated block (9–10 lines × 2) src/main.rs:2200— src/main.rs:2200-2208 | src/main.rs:2453-2462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) xtask/src/generate/spec.rs:793— xtask/src/generate/spec.rs:793-801 | xtask/src/generate/spec.rs:910-919 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 4) crates/zeroclaw-channels/src/nextcloud_talk.rs:195— crates/zeroclaw-channels/src/nextcloud_talk.rs:195-201 | crates/zeroclaw-channels/src/nextcloud_talk.rs:228-234 | crates/zeroclaw-channels/src/nextcloud_talk.rs:336-342 | crates/zeroclaw-channels/src/nextcloud_talk.rs:372-378 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:493— crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:493-499 | crates/zeroclaw-runtime/src/agent/turn/parse_response.rs:286-292 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:119-125 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:232-238 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 4) crates/zeroclaw-runtime/src/browse.rs:70— crates/zeroclaw-runtime/src/browse.rs:70-76 | crates/zeroclaw-runtime/src/browse.rs:144-150 | crates/zeroclaw-runtime/src/browse.rs:258-264 | crates/zeroclaw-runtime/src/browse.rs:308-314 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) crates/zeroclaw-runtime/src/plugin_runtime.rs:168— crates/zeroclaw-runtime/src/plugin_runtime.rs:168-174 | crates/zeroclaw-runtime/src/plugin_runtime.rs:182-188 | crates/zeroclaw-runtime/src/plugin_runtime.rs:198-204 | crates/zeroclaw-runtime/src/plugin_runtime.rs:218-224 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) crates/zeroclaw-tools/src/file_write.rs:85— crates/zeroclaw-tools/src/file_write.rs:85-91 | crates/zeroclaw-tools/src/knowledge_tool.rs:189-195 | crates/zeroclaw-tools/src/knowledge_tool.rs:490-496 | crates/zeroclaw-tools/src/memory_store.rs:64-70 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 4) crates/zeroclaw-tools/src/web_search_tool.rs:732— crates/zeroclaw-tools/src/web_search_tool.rs:732-738 | crates/zeroclaw-tools/src/web_search_tool.rs:1434-1440 | crates/zeroclaw-tools/src/web_search_tool.rs:1667-1673 | crates/zeroclaw-tools/src/web_search_tool.rs:1854-1860 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) crates/zeroclaw-tools/src/linkedin_client.rs:967— crates/zeroclaw-tools/src/linkedin_client.rs:967-973 | crates/zeroclaw-tools/src/linkedin_client.rs:1030-1036 | crates/zeroclaw-tools/src/linkedin_client.rs:1088-1094 | crates/zeroclaw-tools/src/linkedin_client.rs:1144-1150 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) crates/zeroclaw-channels/src/gmail_push.rs:215— crates/zeroclaw-channels/src/gmail_push.rs:215-221 | crates/zeroclaw-channels/src/gmail_push.rs:290-296 | crates/zeroclaw-channels/src/gmail_push.rs:344-350 | crates/zeroclaw-channels/src/gmail_push.rs:601-607 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 4) crates/zeroclaw-channels/src/lark.rs:1864— crates/zeroclaw-channels/src/lark.rs:1864-1870 | crates/zeroclaw-channels/src/lark.rs:2000-2006 | crates/zeroclaw-channels/src/whatsapp_web.rs:1469-1475 | crates/zeroclaw-config/src/cost/tracker.rs:942-948 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) crates/zeroclaw-tools/src/linkedin_client.rs:319— crates/zeroclaw-tools/src/linkedin_client.rs:319-325 | crates/zeroclaw-tools/src/linkedin_client.rs:435-441 | crates/zeroclaw-tools/src/linkedin_client.rs:452-458 | crates/zeroclaw-tools/src/linkedin_client.rs:496-502 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:552— crates/zeroclaw-channels/src/discord/mod.rs:552-570 | crates/zeroclaw-channels/src/discord/mod.rs:679-697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/zeroclaw-channels/src/email_channel.rs:103— crates/zeroclaw-channels/src/email_channel.rs:103-121 | crates/zeroclaw-channels/src/gmail_push.rs:814-832 — 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 (19 lines × 2) crates/zeroclaw-channels/src/mochat.rs:239— crates/zeroclaw-channels/src/mochat.rs:239-257 | crates/zeroclaw-channels/src/twitter.rs:352-370 — before extracting anything, compare `crates/zeroclaw-channels/src/mochat.rs` and `crates/zeroclaw-channels/src/twitter.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) crates/zeroclaw-config/src/schema.rs:12270— crates/zeroclaw-config/src/schema.rs:12270-12288 | crates/zeroclaw-config/src/schema.rs:12357-12375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/zeroclaw-macros/src/lib.rs:824— crates/zeroclaw-macros/src/lib.rs:824-842 | crates/zeroclaw-macros/src/lib.rs:1078-1096 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2160— crates/zeroclaw-runtime/src/agent/loop_.rs:2160-2178 | crates/zeroclaw-runtime/src/agent/loop_.rs:2753-2771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:2192— crates/zeroclaw-runtime/src/tools/delegate.rs:2192-2210 | crates/zeroclaw-runtime/src/tools/delegate.rs:2248-2266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/zeroclaw-tools/src/jira_tool.rs:214— crates/zeroclaw-tools/src/jira_tool.rs:214-232 | crates/zeroclaw-tools/src/jira_tool.rs:286-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) crates/zeroclaw-runtime/src/tools/cron_add.rs:282— crates/zeroclaw-runtime/src/tools/cron_add.rs:282-300 | crates/zeroclaw-runtime/src/tools/cron_update.rs:186-205 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/cron_add.rs` and `crates/zeroclaw-runtime/src/tools/cron_update.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8–9 lines × 2) apps/zerocode/src/config_manager.rs:1189— apps/zerocode/src/config_manager.rs:1189-1196 | apps/zerocode/src/config_manager.rs:1223-1231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/zeroclaw-channels/src/clawdtalk.rs:86— crates/zeroclaw-channels/src/clawdtalk.rs:86-93 | crates/zeroclaw-channels/src/clawdtalk.rs:185-193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/zeroclaw-channels/src/wecom_ws.rs:2339— crates/zeroclaw-channels/src/wecom_ws.rs:2339-2347 | crates/zeroclaw-channels/src/wecom_ws.rs:2539-2546 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/zeroclaw-gateway/src/canvas.rs:165— crates/zeroclaw-gateway/src/canvas.rs:165-173 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:31-38 — before extracting anything, compare `crates/zeroclaw-gateway/src/canvas.rs` and `crates/zeroclaw-gateway/src/ws_sop_runs.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8–9 lines × 2) crates/zeroclaw-gateway/src/lib.rs:437— crates/zeroclaw-gateway/src/lib.rs:437-444 | crates/zeroclaw-gateway/src/lib.rs:510-518 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/zeroclaw-providers/src/auth/mod.rs:1238— crates/zeroclaw-providers/src/auth/mod.rs:1238-1246 | crates/zeroclaw-providers/src/auth/mod.rs:1296-1303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:423— crates/zeroclaw-runtime/src/cron/store.rs:423-430 | crates/zeroclaw-runtime/src/cron/store.rs:464-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/zeroclaw-runtime/src/security/webauthn.rs:268— crates/zeroclaw-runtime/src/security/webauthn.rs:268-276 | crates/zeroclaw-runtime/src/security/webauthn.rs:418-425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) crates/zeroclaw-runtime/src/service/mod.rs:3145— crates/zeroclaw-runtime/src/service/mod.rs:3145-3153 | crates/zeroclaw-runtime/src/service/mod.rs:3236-3243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 5) crates/zeroclaw-channels/src/discord/markers.rs:837— crates/zeroclaw-channels/src/discord/markers.rs:837-842 | crates/zeroclaw-channels/src/matrix.rs:3336-3341 | crates/zeroclaw-channels/src/whatsapp_web.rs:3097-3101 | crates/zeroclaw-providers/src/auth/mod.rs:1278-1284 | crates/zeroclaw-providers/src/auth/mod.rs:1533-1539 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 5) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1187— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1187-1192 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1210-1214 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1524-1529 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1547-1551 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2414-2418 — 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.
Duplicated block (5 lines × 5) crates/zeroclaw-gateway/src/api_plugins.rs:160— crates/zeroclaw-gateway/src/api_plugins.rs:160-165 | crates/zeroclaw-gateway/src/api_plugins.rs:229-234 | crates/zeroclaw-gateway/src/api_plugins.rs:250-255 | crates/zeroclaw-runtime/src/daemon/mod.rs:1070-1074 | crates/zeroclaw-runtime/src/tools/skill_http.rs:194-198 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 5) crates/zeroclaw-runtime/src/sop/engine.rs:2553— crates/zeroclaw-runtime/src/sop/engine.rs:2553-2557 | crates/zeroclaw-runtime/src/sop/engine.rs:2864-2868 | crates/zeroclaw-runtime/src/sop/engine.rs:4057-4062 | crates/zeroclaw-runtime/src/sop/engine.rs:4725-4730 | crates/zeroclaw-runtime/src/sop/engine.rs:5630-5634 — 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.
Duplicated block (5 lines × 5) crates/zeroclaw-tools/src/microsoft365/graph_client.rs:89— crates/zeroclaw-tools/src/microsoft365/graph_client.rs:89-93 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:158-162 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:278-282 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:341-345 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:418-422 — 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.
Duplicated block (5 lines × 5) crates/zeroclaw-tools/src/model_routing_config.rs:203— crates/zeroclaw-tools/src/model_routing_config.rs:203-207 | crates/zeroclaw-tools/src/model_routing_config.rs:320-326 | crates/zeroclaw-tools/src/proxy_config.rs:106-110 | crates/zeroclaw-tools/src/proxy_config.rs:136-142 | crates/zeroclaw-tools/src/proxy_config.rs:267-271 — before extracting anything, compare `crates/zeroclaw-tools/src/model_routing_config.rs` and `crates/zeroclaw-tools/src/proxy_config.rs` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 124 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 5) crates/zeroclaw-tools/src/web_search_tool.rs:441— crates/zeroclaw-tools/src/web_search_tool.rs:441-445 | crates/zeroclaw-tools/src/web_search_tool.rs:662-666 | crates/zeroclaw-tools/src/web_search_tool.rs:838-842 | crates/zeroclaw-tools/src/web_search_tool.rs:980-984 | crates/zeroclaw-tools/src/web_search_tool.rs:1359-1363 — 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.
Duplicated block (5 lines × 5) apps/zerocode/src/dashboard.rs:946— apps/zerocode/src/dashboard.rs:946-950 | apps/zerocode/src/dashboard.rs:1119-1123 | apps/zerocode/src/dashboard.rs:1279-1283 | apps/zerocode/src/dashboard.rs:1901-1905 | apps/zerocode/src/logs.rs:851-855 — 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.
Duplicated block (5 lines × 5) crates/zeroclaw-providers/src/auth/gemini_oauth.rs:459— crates/zeroclaw-providers/src/auth/gemini_oauth.rs:459-463 | crates/zeroclaw-runtime/src/tools/security_ops.rs:29-33 | crates/zeroclaw-runtime/src/tools/security_ops.rs:189-193 | crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:166-170 | crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:177-181 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×8
Animation without a prefers-reduced-motion guard .claude/skills/skill-creator/eval-viewer/viewer.html:275— `.grades-toggle .arrow` moves (`transition: transform 0.15s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard apps/tauri/splash/index.html:63— `.spinner` moves (`animation: spin 0.8s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/book/theme/custom.css:282— `.chapter-fold-toggle` moves (`transition: transform 0.2s ease, color 0.18s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/book/theme/custom.css:688— `#pc-progress` moves (`transition: width 0.08s linear`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/book/theme/custom.css:1021— `.pc-diagram-stage > svg` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/book/theme/custom.css:1117— `.pc-hero-glow` moves (`animation: pc-float 8s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/book/theme/custom.css:1498— `.cfg-fields .cfg-field > summary::before` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard docs/book/theme/custom.css:1577— `.provider-entry > summary::before` moves (`transition: transform 0.12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
zeroclaw_tool_call_parser::parse_tool_calls (cognitive 254) crates/zeroclaw-tool-call-parser/src/lib.rs:2090— zeroclaw_tool_call_parser::parse_tool_calls has cognitive complexity 254 (threshold 15). Drivers by points: if/else 73 (202 pts), loops 13 (39 pts), boolean chains 11, match/switch 1 (2 pts) (nesting depth added 156). 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.
zeroclaw_tool_call_parser::parse_glm_shortened_body (cognitive 58) crates/zeroclaw-tool-call-parser/src/lib.rs:1727— zeroclaw_tool_call_parser::parse_glm_shortened_body has cognitive complexity 58 (threshold 15). Drivers by points: if/else 22 (41 pts), match/switch 2 (7 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tool_call_parser::parse_glm_style_tool_calls (cognitive 47) crates/zeroclaw-tool-call-parser/src/lib.rs:1648— zeroclaw_tool_call_parser::parse_glm_style_tool_calls has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (38 pts), match/switch 1 (5 pts), boolean chains 3, loops 1 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_tool_call_parser::parse_xml_tool_calls (cognitive 29) crates/zeroclaw-tool-call-parser/src/lib.rs:883— zeroclaw_tool_call_parser::parse_xml_tool_calls has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tool_call_parser::parse_minimax_invoke_calls (cognitive 27) crates/zeroclaw-tool-call-parser/src/lib.rs:942— zeroclaw_tool_call_parser::parse_minimax_invoke_calls has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 1 (4 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tool_call_parser::decode_recovered_json_string_fragment (cognitive 27) crates/zeroclaw-tool-call-parser/src/lib.rs:1206— zeroclaw_tool_call_parser::decode_recovered_json_string_fragment has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tool_call_parser::extract_json_values (cognitive 19) crates/zeroclaw-tool-call-parser/src/lib.rs:1105— zeroclaw_tool_call_parser::extract_json_values has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_tool_call_parser::detect_tool_call_parse_issue (cognitive 19) crates/zeroclaw-tool-call-parser/src/lib.rs:2598— zeroclaw_tool_call_parser::detect_tool_call_parse_issue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dashboard::draw_health (cognitive 64) apps/zerocode/src/dashboard.rs:1287— Dashboard::draw_health has cognitive complexity 64 (threshold 15). Drivers by points: if/else 17 (42 pts), loops 4 (13 pts), match/switch 2 (8 pts), boolean chains 1 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Dashboard::poll_data (cognitive 44) apps/zerocode/src/dashboard.rs:290— Dashboard::poll_data has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (30 pts), match/switch 7 (12 pts), loops 1 (2 pts) (nesting depth added 21). 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.
Dashboard::handle_mouse (cognitive 37) apps/zerocode/src/dashboard.rs:2422— Dashboard::handle_mouse has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 5, match/switch 1 (nesting depth added 17). 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.
Dashboard::draw_cron_detail (cognitive 35) apps/zerocode/src/dashboard.rs:1694— Dashboard::draw_cron_detail has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 6 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dashboard::drain_cron_trigger_updates (cognitive 23) apps/zerocode/src/dashboard.rs:2334— Dashboard::drain_cron_trigger_updates has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dashboard::draw_cost (cognitive 19) apps/zerocode/src/dashboard.rs:1452— Dashboard::draw_cost has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dashboard::draw_status_line (cognitive 18) apps/zerocode/src/dashboard.rs:526— Dashboard::draw_status_line has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 2 (4 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.
Dashboard::apply_agent_rename (cognitive 16) apps/zerocode/src/dashboard.rs:2167— Dashboard::apply_agent_rename has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_plugins::component_websocket::run_connection (cognitive 38) crates/zeroclaw-plugins/src/component_websocket.rs:499— zeroclaw_plugins::component_websocket::run_connection has cognitive complexity 38 (threshold 15). Drivers by points: if/else 6 (23 pts), match/switch 5 (14 pts), loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_plugins::config::validate_secret_annotations::visit_schema (cognitive 27) crates/zeroclaw-plugins/src/config.rs:627— zeroclaw_plugins::config::validate_secret_annotations::visit_schema has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (9 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_plugins::sockets::connection_actor (cognitive 23) crates/zeroclaw-plugins/src/sockets.rs:404— zeroclaw_plugins::sockets::connection_actor has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_plugins::config::validate_schema_node (cognitive 22) crates/zeroclaw-plugins/src/config.rs:582— zeroclaw_plugins::config::validate_schema_node has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_plugins::component_websocket::dial_authorized (cognitive 19) crates/zeroclaw-plugins/src/component_websocket.rs:397— zeroclaw_plugins::component_websocket::dial_authorized has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 4 (10 pts), if/else 5 (8 pts), loops 1 (nesting depth added 9). 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.
zeroclaw_plugins::config::compile_manifest_config (cognitive 19) crates/zeroclaw-plugins/src/config.rs:289— zeroclaw_plugins::config::compile_manifest_config has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
zeroclaw_plugins::egress::connect_staggered (cognitive 17) crates/zeroclaw-plugins/src/egress.rs:118— zeroclaw_plugins::egress::connect_staggered has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 3 (8 pts), if/else 3 (5 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
zeroclaw_plugins::host::beyond_install_footprint (cognitive 16) crates/zeroclaw-plugins/src/host.rs:2703— zeroclaw_plugins::host::beyond_install_footprint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DelegateTool::execute_agentic_with_approval_registry (cognitive 33) crates/zeroclaw-runtime/src/tools/delegate.rs:4727— DelegateTool::execute_agentic_with_approval_registry has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 12 (16 pts), if/else 10 (15 pts), boolean chains 2 (nesting depth added 9). 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.
DelegateTool::read_background_view (cognitive 28) crates/zeroclaw-runtime/src/tools/delegate.rs:3965— DelegateTool::read_background_view has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 2 (9 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DelegateTool::handle_await_sessions (cognitive 24) crates/zeroclaw-runtime/src/tools/delegate.rs:4201— DelegateTool::handle_await_sessions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, loops 2 (3 pts), match/switch 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.
DelegateTool::build_enriched_system_prompt_from_config (cognitive 24) crates/zeroclaw-runtime/src/tools/delegate.rs:4542— DelegateTool::build_enriched_system_prompt_from_config has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, loops 1 (2 pts), match/switch 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DelegateTool::execute_background (cognitive 19) crates/zeroclaw-runtime/src/tools/delegate.rs:3047— DelegateTool::execute_background has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, match/switch 5 (6 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DelegateTool::execute_parallel (cognitive 18) crates/zeroclaw-runtime/src/tools/delegate.rs:3590— DelegateTool::execute_parallel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DelegateTool::execute_sync_with_admission_inner (cognitive 16) crates/zeroclaw-runtime/src/tools/delegate.rs:2713— DelegateTool::execute_sync_with_admission_inner has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DelegateTool::handle_cancel_task (cognitive 16) crates/zeroclaw-runtime/src/tools/delegate.rs:4349— DelegateTool::handle_cancel_task has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitOperationsTool::validate_metadata_config (cognitive 29) crates/zeroclaw-tools/src/git_operations.rs:588— GitOperationsTool::validate_metadata_config has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitOperationsTool::has_repository_within_authorized_roots (cognitive 27) crates/zeroclaw-tools/src/git_operations.rs:166— GitOperationsTool::has_repository_within_authorized_roots has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 4, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitOperationsTool::validate_metadata_closure (cognitive 26) crates/zeroclaw-tools/src/git_operations.rs:305— GitOperationsTool::validate_metadata_closure has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitOperationsTool::git_diff (cognitive 26) crates/zeroclaw-tools/src/git_operations.rs:1360— GitOperationsTool::git_diff has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitOperationsTool::validate_metadata_tree (cognitive 21) crates/zeroclaw-tools/src/git_operations.rs:435— GitOperationsTool::validate_metadata_tree has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 5 (9 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.
GitOperationsTool::git_status (cognitive 19) crates/zeroclaw-tools/src/git_operations.rs:1294— GitOperationsTool::git_status has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitOperationsTool::validate_object_alternates_at (cognitive 16) crates/zeroclaw-tools/src/git_operations.rs:521— GitOperationsTool::validate_object_alternates_at has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
GitOperationsTool::configure_git_environment (cognitive 16) crates/zeroclaw-tools/src/git_operations.rs:1074— GitOperationsTool::configure_git_environment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (16 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.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×8
Duplicated block (25 lines × 2) crates/zeroclaw-channels/src/slack.rs:4607— crates/zeroclaw-channels/src/slack.rs:4607-4631 | crates/zeroclaw-channels/src/slack.rs:6052-6076 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) REDACTED:1270— REDACTED:1270-1294 | REDACTED:2925-2949 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) crates/zeroclaw-macros/src/lib.rs:546— crates/zeroclaw-macros/src/lib.rs:546-570 | crates/zeroclaw-macros/src/lib.rs:976-1000 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4390— crates/zeroclaw-providers/src/compatible.rs:4390-4414 | crates/zeroclaw-providers/src/compatible.rs:4518-4542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) crates/zeroclaw-providers/src/multimodal.rs:1359— crates/zeroclaw-providers/src/multimodal.rs:1359-1383 | crates/zeroclaw-providers/src/multimodal.rs:1510-1534 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) crates/zeroclaw-providers/src/openrouter.rs:826— crates/zeroclaw-providers/src/openrouter.rs:826-850 | crates/zeroclaw-providers/src/openrouter.rs:1063-1087 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:293— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:293-317 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:337-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) crates/zeroclaw-tools/src/microsoft365/mod.rs:118— crates/zeroclaw-tools/src/microsoft365/mod.rs:118-142 | crates/zeroclaw-tools/src/microsoft365/mod.rs:419-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.
Duplicated block (11–12 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1851— crates/zeroclaw-channels/src/discord/mod.rs:1851-1862 | crates/zeroclaw-channels/src/discord/mod.rs:3780-3790 — both copies are in the same file, so extract the 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–12 lines × 2) crates/zeroclaw-channels/src/slack.rs:4827— crates/zeroclaw-channels/src/slack.rs:4827-4837 | crates/zeroclaw-channels/src/slack.rs:5061-5072 — both copies are in the same file, so extract the 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–12 lines × 2) crates/zeroclaw-runtime/src/agent/pricing_catalog.rs:145— crates/zeroclaw-runtime/src/agent/pricing_catalog.rs:145-155 | crates/zeroclaw-runtime/src/agent/pricing_catalog.rs:168-179 — both copies are in the same file, so extract the 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–12 lines × 2) crates/zeroclaw-runtime/src/cron/schedule.rs:18— crates/zeroclaw-runtime/src/cron/schedule.rs:18-28 | crates/zeroclaw-runtime/src/cron/schedule.rs:33-44 — both copies are in the same file, so extract the 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–12 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5778— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5778-5788 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5883-5894 — both copies are in the same file, so extract the 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–12 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:4429— crates/zeroclaw-runtime/src/sop/engine.rs:4429-4439 | crates/zeroclaw-runtime/src/sop/engine.rs:4903-4914 — both copies are in the same file, so extract the 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–12 lines × 2) src/main.rs:10137— src/main.rs:10137-10148 | src/main.rs:10546-10556 — both copies are in the same file, so extract the 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–12 lines × 2) tools/fill-translations/src/main.rs:93— tools/fill-translations/src/main.rs:93-103 | xtask/src/cmd/mdbook/check.rs:228-239 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 5) crates/zeroclaw-channels/src/mattermost.rs:923— crates/zeroclaw-channels/src/mattermost.rs:923-929 | crates/zeroclaw-channels/src/mattermost.rs:944-950 | crates/zeroclaw-channels/src/mattermost.rs:973-979 | crates/zeroclaw-channels/src/slack.rs:2655-2661 | crates/zeroclaw-channels/src/slack.rs:2685-2691 — before extracting anything, compare `crates/zeroclaw-channels/src/mattermost.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 5) crates/zeroclaw-runtime/src/plugin_runtime.rs:974— crates/zeroclaw-runtime/src/plugin_runtime.rs:974-980 | crates/zeroclaw-runtime/src/plugin_runtime.rs:996-1002 | crates/zeroclaw-runtime/src/plugin_runtime.rs:1012-1018 | crates/zeroclaw-runtime/src/plugin_runtime.rs:1027-1033 | crates/zeroclaw-runtime/src/plugin_runtime.rs:1057-1063 — 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.
Duplicated block (7 lines × 5) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5799— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5799-5805 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5816-5822 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6017-6023 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6270-6276 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:8189-8195 — 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.
Duplicated block (7 lines × 5) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:156— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:156-162 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:214-220 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:251-257 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:289-295 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:333-339 — 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.
Duplicated block (7 lines × 5) crates/zeroclaw-runtime/src/tools/sop_advance.rs:127— crates/zeroclaw-runtime/src/tools/sop_advance.rs:127-133 | crates/zeroclaw-runtime/src/tools/sop_approve.rs:91-97 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:101-107 | crates/zeroclaw-runtime/src/tools/sop_list.rs:51-57 | crates/zeroclaw-runtime/src/tools/sop_status.rs:89-95 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/sop_advance.rs` and `crates/zeroclaw-runtime/src/tools/sop_execute.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 5) crates/zeroclaw-channels/src/discord/mod.rs:3920— crates/zeroclaw-channels/src/discord/mod.rs:3920-3926 | crates/zeroclaw-channels/src/nextcloud_talk.rs:770-776 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6480-6488 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6873-6881 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6890-6898 — before extracting anything, compare `crates/zeroclaw-channels/src/nextcloud_talk.rs` and `crates/zeroclaw-channels/src/orchestrator/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 5) crates/zeroclaw-config/src/schema/v2.rs:4003— crates/zeroclaw-config/src/schema/v2.rs:4003-4009 | crates/zeroclaw-memory/src/qdrant.rs:506-514 | crates/zeroclaw-memory/src/qdrant.rs:633-641 | crates/zeroclaw-memory/src/qdrant.rs:992-999 | crates/zeroclaw-memory/src/qdrant.rs:1101-1109 — 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.
Duplicated block (7 lines × 5) crates/zeroclaw-channels/src/telegram.rs:6403— crates/zeroclaw-channels/src/telegram.rs:6403-6409 | crates/zeroclaw-channels/src/telegram.rs:6496-6502 | crates/zeroclaw-channels/src/telegram.rs:6589-6595 | crates/zeroclaw-channels/src/telegram.rs:6638-6644 | crates/zeroclaw-channels/src/telegram.rs:6687-6693 — 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.
Chat::handle_key (cyclomatic 160) apps/zerocode/src/chat.rs:3934— Chat::handle_key has cyclomatic complexity 160 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Chat::handle_mouse (cyclomatic 100) apps/zerocode/src/chat.rs:5231— Chat::handle_mouse has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Chat::execute_context_menu_request (cyclomatic 28) apps/zerocode/src/chat.rs:3393— Chat::execute_context_menu_request 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.
Chat::after_session_start (cyclomatic 27) apps/zerocode/src/chat.rs:2391— Chat::after_session_start has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Chat::start_session_with_cancel (cyclomatic 23) apps/zerocode/src/chat.rs:2195— Chat::start_session_with_cancel 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.
Chat::close_session (cyclomatic 19) apps/zerocode/src/chat.rs:1291— Chat::close_session 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.
Chat::drain_prompt_completions (cyclomatic 18) apps/zerocode/src/chat.rs:2793— Chat::drain_prompt_completions 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.
Duplicated block (22 lines × 2) crates/zeroclaw-channels/src/lark.rs:4118— crates/zeroclaw-channels/src/lark.rs:4118-4139 | crates/zeroclaw-channels/src/lark.rs:4243-4264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) crates/zeroclaw-config/src/policy.rs:1269— crates/zeroclaw-config/src/policy.rs:1269-1290 | crates/zeroclaw-config/src/policy.rs:1304-1325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) crates/zeroclaw-providers/src/auth/mod.rs:1687— crates/zeroclaw-providers/src/auth/mod.rs:1687-1708 | crates/zeroclaw-providers/src/auth/mod.rs:1773-1794 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) crates/zeroclaw-runtime/src/live_config_authority.rs:247— crates/zeroclaw-runtime/src/live_config_authority.rs:247-268 | crates/zeroclaw-runtime/src/live_config_authority.rs:282-303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) crates/zeroclaw-runtime/src/tools/cron_add.rs:207— crates/zeroclaw-runtime/src/tools/cron_add.rs:207-228 | crates/zeroclaw-runtime/src/tools/cron_update.rs:147-168 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/cron_add.rs` and `crates/zeroclaw-runtime/src/tools/cron_update.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) src/cron/mod.rs:199— src/cron/mod.rs:199-220 | src/cron/mod.rs:374-395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) src/main.rs:10723— src/main.rs:10723-10744 | src/main.rs:12225-12246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/zeroclaw-api/src/model_provider.rs:910— crates/zeroclaw-api/src/model_provider.rs:910-920 | crates/zeroclaw-api/src/model_provider.rs:947-956 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/zeroclaw-channels/src/lark.rs:2028— crates/zeroclaw-channels/src/lark.rs:2028-2038 | crates/zeroclaw-channels/src/mattermost.rs:952-961 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/mattermost.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10–11 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:4565— crates/zeroclaw-runtime/src/agent/agent.rs:4565-4575 | crates/zeroclaw-runtime/src/agent/agent.rs:4588-4597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/zeroclaw-runtime/src/tools/skill_manage.rs:418— crates/zeroclaw-runtime/src/tools/skill_manage.rs:418-427 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:519-529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) crates/zeroclaw-tools/src/git_operations.rs:231— crates/zeroclaw-tools/src/git_operations.rs:231-241 | crates/zeroclaw-tools/src/git_operations.rs:273-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) src/main.rs:10656— src/main.rs:10656-10666 | src/main.rs:12207-12216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–11 lines × 2) xtask/src/generate/docs.rs:228— xtask/src/generate/docs.rs:228-237 | xtask/src/generate/review_docs.rs:114-124 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 5) crates/zeroclaw-channels/src/slack.rs:2377— crates/zeroclaw-channels/src/slack.rs:2377-2384 | crates/zeroclaw-channels/src/slack.rs:2395-2402 | crates/zeroclaw-channels/src/slack.rs:2426-2433 | crates/zeroclaw-channels/src/slack.rs:2440-2447 | crates/zeroclaw-channels/src/slack.rs:5084-5091 — 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.
Duplicated block (8 lines × 5) crates/zeroclaw-tools/src/jira_tool.rs:205— crates/zeroclaw-tools/src/jira_tool.rs:205-212 | crates/zeroclaw-tools/src/jira_tool.rs:277-284 | crates/zeroclaw-tools/src/jira_tool.rs:356-363 | crates/zeroclaw-tools/src/jira_tool.rs:795-802 | crates/zeroclaw-tools/src/jira_tool.rs:893-900 — 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.
Duplicated block (8 lines × 5) crates/zeroclaw-tools/src/notion_tool.rs:69— crates/zeroclaw-tools/src/notion_tool.rs:69-76 | crates/zeroclaw-tools/src/notion_tool.rs:89-96 | crates/zeroclaw-tools/src/notion_tool.rs:118-125 | crates/zeroclaw-tools/src/notion_tool.rs:144-151 | crates/zeroclaw-tools/src/notion_tool.rs:166-173 — 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.
Duplicated block (8 lines × 5) xtask/src/generate/container.rs:42— xtask/src/generate/container.rs:42-49 | xtask/src/generate/docs.rs:239-246 | xtask/src/generate/install_sh.rs:701-708 | xtask/src/generate/packaging.rs:26-33 | xtask/src/generate/setup_bat.rs:234-241 — 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 5 call sites, so a change lands once.
Duplicated block (8 lines × 5) crates/zeroclaw-channels/src/bluesky.rs:532— crates/zeroclaw-channels/src/bluesky.rs:532-539 | crates/zeroclaw-channels/src/reddit.rs:405-412 | crates/zeroclaw-channels/src/slack.rs:4351-4361 | crates/zeroclaw-hardware/src/loader.rs:96-103 | crates/zeroclaw-runtime/src/cron/scheduler.rs:559-566 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/reddit.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 5) crates/zeroclaw-channels/src/dingtalk.rs:227— crates/zeroclaw-channels/src/dingtalk.rs:227-234 | crates/zeroclaw-channels/src/dingtalk.rs:266-276 | crates/zeroclaw-channels/src/slack.rs:4305-4315 | crates/zeroclaw-channels/src/slack.rs:4333-4343 | crates/zeroclaw-channels/src/slack.rs:4367-4377 — 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.
Duplicated block (8 lines × 5) crates/zeroclaw-channels/src/whatsapp_storage.rs:456— crates/zeroclaw-channels/src/whatsapp_storage.rs:456-463 | crates/zeroclaw-channels/src/whatsapp_storage.rs:491-498 | crates/zeroclaw-channels/src/whatsapp_storage.rs:539-546 | crates/zeroclaw-channels/src/whatsapp_storage.rs:617-624 | crates/zeroclaw-channels/src/whatsapp_storage.rs:673-680 — 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.
Duplicated block (7–8 lines × 2) apps/zerocode/src/chat.rs:4549— apps/zerocode/src/chat.rs:4549-4555 | apps/zerocode/src/chat.rs:4568-4575 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) crates/zeroclaw-channels/src/matrix.rs:5097— crates/zeroclaw-channels/src/matrix.rs:5097-5103 | crates/zeroclaw-channels/src/matrix.rs:5362-5369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) crates/zeroclaw-channels/src/mattermost.rs:845— crates/zeroclaw-channels/src/mattermost.rs:845-851 | crates/zeroclaw-channels/src/mattermost.rs:920-927 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:1377— crates/zeroclaw-channels/src/orchestrator/mod.rs:1377-1383 | crates/zeroclaw-runtime/src/sop/approval/timeout.rs:46-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7–8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:16745— crates/zeroclaw-channels/src/orchestrator/mod.rs:16745-16751 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16771-16778 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) crates/zeroclaw-channels/src/whatsapp_web.rs:1931— crates/zeroclaw-channels/src/whatsapp_web.rs:1931-1937 | crates/zeroclaw-channels/src/whatsapp_web.rs:2056-2063 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–8 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5349— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5349-5356 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5545-5551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
SopPane::handle_key (cyclomatic 31) REDACTED:898— SopPane::handle_key has cyclomatic complexity 31 (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.
SopPane::render_canvas (cyclomatic 26) REDACTED:1796— SopPane::render_canvas has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SopPane::editor_lines (cyclomatic 22) REDACTED:2045— SopPane::editor_lines 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.
SopPane::handle_editor_key (cyclomatic 20) REDACTED:1193— SopPane::handle_editor_key has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SopPane::editor_backspace (cyclomatic 19) REDACTED:1488— SopPane::editor_backspace 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.
SopPane::handle_mouse (cyclomatic 18) REDACTED:960— SopPane::handle_mouse 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.
DiscordChannel::listen (cognitive 713) crates/zeroclaw-channels/src/discord/mod.rs:1993— DiscordChannel::listen has cognitive complexity 713 (threshold 15). Drivers by points: if/else 130 (557 pts), match/switch 21 (117 pts), boolean chains 29, loops 3 (10 pts) (nesting depth added 530). 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.
DiscordChannel::update_draft (cognitive 45) crates/zeroclaw-channels/src/discord/mod.rs:3555— DiscordChannel::update_draft has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 2 (5 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscordChannel::finalize_draft (cognitive 40) crates/zeroclaw-channels/src/discord/mod.rs:3733— DiscordChannel::finalize_draft has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (35 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscordChannel::send (cognitive 36) crates/zeroclaw-channels/src/discord/mod.rs:1810— DiscordChannel::send has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (29 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscordChannel::handle_reaction_event (cognitive 26) crates/zeroclaw-channels/src/discord/mod.rs:533— DiscordChannel::handle_reaction_event has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 3 (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.
DiscordChannel::sweep_message_reactions (cognitive 21) crates/zeroclaw-channels/src/discord/mod.rs:675— DiscordChannel::sweep_message_reactions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlackChannel::listen (cognitive 131) crates/zeroclaw-channels/src/slack.rs:5808— SlackChannel::listen has cognitive complexity 131 (threshold 15). Drivers by points: if/else 31 (106 pts), loops 6 (16 pts), boolean chains 5, match/switch 1 (4 pts) (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlackChannel::listen_socket_mode (cognitive 128) crates/zeroclaw-channels/src/slack.rs:4229— SlackChannel::listen_socket_mode has cognitive complexity 128 (threshold 15). Drivers by points: if/else 30 (109 pts), match/switch 4 (10 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 86). 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.
SlackChannel::fetch_thread_replies_page_with_request_budget (cognitive 26) crates/zeroclaw-channels/src/slack.rs:4916— SlackChannel::fetch_thread_replies_page_with_request_budget has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlackChannel::send (cognitive 23) crates/zeroclaw-channels/src/slack.rs:5295— SlackChannel::send has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlackChannel::render_thread_backfill_block (cognitive 20) crates/zeroclaw-channels/src/slack.rs:2333— SlackChannel::render_thread_backfill_block has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SlackChannel::fetch_slack_private_file (cognitive 16) crates/zeroclaw-channels/src/slack.rs:2928— SlackChannel::fetch_slack_private_file has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SecurityPolicy::forbidden_path_argument_impl (cognitive 74) crates/zeroclaw-config/src/policy.rs:3715— SecurityPolicy::forbidden_path_argument_impl has cognitive complexity 74 (threshold 15). Drivers by points: if/else 23 (54 pts), match/switch 4 (9 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SecurityPolicy::ensure_no_escalation_beyond (cognitive 30) crates/zeroclaw-config/src/policy.rs:4553— SecurityPolicy::ensure_no_escalation_beyond has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 6, boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SecurityPolicy::command_risk_level_for_shell (cognitive 21) crates/zeroclaw-config/src/policy.rs:3195— SecurityPolicy::command_risk_level_for_shell has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 3 (5 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SecurityPolicy::is_posix_like_command_allowed (cognitive 20) crates/zeroclaw-config/src/policy.rs:3526— SecurityPolicy::is_posix_like_command_allowed has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SecurityPolicy::is_path_allowed (cognitive 19) crates/zeroclaw-config/src/policy.rs:4026— SecurityPolicy::is_path_allowed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SecurityPolicy::is_simple_powershell_command_allowed (cognitive 16) crates/zeroclaw-config/src/policy.rs:3464— SecurityPolicy::is_simple_powershell_command_allowed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SopEngine::decide_checkpoint_with_principal (cognitive 43) crates/zeroclaw-runtime/src/sop/engine.rs:4475— SopEngine::decide_checkpoint_with_principal has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (34 pts), match/switch 5 (7 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SopEngine::restore_runs (cognitive 38) crates/zeroclaw-runtime/src/sop/engine.rs:687— SopEngine::restore_runs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 3 (6 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 21). 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.
SopEngine::evaluate_admission (cognitive 23) crates/zeroclaw-runtime/src/sop/engine.rs:2050— SopEngine::evaluate_admission has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, match/switch 3 (4 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.
SopEngine::dispatch_llm_step (cognitive 19) crates/zeroclaw-runtime/src/sop/engine.rs:3127— SopEngine::dispatch_llm_step has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SopEngine::retry_capacity_blocked_gated_pends (cognitive 16) crates/zeroclaw-runtime/src/sop/engine.rs:1450— SopEngine::retry_capacity_blocked_gated_pends has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SopEngine::deny_checkpoint (cognitive 16) crates/zeroclaw-runtime/src/sop/engine.rs:4717— SopEngine::deny_checkpoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_log::reader::matches_filter (cognitive 28) crates/zeroclaw-log/src/reader.rs:346— zeroclaw_log::reader::matches_filter has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 9, match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_log::reader::find_event_across_segments (cognitive 25) crates/zeroclaw-log/src/reader.rs:1481— zeroclaw_log::reader::find_event_across_segments has cognitive complexity 25 (threshold 15). Drivers by points: if/else 3 (10 pts), match/switch 2 (7 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_log::writer::worker_main (cognitive 25) crates/zeroclaw-log/src/writer.rs:317— zeroclaw_log::writer::worker_main has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_log::reader::scan_segment (cognitive 23) crates/zeroclaw-log/src/reader.rs:775— zeroclaw_log::reader::scan_segment has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (8 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_log::reader::list_archives_reporting (cognitive 22) crates/zeroclaw-log/src/reader.rs:568— zeroclaw_log::reader::list_archives_reporting has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 3 (5 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_log::reader::load_page (cognitive 17) crates/zeroclaw-log/src/reader.rs:228— zeroclaw_log::reader::load_page has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Change coupling: loop_.rs ↔ vision_route.rs crates/zeroclaw-runtime/src/agent/loop_.rs:1— `crates/zeroclaw-runtime/src/agent/loop_.rs` and `crates/zeroclaw-runtime/src/agent/turn/vision_route.rs` 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; 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 `8a7b3977` feat(runtime): add effort-aware local and cloud routing (#11516); `638d0f63` fix(runtime): gate the no-vision error on image markers that resolve …; `360bcaaf` fix(multimodal): add pixel-level image validation to prevent corrupt … — run `git show` on any of them.
Change coupling: safety_net.rs ↔ review.rs crates/zeroclaw-runtime/src/agent/safety_net.rs:1— `crates/zeroclaw-runtime/src/agent/safety_net.rs` and `crates/zeroclaw-runtime/src/skills/review.rs` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `638d0f63` fix(runtime): gate the no-vision error on image markers that resolve …; `e40f153f` refactor(runtime): seal the engine tool registry as ScopedToolRegistr…; `fc221043` fix(providers): make model vision capability configurable (#9099) — run `git show` on any of them.
Change coupling: loop_.rs ↔ model_switch.rs crates/zeroclaw-runtime/src/agent/loop_.rs:1— `crates/zeroclaw-runtime/src/agent/loop_.rs` and `crates/zeroclaw-runtime/src/tools/model_switch.rs` 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither 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 `8a7b3977` feat(runtime): add effort-aware local and cloud routing (#11516); `5c580223` fix(runtime): keep agent dispatch panic-free (#10134); `9dd4bca4` fix(runtime): isolate model switches per turn (#9232) — run `git show` on any of them.
Change coupling: attribution.rs ↔ catalog.rs crates/zeroclaw-api/src/attribution.rs:1— `crates/zeroclaw-api/src/attribution.rs` and `crates/zeroclaw-providers/src/catalog.rs` 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither 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 `a674d03d` feat(provider): add Crusoe Managed Inference as first-class OpenAI-co…; `88f5ff20` feat(providers): add ZeroRouter preset and public catalog (#9645); `34ebc12e` feat(providers): add Grok Build ACP model provider (#9104) — run `git show` on any of them.
Change coupling: line.rs ↔ wechat.rs crates/zeroclaw-channels/src/line.rs:1— `crates/zeroclaw-channels/src/line.rs` and `crates/zeroclaw-channels/src/wechat.rs` 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) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `7eb00567` fix(gateway): one shared pairing-code policy, stronger default (#10307); `a5b8c714` refactor(channels): share one status check for the copy-pasted vendor…; `6c2be72b` feat(channels): operator-bind identities without the /bind code round… — run `git show` on any of them.
Change coupling: prompt.rs ↔ skill_http.rs crates/zeroclaw-runtime/src/agent/prompt.rs:1— `crates/zeroclaw-runtime/src/agent/prompt.rs` and `crates/zeroclaw-runtime/src/tools/skill_http.rs` 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither 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 `87cc136c` feat(runtime)!: bound skill HTTP egress (#10369); `ec785d69` fix(skills): respect timeout_secs from SKILL.toml (#7552); `3ff690f2` feat(skills): scoped tool elevation for built-in and MCP tools — run `git show` on any of them.
Duplicated block (23 lines × 2) apps/zerocode/src/osc_status.rs:428— apps/zerocode/src/osc_status.rs:428-450 | src/plugins/update.rs:140-162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23 lines × 2) crates/zeroclaw-memory/src/lucid.rs:416— crates/zeroclaw-memory/src/lucid.rs:416-438 | crates/zeroclaw-memory/src/markdown.rs:205-227 — 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 (23 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:2006— crates/zeroclaw-runtime/src/agent/turn/mod.rs:2006-2028 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3582-3604 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:59— crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:59-81 | crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:172-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) src/main.rs:15437— src/main.rs:15437-15459 | src/main.rs:15472-15494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) src/memory/cli.rs:186— src/memory/cli.rs:186-208 | src/memory/cli.rs:402-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) crates/zeroclaw-channels/src/slack.rs:1281— crates/zeroclaw-channels/src/slack.rs:1281-1296 | crates/zeroclaw-channels/src/slack.rs:5389-5405 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) crates/zeroclaw-channels/src/voice_wake.rs:348— crates/zeroclaw-channels/src/voice_wake.rs:348-364 | crates/zeroclaw-channels/src/voice_wake.rs:423-438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) crates/zeroclaw-config/src/schema.rs:12326— crates/zeroclaw-config/src/schema.rs:12326-12342 | crates/zeroclaw-config/src/schema.rs:12487-12502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) crates/zeroclaw-providers/src/auth/mod.rs:1484— crates/zeroclaw-providers/src/auth/mod.rs:1484-1500 | crates/zeroclaw-providers/src/auth/mod.rs:1551-1566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–17 lines × 2) crates/zeroclaw-runtime/src/skills/document.rs:124— crates/zeroclaw-runtime/src/skills/document.rs:124-139 | crates/zeroclaw-runtime/src/skills/mod.rs:1485-1501 — 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 (16–17 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:1736— crates/zeroclaw-runtime/src/tools/delegate.rs:1736-1752 | crates/zeroclaw-runtime/src/tools/delegate.rs:1779-1794 — both copies are in the same file, so extract the 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–15 lines × 2) apps/zerocode/src/dashboard.rs:1323— apps/zerocode/src/dashboard.rs:1323-1336 | apps/zerocode/src/dashboard.rs:3213-3227 — both copies are in the same file, so extract the 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–15 lines × 2) apps/zerocode/src/dashboard.rs:1341— apps/zerocode/src/dashboard.rs:1341-1354 | apps/zerocode/src/dashboard.rs:3234-3248 — both copies are in the same file, so extract the 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–15 lines × 2) apps/zerorelay/src/enroll_route.rs:247— apps/zerorelay/src/enroll_route.rs:247-260 | apps/zerorelay/src/lib.rs:1616-1630 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14–15 lines × 2) crates/zeroclaw-channels/src/acp_channel.rs:134— crates/zeroclaw-channels/src/acp_channel.rs:134-148 | crates/zeroclaw-runtime/src/rpc/approval_channel.rs:226-239 — before extracting anything, compare `crates/zeroclaw-channels/src/acp_channel.rs` and `crates/zeroclaw-runtime/src/rpc/approval_channel.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–15 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:16349— crates/zeroclaw-channels/src/orchestrator/mod.rs:16349-16363 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17395-17408 — both copies are in the same file, so extract the 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–15 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:2932— crates/zeroclaw-providers/src/anthropic.rs:2932-2945 | crates/zeroclaw-providers/src/anthropic.rs:3085-3099 — both copies are in the same file, so extract the 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–13 lines × 2) apps/zerocode/src/chat.rs:2570— apps/zerocode/src/chat.rs:2570-2582 | apps/zerocode/src/chat.rs:2585-2596 — both copies are in the same file, so extract the 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–13 lines × 2) apps/zerocode/src/config_manager.rs:3700— apps/zerocode/src/config_manager.rs:3700-3711 | apps/zerocode/src/config_manager.rs:3792-3804 — both copies are in the same file, so extract the 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–13 lines × 2) crates/zeroclaw-memory/src/qdrant.rs:157— crates/zeroclaw-memory/src/qdrant.rs:157-168 | crates/zeroclaw-memory/src/qdrant.rs:860-872 — both copies are in the same file, so extract the 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–13 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:2707— crates/zeroclaw-providers/src/anthropic.rs:2707-2718 | crates/zeroclaw-providers/src/anthropic.rs:2789-2801 — both copies are in the same file, so extract the 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–13 lines × 2) crates/zeroclaw-providers/src/auth/mod.rs:1430— crates/zeroclaw-providers/src/auth/mod.rs:1430-1442 | crates/zeroclaw-providers/src/auth/mod.rs:1491-1502 — both copies are in the same file, so extract the 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–13 lines × 2) src/main.rs:15582— src/main.rs:15582-15593 | src/main.rs:15601-15613 — both copies are in the same file, so extract the 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 × 3) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:75— crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:75-86 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:135-146 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:162-173 — `crates/zeroclaw-channels/src/git/providers/gitea/provider.rs` and `crates/zeroclaw-channels/src/git/providers/github/provider.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 52 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (12 lines × 3) crates/zeroclaw-gateway/src/lib.rs:128— crates/zeroclaw-gateway/src/lib.rs:128-139 | crates/zeroclaw-runtime/src/rpc/local.rs:154-165 | crates/zeroclaw-runtime/src/rpc/wss.rs:605-616 — before extracting anything, compare `crates/zeroclaw-runtime/src/rpc/local.rs` and `crates/zeroclaw-runtime/src/rpc/wss.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 3) crates/zeroclaw-runtime/src/tools/delegate.rs:2816— crates/zeroclaw-runtime/src/tools/delegate.rs:2816-2827 | crates/zeroclaw-runtime/src/tools/delegate.rs:3144-3155 | crates/zeroclaw-runtime/src/tools/delegate.rs:3693-3704 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) crates/zeroclaw-tools/src/backup_tool.rs:1030— crates/zeroclaw-tools/src/backup_tool.rs:1030-1041 | crates/zeroclaw-tools/src/backup_tool.rs:1070-1081 | crates/zeroclaw-tools/src/backup_tool.rs:1195-1206 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) crates/zeroclaw-tools/src/reaction.rs:78— crates/zeroclaw-tools/src/reaction.rs:78-89 | crates/zeroclaw-tools/src/sessions.rs:881-892 | crates/zeroclaw-tools/src/sessions.rs:1002-1013 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (12 lines × 3) crates/zeroclaw-runtime/src/security/bubblewrap.rs:43— crates/zeroclaw-runtime/src/security/bubblewrap.rs:43-54 | crates/zeroclaw-runtime/src/security/docker.rs:67-78 | crates/zeroclaw-runtime/src/security/firejail.rs:142-153 — before extracting anything, compare `crates/zeroclaw-runtime/src/security/bubblewrap.rs` and `crates/zeroclaw-runtime/src/security/firejail.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 4) crates/zeroclaw-runtime/src/tools/cron_remove.rs:89— crates/zeroclaw-runtime/src/tools/cron_remove.rs:89-97 | crates/zeroclaw-runtime/src/tools/cron_run.rs:144-152 | crates/zeroclaw-runtime/src/tools/cron_runs.rs:74-82 | crates/zeroclaw-runtime/src/tools/cron_update.rs:224-232 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (9 lines × 4) crates/zeroclaw-tools/src/notion_tool.rs:67— crates/zeroclaw-tools/src/notion_tool.rs:67-75 | crates/zeroclaw-tools/src/notion_tool.rs:116-124 | crates/zeroclaw-tools/src/notion_tool.rs:142-150 | crates/zeroclaw-tools/src/notion_tool.rs:164-172 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) crates/zeroclaw-channels/src/matrix.rs:3535— crates/zeroclaw-channels/src/matrix.rs:3535-3543 | crates/zeroclaw-channels/src/matrix.rs:3552-3563 | crates/zeroclaw-channels/src/matrix.rs:3571-3582 | crates/zeroclaw-channels/src/matrix.rs:3599-3607 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) crates/zeroclaw-channels/src/slack.rs:3365— crates/zeroclaw-channels/src/slack.rs:3365-3373 | crates/zeroclaw-channels/src/slack.rs:3378-3386 | crates/zeroclaw-channels/src/slack.rs:3397-3405 | crates/zeroclaw-channels/src/slack.rs:3413-3421 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) crates/zeroclaw-tools/src/linkedin_client.rs:321— crates/zeroclaw-tools/src/linkedin_client.rs:321-329 | crates/zeroclaw-tools/src/linkedin_client.rs:454-462 | crates/zeroclaw-tools/src/linkedin_client.rs:498-506 | crates/zeroclaw-tools/src/linkedin_client.rs:564-572 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) crates/zeroclaw-plugins/src/wasm_channel.rs:1431— crates/zeroclaw-plugins/src/wasm_channel.rs:1431-1439 | crates/zeroclaw-plugins/src/wasm_channel.rs:1512-1520 | crates/zeroclaw-plugins/src/wasm_channel.rs:1533-1541 | crates/zeroclaw-plugins/src/wasm_channel.rs:1559-1567 — 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.
Off the main sequence: zeroclaw-commands — zeroclaw-commands: 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.
Off the main sequence: zeroclaw-relay-proto — zeroclaw-relay-proto: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
Off the main sequence: zeroclaw-sop-graph — zeroclaw-sop-graph: 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.
Off the main sequence: zeroclaw-api — zeroclaw-api: abstractness 0.09, instability 0.00, distance 0.91 — zone of pain — concrete and depended on by 17 project(s), so it's rigid to change.
Off the main sequence: zeroclaw-log — zeroclaw-log: abstractness 0.04, instability 0.07, distance 0.90 — zone of pain — concrete and depended on by 14 project(s), so it's rigid to change.
Off the main sequence: zeroclaw-tls — zeroclaw-tls: abstractness 0.09, instability 0.20, distance 0.71 — zone of pain — concrete and depended on by 4 project(s), so it's rigid to change.
AC3 · Page structure· Page without a main landmark · ×5
Page without a main landmark .claude/skills/skill-creator/assets/eval_review.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark .claude/skills/skill-creator/eval-viewer/viewer.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark apps/tauri/splash/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark crates/zeroclaw-gateway/src/openapi_docs.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark web/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
DiscordChannel::listen (cyclomatic 174) crates/zeroclaw-channels/src/discord/mod.rs:1993— DiscordChannel::listen has cyclomatic complexity 174 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DiscordChannel::send (cyclomatic 22) crates/zeroclaw-channels/src/discord/mod.rs:1810— DiscordChannel::send 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.
DiscordChannel::update_draft (cyclomatic 22) crates/zeroclaw-channels/src/discord/mod.rs:3555— DiscordChannel::update_draft 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.
DiscordChannel::handle_reaction_event (cyclomatic 20) crates/zeroclaw-channels/src/discord/mod.rs:533— DiscordChannel::handle_reaction_event has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DiscordChannel::finalize_draft (cyclomatic 18) crates/zeroclaw-channels/src/discord/mod.rs:3733— DiscordChannel::finalize_draft 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.
zeroclaw_tools::embedded_resource::format_mcp_tool_result_for_model (cyclomatic 26) crates/zeroclaw-tools/src/embedded_resource.rs:538— zeroclaw_tools::embedded_resource::format_mcp_tool_result_for_model has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_tools::content_search::format_line_output (cyclomatic 25) crates/zeroclaw-tools/src/content_search.rs:863— zeroclaw_tools::content_search::format_line_output 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.
zeroclaw_tools::mcp_transport::read_first_jsonrpc_from_sse_response (cyclomatic 20) crates/zeroclaw-tools/src/mcp_transport.rs:1845— zeroclaw_tools::mcp_transport::read_first_jsonrpc_from_sse_response 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.
zeroclaw_tools::jira_tool::parse_inline (cyclomatic 19) crates/zeroclaw-tools/src/jira_tool.rs:1520— zeroclaw_tools::jira_tool::parse_inline 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.
zeroclaw_tools::content_search::visit_internal_search_path (cyclomatic 18) crates/zeroclaw-tools/src/content_search.rs:496— zeroclaw_tools::content_search::visit_internal_search_path 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.
AcpSessionStore::provider_safe_history (cognitive 41) REDACTED:2645— AcpSessionStore::provider_safe_history has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 3 (9 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AcpSessionStore::load_message_page (cognitive 26) REDACTED:852— AcpSessionStore::load_message_page has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, loops 2, 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.
AcpSessionStore::insert_messages (cognitive 26) REDACTED:1606— AcpSessionStore::insert_messages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (7 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AcpSessionStore::fold_checkpoint_fragments (cognitive 24) REDACTED:2554— AcpSessionStore::fold_checkpoint_fragments has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AcpSessionStore::load_messages (cognitive 22) REDACTED:1363— AcpSessionStore::load_messages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InputBarState::handle_mouse (cognitive 38) apps/zerocode/src/input_bar.rs:1805— InputBarState::handle_mouse has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (27 pts), match/switch 3 (5 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InputBarState::handle_key (cognitive 36) apps/zerocode/src/input_bar.rs:1534— InputBarState::handle_key has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (22 pts), match/switch 3 (6 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InputBarState::handle_enter (cognitive 31) apps/zerocode/src/input_bar.rs:1943— InputBarState::handle_enter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 2 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InputBarState::render (cognitive 31) apps/zerocode/src/input_bar.rs:2217— InputBarState::render has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InputBarState::build_input_lines (cognitive 17) apps/zerocode/src/input_bar.rs:2164— InputBarState::build_input_lines has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAiCompatibleModelProvider::stream_chat (cognitive 32) crates/zeroclaw-providers/src/compatible.rs:4610— OpenAiCompatibleModelProvider::stream_chat has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (19 pts), match/switch 6 (9 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAiCompatibleModelProvider::stream_chat_with_system (cognitive 20) crates/zeroclaw-providers/src/compatible.rs:4866— OpenAiCompatibleModelProvider::stream_chat_with_system has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), match/switch 6 (8 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.
OpenAiCompatibleModelProvider::apply_cache_breakpoints (cognitive 18) crates/zeroclaw-providers/src/compatible.rs:1196— OpenAiCompatibleModelProvider::apply_cache_breakpoints has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAiCompatibleModelProvider::flatten_system_messages (cognitive 16) crates/zeroclaw-providers/src/compatible.rs:974— OpenAiCompatibleModelProvider::flatten_system_messages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAiCompatibleModelProvider::strip_native_tool_messages (cognitive 16) crates/zeroclaw-providers/src/compatible.rs:3684— OpenAiCompatibleModelProvider::strip_native_tool_messages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (31 lines × 2) crates/zeroclaw-config/src/policy.rs:1981— crates/zeroclaw-config/src/policy.rs:1981-2011 | crates/zeroclaw-config/src/policy.rs:2035-2065 — both copies are in the same file, so extract the 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 (31 lines × 2) crates/zeroclaw-memory/src/hygiene.rs:225— crates/zeroclaw-memory/src/hygiene.rs:225-255 | crates/zeroclaw-memory/src/hygiene.rs:318-348 — both copies are in the same file, so extract the 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 (31 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1681— crates/zeroclaw-runtime/src/agent/loop_.rs:1681-1711 | crates/zeroclaw-runtime/src/agent/loop_.rs:3725-3755 — both copies are in the same file, so extract the 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 (31 lines × 2) crates/zeroclaw-runtime/src/sop/dispatch.rs:878— crates/zeroclaw-runtime/src/sop/dispatch.rs:878-908 | crates/zeroclaw-runtime/src/sop/dispatch.rs:927-957 — both copies are in the same file, so extract the 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 (31 lines × 2) crates/zeroclaw-tools/src/file_upload.rs:176— crates/zeroclaw-tools/src/file_upload.rs:176-206 | crates/zeroclaw-tools/src/file_upload_bundle.rs:231-261 — before extracting anything, compare `crates/zeroclaw-tools/src/file_upload.rs` and `crates/zeroclaw-tools/src/file_upload_bundle.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11–14 lines × 2) crates/zeroclaw-channels/src/email_channel.rs:86— crates/zeroclaw-channels/src/email_channel.rs:86-99 | crates/zeroclaw-channels/src/gmail_push.rs:373-383 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11–14 lines × 2) crates/zeroclaw-channels/src/slack.rs:4241— crates/zeroclaw-channels/src/slack.rs:4241-4251 | crates/zeroclaw-channels/src/slack.rs:4267-4280 — both copies are in the same file, so extract the 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–14 lines × 2) crates/zeroclaw-gateway/src/api_oidc.rs:453— crates/zeroclaw-gateway/src/api_oidc.rs:453-463 | crates/zeroclaw-gateway/src/api_oidc.rs:563-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–14 lines × 2) crates/zeroclaw-providers/src/hailo_ollama.rs:151— crates/zeroclaw-providers/src/hailo_ollama.rs:151-161 | crates/zeroclaw-providers/src/hailo_ollama.rs:320-333 — both copies are in the same file, so extract the 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–14 lines × 2) crates/zeroclaw-runtime/src/doctor/mod.rs:1305— crates/zeroclaw-runtime/src/doctor/mod.rs:1305-1318 | crates/zeroclaw-runtime/src/doctor/mod.rs:1340-1350 — both copies are in the same file, so extract the 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 × 4) crates/zeroclaw-runtime/src/i18n.rs:210— crates/zeroclaw-runtime/src/i18n.rs:210-220 | crates/zeroclaw-runtime/src/i18n.rs:248-258 | crates/zeroclaw-tools/src/i18n.rs:79-89 | crates/zeroclaw-tools/src/i18n.rs:117-127 — before extracting anything, compare `crates/zeroclaw-runtime/src/i18n.rs` and `crates/zeroclaw-tools/src/i18n.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 69 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 4) crates/zeroclaw-tools/src/sessions.rs:432— crates/zeroclaw-tools/src/sessions.rs:432-442 | crates/zeroclaw-tools/src/sessions.rs:630-640 | crates/zeroclaw-tools/src/sessions.rs:883-893 | crates/zeroclaw-tools/src/sessions.rs:1004-1014 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:3611— crates/zeroclaw-channels/src/discord/mod.rs:3611-3621 | crates/zeroclaw-channels/src/signal.rs:827-839 | crates/zeroclaw-channels/src/signal.rs:870-880 | crates/zeroclaw-tools/src/microsoft365/auth.rs:114-124 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11 lines × 4) crates/zeroclaw-runtime/src/skills/mod.rs:503— crates/zeroclaw-runtime/src/skills/mod.rs:503-513 | crates/zeroclaw-runtime/src/skills/mod.rs:1188-1198 | crates/zeroclaw-runtime/src/skills/mod.rs:2991-3001 | crates/zeroclaw-runtime/src/skills/mod.rs:3206-3216 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) crates/zeroclaw-tools/src/jira_tool.rs:1151— crates/zeroclaw-tools/src/jira_tool.rs:1151-1161 | crates/zeroclaw-tools/src/jira_tool.rs:1220-1230 | crates/zeroclaw-tools/src/jira_tool.rs:1232-1242 | crates/zeroclaw-tools/src/jira_tool.rs:1244-1254 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–9 lines × 2) crates/zeroclaw-providers/src/grok_cli/acp.rs:456— crates/zeroclaw-providers/src/grok_cli/acp.rs:456-464 | crates/zeroclaw-providers/src/grok_cli/acp.rs:686-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–9 lines × 2) crates/zeroclaw-runtime/src/skills/creator.rs:400— crates/zeroclaw-runtime/src/skills/creator.rs:400-408 | crates/zeroclaw-runtime/src/skills/creator.rs:434-440 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–9 lines × 2) crates/zeroclaw-runtime/src/tools/sop_advance.rs:127— crates/zeroclaw-runtime/src/tools/sop_advance.rs:127-135 | crates/zeroclaw-runtime/src/tools/sop_list.rs:51-57 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7–9 lines × 2) crates/zeroclaw-tools/src/jira_tool.rs:604— crates/zeroclaw-tools/src/jira_tool.rs:604-610 | crates/zeroclaw-tools/src/jira_tool.rs:693-701 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–9 lines × 2) crates/zeroclaw-tools/src/web_search_tool.rs:1161— crates/zeroclaw-tools/src/web_search_tool.rs:1161-1169 | crates/zeroclaw-tools/src/web_search_tool.rs:1542-1548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 5) crates/zeroclaw-channels/src/telegram.rs:7781— crates/zeroclaw-channels/src/telegram.rs:7781-7787 | crates/zeroclaw-hardware/src/loader.rs:22-27 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1613-1618 | crates/zeroclaw-tools/src/tool_search.rs:265-270 | crates/zeroclaw-tools/src/tool_search.rs:357-362 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6 lines × 5) crates/zeroclaw-runtime/src/observability/log.rs:60— crates/zeroclaw-runtime/src/observability/log.rs:60-65 | crates/zeroclaw-runtime/src/observability/log.rs:118-130 | crates/zeroclaw-runtime/src/observability/log.rs:142-150 | crates/zeroclaw-runtime/src/observability/log.rs:184-192 | crates/zeroclaw-runtime/src/observability/log.rs:217-222 — 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.
Duplicated block (6 lines × 5) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5318— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5318-5323 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5800-5805 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5817-5822 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6018-6023 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:8190-8195 — 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.
Duplicated block (6 lines × 5) crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:134— crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:134-140 | crates/zeroclaw-runtime/src/tunnel/custom.rs:132-137 | crates/zeroclaw-runtime/src/tunnel/ngrok.rs:127-132 | crates/zeroclaw-runtime/src/tunnel/openvpn.rs:165-170 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:182-187 — before extracting anything, compare `crates/zeroclaw-runtime/src/tunnel/cloudflare.rs` and `crates/zeroclaw-runtime/src/tunnel/ngrok.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 5) crates/zeroclaw-channels/src/slack.rs:2165— crates/zeroclaw-channels/src/slack.rs:2165-2172 | crates/zeroclaw-channels/src/slack.rs:2860-2867 | crates/zeroclaw-channels/src/slack.rs:2932-2937 | crates/zeroclaw-channels/src/slack.rs:2952-2957 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1631-1641 — 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.
Duplicated block (5 lines × 7) crates/zeroclaw-channels/src/notion.rs:498— crates/zeroclaw-channels/src/notion.rs:498-502 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11210-11217 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15033-15037 | crates/zeroclaw-gateway/src/ws.rs:714-718 | crates/zeroclaw-runtime/src/observability/mod.rs:398-405 | crates/zeroclaw-runtime/src/tools/mod.rs:2936-2940 | crates/zeroclaw-runtime/src/tools/mod.rs:2968-2973 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-gateway/src/ws.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 7) crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:70— crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:70-75 | crates/zeroclaw-runtime/src/tunnel/ngrok.rs:57-62 | crates/zeroclaw-runtime/src/tunnel/openvpn.rs:71-76 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:69-74 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:81-86 | crates/zeroclaw-tools/src/mcp_transport.rs:629-633 | crates/zeroclaw-tools/src/mcp_transport.rs:642-646 — before extracting anything, compare `crates/zeroclaw-runtime/src/tunnel/cloudflare.rs` and `crates/zeroclaw-runtime/src/tunnel/ngrok.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 7) crates/zeroclaw-channels/src/matrix.rs:4799— crates/zeroclaw-channels/src/matrix.rs:4799-4803 | crates/zeroclaw-channels/src/matrix.rs:5133-5142 | crates/zeroclaw-channels/src/matrix.rs:5182-5189 | crates/zeroclaw-channels/src/matrix.rs:5266-5273 | crates/zeroclaw-channels/src/telegram.rs:7008-7015 | crates/zeroclaw-runtime/src/sop/executor.rs:1409-1413 | crates/zeroclaw-runtime/src/sop/executor.rs:1420-1424 — there are 7 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 7) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:682— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:682-687 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:953-958 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1187-1192 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1210-1214 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1524-1529 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1547-1551 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2414-2418 — 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.
Duplicated block (5 lines × 7) crates/zeroclaw-tools/src/microsoft365/mod.rs:125— crates/zeroclaw-tools/src/microsoft365/mod.rs:125-129 | crates/zeroclaw-tools/src/microsoft365/mod.rs:175-179 | crates/zeroclaw-tools/src/microsoft365/mod.rs:258-262 | crates/zeroclaw-tools/src/microsoft365/mod.rs:315-319 | crates/zeroclaw-tools/src/microsoft365/mod.rs:426-430 | crates/zeroclaw-tools/src/microsoft365/mod.rs:482-486 | crates/zeroclaw-tools/src/microsoft365/mod.rs:556-560 — 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.
Low cohesion: WasmMemory (LCOM4 7) crates/zeroclaw-plugins/src/wasm_memory.rs:38— WasmMemory's methods fall into 7 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 7 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: PairingGuard (LCOM4 5) crates/zeroclaw-config/src/pairing.rs:357— PairingGuard'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: Event (LCOM4 5) crates/zeroclaw-log/src/event.rs:502— Event'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: PluginState (LCOM4 5) crates/zeroclaw-plugins/src/component.rs:211— PluginState'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: PluginStateStore (LCOM4 4) crates/zeroclaw-runtime/src/plugin_state.rs:49— PluginStateStore'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.
Config::validate (cyclomatic 276) crates/zeroclaw-config/src/schema.rs:24274— Config::validate has cyclomatic complexity 276 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Config::load_or_init (cyclomatic 22) crates/zeroclaw-config/src/schema.rs:22920— Config::load_or_init 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.
Config::validate_auth (cyclomatic 18) crates/zeroclaw-config/src/schema.rs:14228— Config::validate_auth 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.
Config::collect_context_compression_ignored_warnings (cyclomatic 18) crates/zeroclaw-config/src/schema.rs:23874— Config::collect_context_compression_ignored_warnings 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.
zeroclaw_tool_call_parser::parse_tool_calls (cyclomatic 98) crates/zeroclaw-tool-call-parser/src/lib.rs:2090— zeroclaw_tool_call_parser::parse_tool_calls has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_tool_call_parser::parse_glm_shortened_body (cyclomatic 30) crates/zeroclaw-tool-call-parser/src/lib.rs:1727— zeroclaw_tool_call_parser::parse_glm_shortened_body has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_tool_call_parser::decode_recovered_json_string_fragment (cyclomatic 19) crates/zeroclaw-tool-call-parser/src/lib.rs:1206— zeroclaw_tool_call_parser::decode_recovered_json_string_fragment 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.
zeroclaw_tool_call_parser::parse_glm_style_tool_calls (cyclomatic 16) crates/zeroclaw-tool-call-parser/src/lib.rs:1648— zeroclaw_tool_call_parser::parse_glm_style_tool_calls 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.
InputBarState::handle_key (cyclomatic 55) apps/zerocode/src/input_bar.rs:1534— InputBarState::handle_key has cyclomatic complexity 55 (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.
InputBarState::handle_mouse (cyclomatic 29) apps/zerocode/src/input_bar.rs:1805— InputBarState::handle_mouse has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InputBarState::handle_enter (cyclomatic 22) apps/zerocode/src/input_bar.rs:1943— InputBarState::handle_enter 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.
InputBarState::render (cyclomatic 20) apps/zerocode/src/input_bar.rs:2217— InputBarState::render 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.
SecurityPolicy::forbidden_path_argument_impl (cyclomatic 41) crates/zeroclaw-config/src/policy.rs:3715— SecurityPolicy::forbidden_path_argument_impl has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SecurityPolicy::ensure_no_escalation_beyond (cyclomatic 25) crates/zeroclaw-config/src/policy.rs:4553— SecurityPolicy::ensure_no_escalation_beyond 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.
SecurityPolicy::command_risk_level_for_shell (cyclomatic 20) crates/zeroclaw-config/src/policy.rs:3195— SecurityPolicy::command_risk_level_for_shell has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
SecurityPolicy::is_posix_like_command_allowed (cyclomatic 17) crates/zeroclaw-config/src/policy.rs:3526— SecurityPolicy::is_posix_like_command_allowed 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.
ReliableModelProvider::chat_with_tool_round_policy (cyclomatic 33) crates/zeroclaw-providers/src/reliable.rs:3594— ReliableModelProvider::chat_with_tool_round_policy has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReliableModelProvider::chat_with_tools (cyclomatic 30) crates/zeroclaw-providers/src/reliable.rs:3251— ReliableModelProvider::chat_with_tools has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReliableModelProvider::chat_with_system (cyclomatic 25) crates/zeroclaw-providers/src/reliable.rs:2520— ReliableModelProvider::chat_with_system 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.
ReliableModelProvider::chat_with_history (cyclomatic 25) crates/zeroclaw-providers/src/reliable.rs:2820— ReliableModelProvider::chat_with_history 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.
AcpServer::handle_session_prompt (cyclomatic 30) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1878— AcpServer::handle_session_prompt has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AcpServer::handle_session_load (cyclomatic 22) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1153— AcpServer::handle_session_load has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AcpServer::materialize_prompt (cyclomatic 18) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2916— AcpServer::materialize_prompt 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.
AcpServer::handle_session_resume (cyclomatic 16) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1495— AcpServer::handle_session_resume 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.
SopEngine::decide_checkpoint_with_principal (cyclomatic 29) crates/zeroclaw-runtime/src/sop/engine.rs:4475— SopEngine::decide_checkpoint_with_principal has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SopEngine::restore_runs (cyclomatic 17) crates/zeroclaw-runtime/src/sop/engine.rs:687— SopEngine::restore_runs 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.
SopEngine::evaluate_admission (cyclomatic 17) crates/zeroclaw-runtime/src/sop/engine.rs:2050— SopEngine::evaluate_admission 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.
SopEngine::dispatch_llm_step (cyclomatic 16) crates/zeroclaw-runtime/src/sop/engine.rs:3127— SopEngine::dispatch_llm_step 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.
Dashboard::poll_data (cyclomatic 24) apps/zerocode/src/dashboard.rs:290— Dashboard::poll_data 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. This is NOT this file's highest cyclomatic complexity: Dashboard::handle_normal_key (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Dashboard::draw_cron_detail (cyclomatic 22) apps/zerocode/src/dashboard.rs:1694— Dashboard::draw_cron_detail 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. This is NOT this file's highest cyclomatic complexity: Dashboard::handle_normal_key (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Dashboard::draw_health (cyclomatic 21) apps/zerocode/src/dashboard.rs:1287— Dashboard::draw_health has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Dashboard::handle_normal_key (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
Dashboard::handle_mouse (cyclomatic 20) apps/zerocode/src/dashboard.rs:2422— Dashboard::handle_mouse has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Dashboard::handle_normal_key (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
GitOperationsTool::execute (cyclomatic 21) crates/zeroclaw-tools/src/git_operations.rs:2055— GitOperationsTool::execute has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
GitOperationsTool::validate_metadata_tree (cyclomatic 19) crates/zeroclaw-tools/src/git_operations.rs:435— GitOperationsTool::validate_metadata_tree 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.
GitOperationsTool::validate_metadata_config (cyclomatic 17) crates/zeroclaw-tools/src/git_operations.rs:588— GitOperationsTool::validate_metadata_config 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.
GitOperationsTool::validate_metadata_closure (cyclomatic 16) crates/zeroclaw-tools/src/git_operations.rs:305— GitOperationsTool::validate_metadata_closure 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.
QuickstartPane::handle_modal_key (cognitive 152) apps/zerocode/src/quickstart_pane.rs:1610— QuickstartPane::handle_modal_key has cognitive complexity 152 (threshold 15). Drivers by points: if/else 41 (114 pts), match/switch 11 (25 pts), boolean chains 8, loops 1 (5 pts) (nesting depth added 91). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QuickstartPane::handle_mouse (cognitive 31) apps/zerocode/src/quickstart_pane.rs:1314— QuickstartPane::handle_mouse has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (27 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 18). 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.
QuickstartPane::commit_field_form (cognitive 23) apps/zerocode/src/quickstart_pane.rs:2276— QuickstartPane::commit_field_form has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QuickstartPane::handle_key (cognitive 18) apps/zerocode/src/quickstart_pane.rs:1216— QuickstartPane::handle_key has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1, 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.
Agent::turn_streamed_with_steering_body (cognitive 132) crates/zeroclaw-runtime/src/agent/agent.rs:4444— Agent::turn_streamed_with_steering_body has cognitive complexity 132 (threshold 15). Drivers by points: if/else 36 (101 pts), match/switch 7 (17 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 79). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent::replay_loop_messages (cognitive 29) crates/zeroclaw-runtime/src/agent/agent.rs:3749— Agent::replay_loop_messages has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Agent::from_config_with_session_cwd_and_mcp_approval_mode (cognitive 24) crates/zeroclaw-runtime/src/agent/agent.rs:2802— Agent::from_config_with_session_cwd_and_mcp_approval_mode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20 (21 pts), match/switch 3 (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.
Agent::turn (cognitive 19) crates/zeroclaw-runtime/src/agent/agent.rs:3925— Agent::turn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, match/switch 3, loops 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AnthropicModelProvider::parse_anthropic_sse_from_reader (cognitive 116) crates/zeroclaw-providers/src/anthropic.rs:2449— AnthropicModelProvider::parse_anthropic_sse_from_reader has cognitive complexity 116 (threshold 15). Drivers by points: if/else 29 (97 pts), match/switch 5 (13 pts), boolean chains 5, loops 1 (nesting depth added 76). 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.
AnthropicModelProvider::stream_chat_with_tool_round_policy (cognitive 60) crates/zeroclaw-providers/src/anthropic.rs:3219— AnthropicModelProvider::stream_chat_with_tool_round_policy has cognitive complexity 60 (threshold 15). Drivers by points: if/else 26 (42 pts), match/switch 6 (8 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnthropicModelProvider::convert_messages (cognitive 56) crates/zeroclaw-providers/src/anthropic.rs:1371— AnthropicModelProvider::convert_messages has cognitive complexity 56 (threshold 15). Drivers by points: if/else 18 (36 pts), match/switch 4 (14 pts), loops 2 (4 pts), 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.
AnthropicModelProvider::parse_native_response (cognitive 19) crates/zeroclaw-providers/src/anthropic.rs:2126— AnthropicModelProvider::parse_native_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, match/switch 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.
ReliableModelProvider::chat_with_tool_round_policy (cognitive 111) crates/zeroclaw-providers/src/reliable.rs:3594— ReliableModelProvider::chat_with_tool_round_policy has cognitive complexity 111 (threshold 15). Drivers by points: if/else 21 (93 pts), boolean chains 8, loops 3 (6 pts), match/switch 1 (4 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReliableModelProvider::chat_with_tools (cognitive 105) crates/zeroclaw-providers/src/reliable.rs:3251— ReliableModelProvider::chat_with_tools has cognitive complexity 105 (threshold 15). Drivers by points: if/else 19 (88 pts), boolean chains 7, loops 3 (6 pts), match/switch 1 (4 pts) (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReliableModelProvider::chat_with_history (cognitive 89) crates/zeroclaw-providers/src/reliable.rs:2820— ReliableModelProvider::chat_with_history has cognitive complexity 89 (threshold 15). Drivers by points: if/else 16 (74 pts), loops 3 (6 pts), boolean chains 5, match/switch 1 (4 pts) (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReliableModelProvider::chat_with_system (cognitive 85) crates/zeroclaw-providers/src/reliable.rs:2520— ReliableModelProvider::chat_with_system has cognitive complexity 85 (threshold 15). Drivers by points: if/else 16 (70 pts), loops 3 (6 pts), boolean chains 5, match/switch 1 (4 pts) (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerorelay::handle_client (cognitive 55) apps/zerorelay/src/lib.rs:1520— zerorelay::handle_client has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (38 pts), match/switch 5 (14 pts), loops 2, boolean chains 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerorelay::handle_daemon (cognitive 38) apps/zerorelay/src/lib.rs:1096— zerorelay::handle_daemon has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 7 (13 pts), boolean chains 3, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerorelay::enroll_route::pump_route (cognitive 27) apps/zerorelay/src/enroll_route.rs:300— zerorelay::enroll_route::pump_route has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (18 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerorelay::frontdoor::serve_session (cognitive 18) apps/zerorelay/src/frontdoor.rs:134— zerorelay::frontdoor::serve_session has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AcpServer::materialize_prompt (cognitive 49) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2916— AcpServer::materialize_prompt has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (42 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 33). 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.
AcpServer::handle_session_prompt (cognitive 45) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1878— AcpServer::handle_session_prompt has cognitive complexity 45 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 6 (8 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AcpServer::handle_session_load (cognitive 27) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1153— AcpServer::handle_session_load has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 5, boolean chains 4, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AcpServer::handle_session_resume (cognitive 17) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1495— AcpServer::handle_session_resume has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 4, boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SopPane::render_canvas (cognitive 48) REDACTED:1796— SopPane::render_canvas has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (37 pts), match/switch 3 (5 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SopPane::editor_lines (cognitive 36) REDACTED:2045— SopPane::editor_lines has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7, match/switch 2 (5 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SopPane::handle_mouse (cognitive 31) REDACTED:960— SopPane::handle_mouse has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (30 pts), match/switch 1 (nesting depth added 18). 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.
SopPane::editor_backspace (cognitive 16) REDACTED:1488— SopPane::editor_backspace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PluginHost::discovered_named (cognitive 41) crates/zeroclaw-plugins/src/host.rs:314— PluginHost::discovered_named has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (29 pts), match/switch 2 (9 pts), boolean chains 2, 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.
PluginHost::remove_with_report (cognitive 19) crates/zeroclaw-plugins/src/host.rs:742— PluginHost::remove_with_report has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 7 (11 pts), if/else 6 (7 pts), boolean chains 1 (nesting depth added 5). 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.
PluginHost::remove_stale_staging (cognitive 18) crates/zeroclaw-plugins/src/host.rs:1103— PluginHost::remove_stale_staging has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PluginHost::retry_claims (cognitive 17) crates/zeroclaw-plugins/src/host.rs:1018— PluginHost::retry_claims has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_memory::chunker::chunk_markdown (cognitive 35) crates/zeroclaw-memory/src/chunker.rs:15— zeroclaw_memory::chunker::chunk_markdown has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_memory::consolidation::consolidate_turn (cognitive 22) crates/zeroclaw-memory/src/consolidation.rs:60— zeroclaw_memory::consolidation::consolidate_turn has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_memory::budget::compact_category_to_budget (cognitive 20) crates/zeroclaw-memory/src/budget.rs:12— zeroclaw_memory::budget::compact_category_to_budget has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 4 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_memory::create_memory_for_agent (cognitive 19) crates/zeroclaw-memory/src/lib.rs:1019— zeroclaw_memory::create_memory_for_agent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MattermostChannel::listen_websocket (cognitive 33) crates/zeroclaw-channels/src/mattermost.rs:1466— MattermostChannel::listen_websocket has cognitive complexity 33 (threshold 15). Drivers by points: match/switch 6 (17 pts), if/else 4 (13 pts), boolean chains 2, loops 1 (nesting depth added 20). 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.
MattermostChannel::listen_polling (cognitive 20) crates/zeroclaw-channels/src/mattermost.rs:1357— MattermostChannel::listen_polling has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MattermostChannel::authenticate_websocket (cognitive 19) crates/zeroclaw-channels/src/mattermost.rs:723— MattermostChannel::authenticate_websocket has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (5 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.
MattermostChannel::try_resolve_approval_reply (cognitive 17) crates/zeroclaw-channels/src/mattermost.rs:1956— MattermostChannel::try_resolve_approval_reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 pts), match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BedrockModelProvider::send_converse_request (cognitive 29) crates/zeroclaw-providers/src/bedrock.rs:1524— BedrockModelProvider::send_converse_request has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 2 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BedrockModelProvider::convert_messages (cognitive 25) crates/zeroclaw-providers/src/bedrock.rs:945— BedrockModelProvider::convert_messages has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BedrockModelProvider::parse_converse_response (cognitive 23) crates/zeroclaw-providers/src/bedrock.rs:1456— BedrockModelProvider::parse_converse_response has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BedrockModelProvider::parse_user_content_blocks (cognitive 19) crates/zeroclaw-providers/src/bedrock.rs:1167— BedrockModelProvider::parse_user_content_blocks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StreamTextGuard::protocol_suppression_detector (cognitive 21) crates/zeroclaw-runtime/src/agent/turn/stream_guard.rs:643— StreamTextGuard::protocol_suppression_detector has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StreamTextGuard::evaluate_pending (cognitive 19) crates/zeroclaw-runtime/src/agent/turn/stream_guard.rs:334— StreamTextGuard::evaluate_pending has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
StreamTextGuard::finish (cognitive 16) crates/zeroclaw-runtime/src/agent/turn/stream_guard.rs:264— StreamTextGuard::finish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StreamTextGuard::release_through (cognitive 16) crates/zeroclaw-runtime/src/agent/turn/stream_guard.rs:481— StreamTextGuard::release_through has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Near-duplicate member pair (42 shared lines) crates/zeroclaw-providers/src/gemini_cli.rs:124— crates/zeroclaw-providers/src/gemini_cli.rs:124-243 | crates/zeroclaw-providers/src/kilocli.rs:115-240 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (42 shared lines) crates/zeroclaw-hardware/src/pico_code.rs:268— crates/zeroclaw-hardware/src/pico_code.rs:268-405 | crates/zeroclaw-hardware/src/pico_code.rs:451-565 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (42 shared lines) crates/zeroclaw-hardware/src/gpio.rs:60— crates/zeroclaw-hardware/src/gpio.rs:60-136 | crates/zeroclaw-hardware/src/gpio.rs:181-241 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (42 shared lines) crates/zeroclaw-providers/src/compatible.rs:4324— crates/zeroclaw-providers/src/compatible.rs:4324-4436 | crates/zeroclaw-providers/src/compatible.rs:4443-4588 — These two members are variants of one another: 42 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Duplicated block (21 lines × 2) crates/zeroclaw-channels/src/discord/rest.rs:39— crates/zeroclaw-channels/src/discord/rest.rs:39-59 | crates/zeroclaw-channels/src/discord/rest.rs:67-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) crates/zeroclaw-gateway/src/lib.rs:1573— crates/zeroclaw-gateway/src/lib.rs:1573-1593 | crates/zeroclaw-gateway/src/lib.rs:1743-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.
Duplicated block (21 lines × 2) crates/zeroclaw-providers/src/azure_openai.rs:468— crates/zeroclaw-providers/src/azure_openai.rs:468-488 | crates/zeroclaw-providers/src/openai.rs:446-466 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:1466— crates/zeroclaw-tool-call-parser/src/lib.rs:1466-1486 | crates/zeroclaw-tool-call-parser/src/lib.rs:1539-1559 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–19 lines × 2) crates/zeroclaw-gateway/src/ws.rs:847— crates/zeroclaw-gateway/src/ws.rs:847-864 | crates/zeroclaw-gateway/src/ws.rs:1041-1059 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–19 lines × 2) crates/zeroclaw-hardware/src/gpio.rs:119— crates/zeroclaw-hardware/src/gpio.rs:119-136 | crates/zeroclaw-hardware/src/gpio.rs:223-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18–19 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:909— crates/zeroclaw-providers/src/anthropic.rs:909-926 | crates/zeroclaw-providers/src/bedrock.rs:1337-1355 — before extracting anything, compare `crates/zeroclaw-providers/src/anthropic.rs` and `crates/zeroclaw-providers/src/bedrock.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18–19 lines × 2) crates/zeroclaw-tools/src/linkedin_client.rs:233— crates/zeroclaw-tools/src/linkedin_client.rs:233-251 | crates/zeroclaw-tools/src/linkedin_client.rs:687-704 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) apps/zerocode/src/config_manager.rs:4283— apps/zerocode/src/config_manager.rs:4283-4300 | apps/zerocode/src/config_manager.rs:4334-4350 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) apps/zerocode/src/diff.rs:130— apps/zerocode/src/diff.rs:130-147 | apps/zerocode/src/diff.rs:207-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:239— crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:239-256 | crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:292-308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) crates/zeroclaw-tools/src/linkedin_client.rs:58— crates/zeroclaw-tools/src/linkedin_client.rs:58-74 | crates/zeroclaw-tools/src/pushover.rs:25-42 — before extracting anything, compare `crates/zeroclaw-tools/src/linkedin_client.rs` and `crates/zeroclaw-tools/src/pushover.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 3) apps/zerocode/src/i18n.rs:231— apps/zerocode/src/i18n.rs:231-244 | crates/zeroclaw-runtime/src/i18n.rs:260-273 | crates/zeroclaw-tools/src/i18n.rs:129-142 — before extracting anything, compare `apps/zerocode/src/i18n.rs` and `crates/zeroclaw-tools/src/i18n.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 3) crates/zeroclaw-channels/src/qq.rs:186— crates/zeroclaw-channels/src/qq.rs:186-199 | crates/zeroclaw-channels/src/telegram.rs:948-961 | crates/zeroclaw-channels/src/wechat.rs:377-390 — before extracting anything, compare `crates/zeroclaw-channels/src/qq.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:273— crates/zeroclaw-providers/src/auth/mod.rs:273-286 | crates/zeroclaw-providers/src/auth/mod.rs:370-383 | crates/zeroclaw-providers/src/auth/mod.rs:458-471 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 3) crates/zeroclaw-providers/src/azure_openai.rs:469— crates/zeroclaw-providers/src/azure_openai.rs:469-482 | crates/zeroclaw-providers/src/openai.rs:447-460 | crates/zeroclaw-providers/src/openrouter.rs:451-464 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13–14 lines × 2) crates/zeroclaw-channels/src/email_channel.rs:489— crates/zeroclaw-channels/src/email_channel.rs:489-501 | crates/zeroclaw-channels/src/email_channel.rs:542-555 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10796— crates/zeroclaw-channels/src/orchestrator/mod.rs:10796-10809 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11276-11288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:4694— crates/zeroclaw-runtime/src/agent/turn/mod.rs:4694-4706 | crates/zeroclaw-runtime/src/sop/executor.rs:1224-1237 — before extracting anything, compare `crates/zeroclaw-runtime/src/agent/turn/mod.rs` and `crates/zeroclaw-runtime/src/sop/executor.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13–14 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:275— crates/zeroclaw-runtime/src/cron/store.rs:275-288 | crates/zeroclaw-runtime/src/cron/store.rs:493-505 — both copies are in the same file, so extract the 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 × 4) crates/zeroclaw-channels/src/cli.rs:72— crates/zeroclaw-channels/src/cli.rs:72-83 | crates/zeroclaw-channels/src/imessage.rs:306-317 | crates/zeroclaw-channels/src/irc.rs:667-678 | crates/zeroclaw-channels/src/mochat.rs:235-246 — before extracting anything, compare `crates/zeroclaw-channels/src/imessage.rs` and `crates/zeroclaw-channels/src/irc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 4) REDACTED:2028— REDACTED:2028-2039 | REDACTED:2185-2196 | REDACTED:2210-2221 | REDACTED:2369-2380 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 4) crates/zeroclaw-tools/src/ask_user.rs:89— crates/zeroclaw-tools/src/ask_user.rs:89-101 | crates/zeroclaw-tools/src/escalate.rs:175-187 | crates/zeroclaw-tools/src/poll.rs:185-197 | crates/zeroclaw-tools/src/send_via.rs:299-310 — before extracting anything, compare `crates/zeroclaw-tools/src/ask_user.rs` and `crates/zeroclaw-tools/src/escalate.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 4) crates/zeroclaw-tools/src/claude_code.rs:286— crates/zeroclaw-tools/src/claude_code.rs:286-297 | crates/zeroclaw-tools/src/codex_cli.rs:212-223 | crates/zeroclaw-tools/src/gemini_cli.rs:192-203 | crates/zeroclaw-tools/src/opencode_cli.rs:192-203 — before extracting anything, compare `crates/zeroclaw-tools/src/claude_code.rs` and `crates/zeroclaw-tools/src/codex_cli.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 4) crates/zeroclaw-macros/src/lib.rs:534— crates/zeroclaw-macros/src/lib.rs:534-543 | crates/zeroclaw-macros/src/lib.rs:1195-1204 | crates/zeroclaw-macros/src/lib.rs:1380-1389 | crates/zeroclaw-macros/src/lib.rs:1726-1735 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) crates/zeroclaw-runtime/src/tools/schedule.rs:125— crates/zeroclaw-runtime/src/tools/schedule.rs:125-134 | crates/zeroclaw-runtime/src/tools/schedule.rs:155-164 | crates/zeroclaw-runtime/src/tools/schedule.rs:178-187 | crates/zeroclaw-runtime/src/tools/schedule.rs:201-210 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) crates/zeroclaw-providers/src/auth/mod.rs:241— crates/zeroclaw-providers/src/auth/mod.rs:241-252 | crates/zeroclaw-providers/src/auth/mod.rs:329-338 | crates/zeroclaw-providers/src/auth/mod.rs:423-433 | crates/zeroclaw-providers/src/auth/mod.rs:542-551 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 4) crates/zeroclaw-providers/src/auth/mod.rs:207— crates/zeroclaw-providers/src/auth/mod.rs:207-217 | crates/zeroclaw-providers/src/auth/mod.rs:296-305 | crates/zeroclaw-providers/src/auth/mod.rs:393-402 | crates/zeroclaw-providers/src/auth/mod.rs:509-518 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 8) crates/zeroclaw-channels/src/discord/mod.rs:400— crates/zeroclaw-channels/src/discord/mod.rs:400-405 | crates/zeroclaw-channels/src/lark.rs:2293-2299 | crates/zeroclaw-channels/src/telegram.rs:4945-4950 | crates/zeroclaw-channels/src/telegram.rs:5403-5408 | crates/zeroclaw-channels/src/telegram.rs:5439-5444 | crates/zeroclaw-channels/src/telegram.rs:5453-5458 | crates/zeroclaw-channels/src/wechat.rs:2044-2049 | crates/zeroclaw-channels/src/whatsapp_web.rs:1610-1615 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 8) crates/zeroclaw-channels/src/line.rs:333— crates/zeroclaw-channels/src/line.rs:333-338 | crates/zeroclaw-channels/src/slack.rs:4978-4986 | crates/zeroclaw-channels/src/webhook.rs:356-361 | crates/zeroclaw-gateway/src/lib.rs:5119-5125 | crates/zeroclaw-gateway/src/ws.rs:527-532 | crates/zeroclaw-hardware/src/loader.rs:77-82 | crates/zeroclaw-runtime/src/sop/engine.rs:6286-6291 | crates/zeroclaw-runtime/src/sop/engine.rs:6322-6327 — before extracting anything, compare `crates/zeroclaw-gateway/src/lib.rs` and `crates/zeroclaw-gateway/src/ws.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 8) crates/zeroclaw-channels/src/matrix.rs:2681— crates/zeroclaw-channels/src/matrix.rs:2681-2690 | crates/zeroclaw-channels/src/matrix.rs:2695-2701 | crates/zeroclaw-channels/src/whatsapp_web.rs:672-678 | crates/zeroclaw-gateway/src/acp.rs:136-141 | crates/zeroclaw-hardware/src/uf2.rs:240-246 | crates/zeroclaw-providers/src/compatible.rs:954-960 | crates/zeroclaw-runtime/src/cron/scheduler.rs:503-509 | crates/zeroclaw-runtime/src/cron/scheduler.rs:523-529 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 8) apps/zerocode/src/dashboard.rs:841— apps/zerocode/src/dashboard.rs:841-846 | apps/zerocode/src/dashboard.rs:1027-1032 | apps/zerocode/src/dashboard.rs:1130-1135 | apps/zerocode/src/dashboard.rs:1198-1203 | apps/zerocode/src/dashboard.rs:1293-1298 | apps/zerocode/src/dashboard.rs:1453-1458 | apps/zerocode/src/dashboard.rs:1695-1700 | apps/zerocode/src/logs.rs:1068-1074 — there are 8 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 8 sites; resolving a subset leaves the remainder to drift apart.
Focus outline removed inline web/src/components/ChatTabBar.tsx:220— <button> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline web/src/components/CommandPalette.tsx:340— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline web/src/pages/Logs.tsx:540— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Agent::turn_streamed_with_steering_body (cyclomatic 51) crates/zeroclaw-runtime/src/agent/agent.rs:4444— Agent::turn_streamed_with_steering_body has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Agent::from_config_with_session_cwd_and_mcp_approval_mode (cyclomatic 18) crates/zeroclaw-runtime/src/agent/agent.rs:2802— Agent::from_config_with_session_cwd_and_mcp_approval_mode 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.
Agent::turn (cyclomatic 17) crates/zeroclaw-runtime/src/agent/agent.rs:3925— Agent::turn 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.
AnthropicModelProvider::parse_anthropic_sse_from_reader (cyclomatic 49) crates/zeroclaw-providers/src/anthropic.rs:2449— AnthropicModelProvider::parse_anthropic_sse_from_reader has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnthropicModelProvider::stream_chat_with_tool_round_policy (cyclomatic 34) crates/zeroclaw-providers/src/anthropic.rs:3219— AnthropicModelProvider::stream_chat_with_tool_round_policy has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnthropicModelProvider::convert_messages (cyclomatic 24) crates/zeroclaw-providers/src/anthropic.rs:1371— AnthropicModelProvider::convert_messages 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.
WhatsAppWebChannel::listen (cyclomatic 37) crates/zeroclaw-channels/src/whatsapp_web.rs:3793— WhatsAppWebChannel::listen has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WhatsAppWebChannel::handle_one_inbound_message (cyclomatic 36) crates/zeroclaw-channels/src/whatsapp_web.rs:864— WhatsAppWebChannel::handle_one_inbound_message 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.
WhatsAppWebChannel::send (cyclomatic 28) crates/zeroclaw-channels/src/whatsapp_web.rs:3532— WhatsAppWebChannel::send 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.
DelegateTool::execute_agentic_with_approval_registry (cyclomatic 29) crates/zeroclaw-runtime/src/tools/delegate.rs:4727— DelegateTool::execute_agentic_with_approval_registry has cyclomatic complexity 29 (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.
DelegateTool::execute_background (cyclomatic 17) crates/zeroclaw-runtime/src/tools/delegate.rs:3047— DelegateTool::execute_background 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.
DelegateTool::handle_await_sessions (cyclomatic 16) crates/zeroclaw-runtime/src/tools/delegate.rs:4201— DelegateTool::handle_await_sessions has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserTool::execute_agent_browser_action (cyclomatic 26) crates/zeroclaw-tools/src/browser.rs:609— BrowserTool::execute_agent_browser_action has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserTool::resolve_backend (cyclomatic 16) crates/zeroclaw-tools/src/browser.rs:370— BrowserTool::resolve_backend has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: zeroclaw_tools::browser::parse_browser_action (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
BrowserTool::execute_computer_use_action (cyclomatic 16) crates/zeroclaw-tools/src/browser.rs:1086— BrowserTool::execute_computer_use_action has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: zeroclaw_tools::browser::parse_browser_action (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
WeComWsChannel::listen (cyclomatic 25) crates/zeroclaw-channels/src/wecom_ws.rs:1548— WeComWsChannel::listen 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.
WeComWsChannel::normalize_message (cyclomatic 21) crates/zeroclaw-channels/src/wecom_ws.rs:1099— WeComWsChannel::normalize_message 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.
WeComWsChannel::materialize_quote_attachments (cyclomatic 17) crates/zeroclaw-channels/src/wecom_ws.rs:933— WeComWsChannel::materialize_quote_attachments 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.
zeroclaw_macros::derive_configurable (cognitive 166) crates/zeroclaw-macros/src/lib.rs:162— zeroclaw_macros::derive_configurable has cognitive complexity 166 (threshold 15). Drivers by points: if/else 57 (143 pts), match/switch 9 (16 pts), boolean chains 6, loops 1 (nesting depth added 93). 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.
zeroclaw_macros::build_integration_descriptor_method (cognitive 22) crates/zeroclaw-macros/src/lib.rs:2898— zeroclaw_macros::build_integration_descriptor_method has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 6 (16 pts), if/else 2 (3 pts), loops 2 (3 pts) (nesting depth added 12). 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.
zeroclaw_macros::derive_trigger_fields (cognitive 21) crates/zeroclaw-macros/src/lib.rs:2425— zeroclaw_macros::derive_trigger_fields has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3 (4 pts), match/switch 2 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ModelRoutingConfigTool::handle_upsert_agent (cognitive 155) crates/zeroclaw-tools/src/model_routing_config.rs:1132— ModelRoutingConfigTool::handle_upsert_agent has cognitive complexity 155 (threshold 15). Drivers by points: if/else 71 (124 pts), match/switch 9 (21 pts), boolean chains 10 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelRoutingConfigTool::handle_upsert_scenario (cognitive 31) crates/zeroclaw-tools/src/model_routing_config.rs:952— ModelRoutingConfigTool::handle_upsert_scenario has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 4 (10 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelRoutingConfigTool::handle_set_default (cognitive 17) crates/zeroclaw-tools/src/model_routing_config.rs:648— ModelRoutingConfigTool::handle_set_default has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 4 (6 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LarkChannel::listen_ws (cognitive 142) crates/zeroclaw-channels/src/lark.rs:1420— LarkChannel::listen_ws has cognitive complexity 142 (threshold 15). Drivers by points: if/else 27 (82 pts), match/switch 17 (55 pts), boolean chains 4, loops 1 (nesting depth added 93). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LarkChannel::parse_event_payload (cognitive 23) crates/zeroclaw-channels/src/lark.rs:2623— LarkChannel::parse_event_payload has cognitive complexity 23 (threshold 15). Drivers by points: match/switch 9 (18 pts), if/else 4, boolean chains 1 (nesting depth added 9). 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.
LarkChannel::download_image_as_marker (cognitive 20) crates/zeroclaw-channels/src/lark.rs:1855— LarkChannel::download_image_as_marker has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WeChatChannel::listen (cognitive 137) crates/zeroclaw-channels/src/wechat.rs:2808— WeChatChannel::listen has cognitive complexity 137 (threshold 15). Drivers by points: if/else 32 (104 pts), match/switch 7 (17 pts), loops 4 (9 pts), boolean chains 7 (nesting depth added 87). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WeChatChannel::qr_login (cognitive 27) crates/zeroclaw-channels/src/wechat.rs:2100— WeChatChannel::qr_login has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 4 (11 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WeChatChannel::load_persisted_state (cognitive 18) crates/zeroclaw-channels/src/wechat.rs:1150— WeChatChannel::load_persisted_state has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 2 (6 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.
WhatsAppWebChannel::listen (cognitive 79) crates/zeroclaw-channels/src/whatsapp_web.rs:3793— WhatsAppWebChannel::listen has cognitive complexity 79 (threshold 15). Drivers by points: if/else 21 (53 pts), match/switch 5 (16 pts), boolean chains 5, loops 2 (5 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.
WhatsAppWebChannel::send (cognitive 55) crates/zeroclaw-channels/src/whatsapp_web.rs:3532— WhatsAppWebChannel::send has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (31 pts), match/switch 6 (18 pts), boolean chains 5, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WhatsAppWebChannel::handle_one_inbound_message (cognitive 45) crates/zeroclaw-channels/src/whatsapp_web.rs:864— WhatsAppWebChannel::handle_one_inbound_message has cognitive complexity 45 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 7, match/switch 4 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatState::apply_update (cognitive 74) apps/zerocode/src/chat.rs:11442— ChatState::apply_update has cognitive complexity 74 (threshold 15). Drivers by points: if/else 30 (62 pts), match/switch 4 (7 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatState::open_transcript_context_menu (cognitive 18) apps/zerocode/src/chat.rs:10441— ChatState::open_transcript_context_menu has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChatState::load_history (cognitive 17) apps/zerocode/src/chat.rs:12443— ChatState::load_history has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (4 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.
WeComWsChannel::listen (cognitive 58) crates/zeroclaw-channels/src/wecom_ws.rs:1548— WeComWsChannel::listen has cognitive complexity 58 (threshold 15). Drivers by points: if/else 10 (31 pts), match/switch 7 (23 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WeComWsChannel::normalize_message (cognitive 50) crates/zeroclaw-channels/src/wecom_ws.rs:1099— WeComWsChannel::normalize_message has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (36 pts), match/switch 4 (11 pts), loops 1 (3 pts) (nesting depth added 31). 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.
WeComWsChannel::materialize_quote_attachments (cognitive 37) crates/zeroclaw-channels/src/wecom_ws.rs:933— WeComWsChannel::materialize_quote_attachments has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (23 pts), match/switch 3 (9 pts), loops 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileExplorerState::handle_key (cognitive 42) apps/zerocode/src/file_explorer.rs:288— FileExplorerState::handle_key has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 3, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileExplorerState::handle_search_key (cognitive 27) apps/zerocode/src/file_explorer.rs:428— FileExplorerState::handle_search_key has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 1, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
FileExplorerState::load_entries (cognitive 17) apps/zerocode/src/file_explorer.rs:159— FileExplorerState::load_entries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentSidebar::draw_session_rows (cognitive 37) apps/zerocode/src/agent_sidebar.rs:304— AgentSidebar::draw_session_rows has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (28 pts), match/switch 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentSidebar::draw (cognitive 24) apps/zerocode/src/agent_sidebar.rs:184— AgentSidebar::draw has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AgentSidebar::handle_mouse (cognitive 17) apps/zerocode/src/agent_sidebar.rs:617— AgentSidebar::handle_mouse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 1, 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.
Logs::handle_mouse (cognitive 36) apps/zerocode/src/logs.rs:1789— Logs::handle_mouse has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 6, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Logs::load_page (cognitive 27) apps/zerocode/src/logs.rs:636— Logs::load_page has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 5, 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.
Logs::open_copy_menu (cognitive 18) apps/zerocode/src/logs.rs:1331— Logs::open_copy_menu has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 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.
BrowserTool::execute_computer_use_action (cognitive 30) crates/zeroclaw-tools/src/browser.rs:1086— BrowserTool::execute_computer_use_action has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserTool::resolve_backend (cognitive 24) crates/zeroclaw-tools/src/browser.rs:370— BrowserTool::resolve_backend has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
BrowserTool::execute_agent_browser_action (cognitive 19) crates/zeroclaw-tools/src/browser.rs:609— BrowserTool::execute_agent_browser_action has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (18 pts), 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.
fill_translations::parse_po (cognitive 22) tools/fill-translations/src/main.rs:265— fill_translations::parse_po has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fill_translations::main (cognitive 21) tools/fill-translations/src/main.rs:453— fill_translations::main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 3 (5 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
fill_translations::decode_po_string (cognitive 17) tools/fill-translations/src/main.rs:84— fill_translations::decode_po_string has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 1 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TooManyFunctions: zerocode::theme apps/zerocode/src/theme.rs:48— TooManyFunctions — 47 free functions. The bar is 30 free functions; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFunctions: zeroclaw_channels::matrix::streaming crates/zeroclaw-channels/src/matrix.rs:428— TooManyFunctions — 40 free functions. The bar is 30 free functions; 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.
TooManyFunctions: zeroclaw_channels::matrix::outbound crates/zeroclaw-channels/src/matrix.rs:3096— TooManyFunctions — 32 free functions. The bar is 30 free functions; 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.
Near-duplicate member pair (37 shared lines) crates/zeroclaw-tools/src/jira_tool.rs:1038— crates/zeroclaw-tools/src/jira_tool.rs:1038-1296 | crates/zeroclaw-tools/src/notion_tool.rs:224-345 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (37 shared lines) apps/zerocode/src/client.rs:1709— apps/zerocode/src/client.rs:1709-1865 | apps/zerocode/src/client.rs:1993-2159 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (37 shared lines) crates/zeroclaw-providers/src/compatible.rs:1526— crates/zeroclaw-providers/src/compatible.rs:1526-1606 | crates/zeroclaw-providers/src/compatible.rs:4186-4304 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (8 members, 50+ identical tokens) crates/zeroclaw-channels/src/matrix.rs:2284— crates/zeroclaw-channels/src/matrix.rs:2284-2538 | crates/zeroclaw-channels/src/matrix.rs:2652-2703 | crates/zeroclaw-channels/src/whatsapp_web.rs:666-681 | crates/zeroclaw-gateway/src/acp.rs:62-186 | crates/zeroclaw-hardware/src/uf2.rs:87-254 | crates/zeroclaw-providers/src/compatible.rs:949-963 | crates/zeroclaw-runtime/src/cron/scheduler.rs:455-589 | src/commands/update.rs:1001-1121 — These 8 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 8 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 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) crates/zeroclaw-providers/src/anthropic.rs:3226— crates/zeroclaw-providers/src/anthropic.rs:3226-3557 | crates/zeroclaw-providers/src/compatible.rs:2837-3019 | crates/zeroclaw-providers/src/compatible.rs:4616-4864 | crates/zeroclaw-providers/src/compatible.rs:4873-5043 | crates/zeroclaw-providers/src/compatible.rs:5051-5187 | crates/zeroclaw-providers/src/openai.rs:1498-1590 | crates/zeroclaw-providers/src/openai_codex.rs:1577-1683 | crates/zeroclaw-providers/src/openrouter.rs:886-987 — These 8 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 8 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 8 times.
Members sharing a duplicated core (8 members, 50+ identical tokens) crates/zeroclaw-tools/src/web_search_tool.rs:387— crates/zeroclaw-tools/src/web_search_tool.rs:387-452 | crates/zeroclaw-tools/src/web_search_tool.rs:609-673 | crates/zeroclaw-tools/src/web_search_tool.rs:785-849 | crates/zeroclaw-tools/src/web_search_tool.rs:924-991 | crates/zeroclaw-tools/src/web_search_tool.rs:1120-1175 | crates/zeroclaw-tools/src/web_search_tool.rs:1312-1370 | crates/zeroclaw-tools/src/web_search_tool.rs:1488-1555 | crates/zeroclaw-tools/src/web_search_tool.rs:1757-1815 — These 8 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 8 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 8 times.
Duplicated block (30 lines × 2) crates/zeroclaw-providers/src/compatible.rs:1027— crates/zeroclaw-providers/src/compatible.rs:1027-1056 | crates/zeroclaw-providers/src/compatible.rs:1102-1131 — both copies are in the same file, so extract the 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) crates/zeroclaw-runtime/src/sop/engine.rs:5513— crates/zeroclaw-runtime/src/sop/engine.rs:5513-5542 | crates/zeroclaw-runtime/src/sop/engine.rs:5584-5613 — both copies are in the same file, so extract the 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) crates/zeroclaw-tools/src/backup_tool.rs:314— crates/zeroclaw-tools/src/backup_tool.rs:314-343 | crates/zeroclaw-tools/src/backup_tool.rs:402-431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) crates/zeroclaw-api/src/memory_traits.rs:646— crates/zeroclaw-api/src/memory_traits.rs:646-671 | crates/zeroclaw-memory/src/agent_scoped.rs:522-547 — 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 (26 lines × 2) crates/zeroclaw-providers/src/compatible.rs:3998— crates/zeroclaw-providers/src/compatible.rs:3998-4023 | crates/zeroclaw-providers/src/compatible.rs:4101-4126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:495— crates/zeroclaw-runtime/src/tools/delegate.rs:495-520 | crates/zeroclaw-runtime/src/tools/delegate.rs:553-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–24 lines × 2) apps/zerocode/src/file_explorer.rs:302— apps/zerocode/src/file_explorer.rs:302-325 | apps/zerocode/src/file_explorer.rs:444-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.
Duplicated block (22–24 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1779— crates/zeroclaw-runtime/src/agent/loop_.rs:1779-1802 | crates/zeroclaw-runtime/src/agent/loop_.rs:3819-3840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–24 lines × 2) crates/zeroclaw-tools/src/discord_search.rs:92— crates/zeroclaw-tools/src/discord_search.rs:92-115 | crates/zeroclaw-tools/src/memory_recall.rs:83-104 — before extracting anything, compare `crates/zeroclaw-tools/src/discord_search.rs` and `crates/zeroclaw-tools/src/memory_recall.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22–23 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2791— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2791-2812 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2849-2871 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:2272— crates/zeroclaw-runtime/src/agent/turn/mod.rs:2272-2294 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:2443-2464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:2198— crates/zeroclaw-tool-call-parser/src/lib.rs:2198-2219 | crates/zeroclaw-tool-call-parser/src/lib.rs:2245-2267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) crates/zeroclaw-providers/src/compatible.rs:1557— crates/zeroclaw-providers/src/compatible.rs:1557-1577 | crates/zeroclaw-providers/src/compatible.rs:4243-4262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:37— crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:37-57 | crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:151-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–21 lines × 2) crates/zeroclaw-tools/src/file_edit.rs:150— crates/zeroclaw-tools/src/file_edit.rs:150-170 | crates/zeroclaw-tools/src/file_upload.rs:232-251 — 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 (16–18 lines × 2) crates/zeroclaw-channels/src/nextcloud_talk.rs:262— crates/zeroclaw-channels/src/nextcloud_talk.rs:262-279 | crates/zeroclaw-channels/src/nextcloud_talk.rs:391-406 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–18 lines × 2) crates/zeroclaw-runtime/src/sop/metrics.rs:372— crates/zeroclaw-runtime/src/sop/metrics.rs:372-389 | crates/zeroclaw-runtime/src/sop/metrics.rs:415-430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–18 lines × 2) crates/zeroclaw-tools/src/file_upload.rs:260— crates/zeroclaw-tools/src/file_upload.rs:260-275 | crates/zeroclaw-tools/src/file_upload_bundle.rs:361-378 — before extracting anything, compare `crates/zeroclaw-tools/src/file_upload.rs` and `crates/zeroclaw-tools/src/file_upload_bundle.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 3) crates/zeroclaw-channels/src/discord/markers.rs:49— crates/zeroclaw-channels/src/discord/markers.rs:49-65 | crates/zeroclaw-channels/src/slack.rs:347-363 | crates/zeroclaw-channels/src/util.rs:377-393 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (17 lines × 3) crates/zeroclaw-channels/src/discord/markers.rs:75— crates/zeroclaw-channels/src/discord/markers.rs:75-91 | crates/zeroclaw-channels/src/slack.rs:373-389 | crates/zeroclaw-channels/src/util.rs:400-416 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (17 lines × 3) crates/zeroclaw-runtime/src/tools/cron_remove.rs:85— crates/zeroclaw-runtime/src/tools/cron_remove.rs:85-101 | crates/zeroclaw-runtime/src/tools/cron_run.rs:140-156 | crates/zeroclaw-runtime/src/tools/cron_runs.rs:70-86 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (14–17 lines × 2) crates/zeroclaw-providers/src/compatible.rs:3159— crates/zeroclaw-providers/src/compatible.rs:3159-3175 | crates/zeroclaw-providers/src/compatible.rs:3193-3206 — both copies are in the same file, so extract the 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–17 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:608— crates/zeroclaw-runtime/src/cron/store.rs:608-624 | crates/zeroclaw-runtime/src/cron/store.rs:692-705 — both copies are in the same file, so extract the 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–17 lines × 2) crates/zeroclaw-runtime/src/tools/sop_advance.rs:212— crates/zeroclaw-runtime/src/tools/sop_advance.rs:212-225 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:130-146 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/sop_advance.rs` and `crates/zeroclaw-runtime/src/tools/sop_execute.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14–16 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2545— crates/zeroclaw-channels/src/discord/mod.rs:2545-2560 | crates/zeroclaw-channels/src/discord/mod.rs:3003-3016 — both copies are in the same file, so extract the 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–16 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:1984— crates/zeroclaw-runtime/src/agent/turn/mod.rs:1984-1999 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3562-3575 — both copies are in the same file, so extract the 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–16 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:2373— crates/zeroclaw-tool-call-parser/src/lib.rs:2373-2388 | crates/zeroclaw-tool-call-parser/src/lib.rs:2446-2459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:3822— crates/zeroclaw-channels/src/discord/mod.rs:3822-3837 | crates/zeroclaw-channels/src/discord/mod.rs:3855-3869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–16 lines × 2) crates/zeroclaw-providers/src/hailo_ollama.rs:947— crates/zeroclaw-providers/src/hailo_ollama.rs:947-962 | crates/zeroclaw-providers/src/ollama.rs:509-523 — before extracting anything, compare `crates/zeroclaw-providers/src/hailo_ollama.rs` and `crates/zeroclaw-providers/src/ollama.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15–16 lines × 2) crates/zeroclaw-runtime/src/daemon/mod.rs:444— crates/zeroclaw-runtime/src/daemon/mod.rs:444-459 | crates/zeroclaw-runtime/src/daemon/mod.rs:546-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.
Duplicated block (15 lines × 3) crates/zeroclaw-channels/src/slack.rs:4587— crates/zeroclaw-channels/src/slack.rs:4587-4601 | crates/zeroclaw-channels/src/slack.rs:6034-6048 | crates/zeroclaw-channels/src/slack.rs:6153-6167 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) crates/zeroclaw-providers/src/reliable.rs:4033— crates/zeroclaw-providers/src/reliable.rs:4033-4047 | crates/zeroclaw-providers/src/reliable.rs:4138-4152 | crates/zeroclaw-providers/src/reliable.rs:4226-4240 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) src/cron/mod.rs:231— src/cron/mod.rs:231-245 | src/cron/mod.rs:320-334 | src/cron/mod.rs:507-521 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13–15 lines × 2) apps/zerorelay/src/lib.rs:1470— apps/zerorelay/src/lib.rs:1470-1484 | crates/zeroclaw-runtime/src/relay.rs:1231-1243 — 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 (13–15 lines × 2) crates/zeroclaw-channels/src/git/channel.rs:694— crates/zeroclaw-channels/src/git/channel.rs:694-706 | crates/zeroclaw-channels/src/twitter.rs:438-452 — 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 (13–15 lines × 2) crates/zeroclaw-infra/src/session_sqlite.rs:1014— crates/zeroclaw-infra/src/session_sqlite.rs:1014-1026 | crates/zeroclaw-infra/src/session_sqlite.rs:1045-1059 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 4) REDACTED:346— REDACTED:346-358 | REDACTED:382-394 | REDACTED:417-429 | REDACTED:530-542 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 4) crates/zeroclaw-tools/src/claude_code.rs:218— crates/zeroclaw-tools/src/claude_code.rs:218-230 | crates/zeroclaw-tools/src/codex_cli.rs:179-191 | crates/zeroclaw-tools/src/gemini_cli.rs:159-171 | crates/zeroclaw-tools/src/opencode_cli.rs:159-171 — before extracting anything, compare `crates/zeroclaw-tools/src/claude_code.rs` and `crates/zeroclaw-tools/src/codex_cli.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 4) crates/zeroclaw-runtime/src/tools/sop_advance.rs:269— crates/zeroclaw-runtime/src/tools/sop_advance.rs:269-281 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:184-196 | crates/zeroclaw-tools/src/discord_search.rs:133-145 | crates/zeroclaw-tools/src/memory_recall.rs:124-136 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/sop_advance.rs` and `crates/zeroclaw-runtime/src/tools/sop_execute.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11–12 lines × 3) apps/zerocode/src/config_manager.rs:4848— apps/zerocode/src/config_manager.rs:4848-4859 | apps/zerocode/src/config_manager.rs:5174-5185 | apps/zerocode/src/config_manager.rs:5438-5448 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11–12 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:1959— crates/zeroclaw-channels/src/orchestrator/mod.rs:1959-1970 | crates/zeroclaw-channels/src/util.rs:219-230 | crates/zeroclaw-tool-call-parser/src/lib.rs:1070-1080 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/util.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–12 lines × 3) crates/zeroclaw-tools/src/ask_user.rs:161— crates/zeroclaw-tools/src/ask_user.rs:161-171 | crates/zeroclaw-tools/src/escalate.rs:271-281 | crates/zeroclaw-tools/src/poll.rs:259-270 — before extracting anything, compare `crates/zeroclaw-tools/src/ask_user.rs` and `crates/zeroclaw-tools/src/escalate.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10–12 lines × 2) crates/zeroclaw-channels/src/lark.rs:2722— crates/zeroclaw-channels/src/lark.rs:2722-2731 | crates/zeroclaw-channels/src/lark.rs:2767-2778 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–12 lines × 2) crates/zeroclaw-channels/src/slack.rs:5618— crates/zeroclaw-channels/src/slack.rs:5618-5629 | crates/zeroclaw-channels/src/slack.rs:5699-5708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–12 lines × 2) crates/zeroclaw-tools/src/linkedin_client.rs:252— crates/zeroclaw-tools/src/linkedin_client.rs:252-263 | crates/zeroclaw-tools/src/linkedin_client.rs:711-720 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–11 lines × 3) crates/zeroclaw-channels/src/gmail_push.rs:208— crates/zeroclaw-channels/src/gmail_push.rs:208-218 | crates/zeroclaw-channels/src/gmail_push.rs:340-347 | crates/zeroclaw-channels/src/gmail_push.rs:594-604 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–11 lines × 3) crates/zeroclaw-runtime/src/sop/approval/timeout.rs:49— crates/zeroclaw-runtime/src/sop/approval/timeout.rs:49-56 | crates/zeroclaw-runtime/src/sop/executor.rs:900-907 | crates/zeroclaw-runtime/src/sop/executor.rs:943-953 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8–11 lines × 3) crates/zeroclaw-runtime/src/tools/delegate.rs:2196— crates/zeroclaw-runtime/src/tools/delegate.rs:2196-2206 | crates/zeroclaw-runtime/src/tools/delegate.rs:2252-2262 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:527-534 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6–8 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1248— crates/zeroclaw-channels/src/discord/mod.rs:1248-1255 | crates/zeroclaw-channels/src/discord/mod.rs:1394-1399 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–8 lines × 2) crates/zeroclaw-hardware/src/loader.rs:189— crates/zeroclaw-hardware/src/loader.rs:189-194 | crates/zeroclaw-hardware/src/loader.rs:210-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–8 lines × 2) crates/zeroclaw-runtime/src/relay.rs:423— crates/zeroclaw-runtime/src/relay.rs:423-428 | crates/zeroclaw-runtime/src/relay.rs:439-446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 6) crates/zeroclaw-tools/src/browser.rs:2397— crates/zeroclaw-tools/src/browser.rs:2397-2403 | crates/zeroclaw-tools/src/browser.rs:2414-2420 | crates/zeroclaw-tools/src/browser.rs:2441-2447 | crates/zeroclaw-tools/src/browser.rs:2468-2474 | crates/zeroclaw-tools/src/browser.rs:2545-2551 | crates/zeroclaw-tools/src/browser.rs:2583-2589 — 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.
Duplicated block (7 lines × 6) crates/zeroclaw-channels/src/discord/mod.rs:297— crates/zeroclaw-channels/src/discord/mod.rs:297-303 | crates/zeroclaw-channels/src/lark.rs:1267-1273 | crates/zeroclaw-channels/src/mattermost.rs:682-688 | crates/zeroclaw-channels/src/slack.rs:636-642 | crates/zeroclaw-channels/src/telegram.rs:3224-3230 | crates/zeroclaw-channels/src/whatsapp_web.rs:657-663 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 6) crates/zeroclaw-providers/src/anthropic.rs:650— crates/zeroclaw-providers/src/anthropic.rs:650-656 | crates/zeroclaw-providers/src/azure_openai.rs:229-235 | crates/zeroclaw-providers/src/compatible.rs:610-616 | crates/zeroclaw-providers/src/openai.rs:258-264 | crates/zeroclaw-providers/src/openai.rs:1070-1076 | crates/zeroclaw-providers/src/openrouter.rs:225-231 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/compatible.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6–7 lines × 2) crates/zeroclaw-channels/src/lark.rs:2293— crates/zeroclaw-channels/src/lark.rs:2293-2299 | crates/zeroclaw-channels/src/telegram.rs:5453-5458 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6–7 lines × 2) crates/zeroclaw-runtime/src/tunnel/pinggy.rs:80— crates/zeroclaw-runtime/src/tunnel/pinggy.rs:80-86 | crates/zeroclaw-tools/src/mcp_transport.rs:641-646 — 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–7 lines × 2) crates/zeroclaw-sop-graph/src/lib.rs:339— crates/zeroclaw-sop-graph/src/lib.rs:339-344 | crates/zeroclaw-sop-graph/src/lib.rs:347-353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 6) crates/zeroclaw-tools/src/web_search_tool.rs:762— crates/zeroclaw-tools/src/web_search_tool.rs:762-767 | crates/zeroclaw-tools/src/web_search_tool.rs:914-919 | crates/zeroclaw-tools/src/web_search_tool.rs:1465-1470 | crates/zeroclaw-tools/src/web_search_tool.rs:1702-1707 | crates/zeroclaw-tools/src/web_search_tool.rs:1745-1750 | crates/zeroclaw-tools/src/web_search_tool.rs:1882-1887 — 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.
Duplicated block (6 lines × 6) crates/zeroclaw-channels/src/matrix.rs:3550— crates/zeroclaw-channels/src/matrix.rs:3550-3560 | crates/zeroclaw-channels/src/matrix.rs:3569-3579 | crates/zeroclaw-channels/src/slack.rs:2165-2172 | crates/zeroclaw-channels/src/slack.rs:2952-2957 | crates/zeroclaw-channels/src/slack.rs:3302-3310 | crates/zeroclaw-channels/src/slack.rs:3346-3353 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:17040— crates/zeroclaw-channels/src/orchestrator/mod.rs:17040-17046 | crates/zeroclaw-channels/src/voice_wake.rs:407-415 | crates/zeroclaw-channels/src/wechat.rs:2613-2619 | crates/zeroclaw-gateway/src/lib.rs:2004-2010 | crates/zeroclaw-providers/src/openai_codex.rs:1433-1438 | crates/zeroclaw-runtime/src/daemon/mod.rs:2608-2614 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/voice_wake.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 13) crates/zeroclaw-channels/src/lark.rs:2318— crates/zeroclaw-channels/src/lark.rs:2318-2323 | crates/zeroclaw-channels/src/nostr.rs:242-250 | crates/zeroclaw-channels/src/nostr.rs:295-303 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17038-17042 | crates/zeroclaw-channels/src/whatsapp_web.rs:1515-1519 | crates/zeroclaw-config/src/cost/tracker.rs:973-977 | crates/zeroclaw-gateway/src/lib.rs:2002-2006 | crates/zeroclaw-memory/src/lib.rs:1178-1182 | crates/zeroclaw-providers/src/anthropic.rs:1540-1548 | crates/zeroclaw-providers/src/pricing.rs:488-492 | crates/zeroclaw-runtime/src/daemon/mod.rs:2606-2610 | crates/zeroclaw-runtime/src/restart.rs:215-219 | src/commands/update.rs:305-309 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 13) crates/zeroclaw-channels/src/telegram.rs:3892— crates/zeroclaw-channels/src/telegram.rs:3892-3896 | crates/zeroclaw-channels/src/telegram.rs:4241-4245 | crates/zeroclaw-channels/src/telegram.rs:4924-4929 | crates/zeroclaw-channels/src/telegram.rs:4946-4950 | crates/zeroclaw-channels/src/telegram.rs:5404-5409 | crates/zeroclaw-channels/src/telegram.rs:5440-5444 | crates/zeroclaw-channels/src/telegram.rs:5454-5458 | crates/zeroclaw-channels/src/telegram.rs:7020-7024 | crates/zeroclaw-channels/src/telegram.rs:7782-7787 | crates/zeroclaw-channels/src/telegram.rs:7958-7963 | crates/zeroclaw-channels/src/telegram.rs:8264-8269 | crates/zeroclaw-channels/src/telegram.rs:8394-8399 | crates/zeroclaw-channels/src/telegram.rs:8412-8417 — all 13 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 13) crates/zeroclaw-channels/src/orchestrator/mod.rs:14935— crates/zeroclaw-channels/src/orchestrator/mod.rs:14935-14939 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14992-14996 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15080-15084 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15141-15145 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15284-15288 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15399-15403 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15434-15438 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15543-15547 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15673-15677 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15712-15716 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15756-15760 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15836-15840 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15873-15877 — all 13 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 10) crates/zeroclaw-channels/src/nextcloud_talk.rs:716— crates/zeroclaw-channels/src/nextcloud_talk.rs:716-722 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14827-14831 | crates/zeroclaw-channels/src/transcription.rs:1083-1087 | crates/zeroclaw-runtime/src/tools/mod.rs:1837-1843 | crates/zeroclaw-runtime/src/tools/mod.rs:1945-1949 | crates/zeroclaw-runtime/src/tools/mod.rs:1985-1989 | crates/zeroclaw-runtime/src/tools/mod.rs:2033-2037 | crates/zeroclaw-runtime/src/tools/mod.rs:2110-2116 | crates/zeroclaw-runtime/src/tools/mod.rs:2138-2142 | crates/zeroclaw-tools/src/web_fetch.rs:572-580 — before extracting anything, compare `crates/zeroclaw-channels/src/nextcloud_talk.rs` and `crates/zeroclaw-channels/src/orchestrator/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 10) crates/zeroclaw-channels/src/slack.rs:1290— crates/zeroclaw-channels/src/slack.rs:1290-1294 | crates/zeroclaw-channels/src/slack.rs:1346-1350 | crates/zeroclaw-channels/src/slack.rs:1596-1600 | crates/zeroclaw-channels/src/slack.rs:2200-2204 | crates/zeroclaw-channels/src/slack.rs:2680-2684 | crates/zeroclaw-channels/src/slack.rs:3971-3975 | crates/zeroclaw-channels/src/slack.rs:4203-4207 | crates/zeroclaw-channels/src/slack.rs:5399-5403 | crates/zeroclaw-channels/src/slack.rs:5750-5754 | crates/zeroclaw-channels/src/slack.rs:5795-5799 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 10) crates/zeroclaw-tools/src/jira_tool.rs:113— crates/zeroclaw-tools/src/jira_tool.rs:113-117 | crates/zeroclaw-tools/src/jira_tool.rs:210-214 | crates/zeroclaw-tools/src/jira_tool.rs:282-286 | crates/zeroclaw-tools/src/jira_tool.rs:361-365 | crates/zeroclaw-tools/src/jira_tool.rs:410-414 | crates/zeroclaw-tools/src/jira_tool.rs:461-465 | crates/zeroclaw-tools/src/jira_tool.rs:608-612 | crates/zeroclaw-tools/src/jira_tool.rs:699-703 | crates/zeroclaw-tools/src/jira_tool.rs:800-804 | crates/zeroclaw-tools/src/jira_tool.rs:898-902 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Outbound HTTP without resilience crates/zeroclaw-runtime/src/rpc/locales.rs:117— `reqwest::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/bin/zeroclaw-acp-bridge.rs:327— `reqwest::get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/bin/zeroclaw-acp-bridge.rs:349— `reqwest::Client::new(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×2
Modal dialog does not manage focus web/src/components/UpgradeDialog.tsx:298— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
Modal dialog does not manage focus web/src/components/sections/DirectoryPicker.tsx:172— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
QuickstartPane::handle_modal_key (cyclomatic 101) apps/zerocode/src/quickstart_pane.rs:1610— QuickstartPane::handle_modal_key has cyclomatic complexity 101 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
QuickstartPane::handle_mouse (cyclomatic 16) apps/zerocode/src/quickstart_pane.rs:1314— QuickstartPane::handle_mouse 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.
ModelRoutingConfigTool::handle_upsert_agent (cyclomatic 87) crates/zeroclaw-tools/src/model_routing_config.rs:1132— ModelRoutingConfigTool::handle_upsert_agent has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelRoutingConfigTool::handle_upsert_scenario (cyclomatic 18) crates/zeroclaw-tools/src/model_routing_config.rs:952— ModelRoutingConfigTool::handle_upsert_scenario 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.
zeroclaw_macros::derive_configurable (cyclomatic 58) crates/zeroclaw-macros/src/lib.rs:162— zeroclaw_macros::derive_configurable has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_macros::build_integration_descriptor_method (cyclomatic 17) crates/zeroclaw-macros/src/lib.rs:2898— zeroclaw_macros::build_integration_descriptor_method has cyclomatic complexity 17 (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.
LarkChannel::listen_ws (cyclomatic 56) crates/zeroclaw-channels/src/lark.rs:1420— LarkChannel::listen_ws has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LarkChannel::parse_event_payload (cyclomatic 19) crates/zeroclaw-channels/src/lark.rs:2623— LarkChannel::parse_event_payload 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.
WeChatChannel::listen (cyclomatic 53) crates/zeroclaw-channels/src/wechat.rs:2808— WeChatChannel::listen 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.
WeChatChannel::qr_login (cyclomatic 16) crates/zeroclaw-channels/src/wechat.rs:2100— WeChatChannel::qr_login 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.
QQChannel::listen (cyclomatic 49) crates/zeroclaw-channels/src/qq.rs:1401— QQChannel::listen has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
QQChannel::compose_qq_message (cyclomatic 21) crates/zeroclaw-channels/src/qq.rs:1067— QQChannel::compose_qq_message 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.
SlackChannel::listen_socket_mode (cyclomatic 45) crates/zeroclaw-channels/src/slack.rs:4229— SlackChannel::listen_socket_mode has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SlackChannel::listen (cyclomatic 41) crates/zeroclaw-channels/src/slack.rs:5808— SlackChannel::listen has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zerorelay::handle_daemon (cyclomatic 36) apps/zerorelay/src/lib.rs:1096— zerorelay::handle_daemon has cyclomatic complexity 36 (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.
zerorelay::handle_client (cyclomatic 36) apps/zerorelay/src/lib.rs:1520— zerorelay::handle_client 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.
FileExplorerState::handle_key (cyclomatic 32) apps/zerocode/src/file_explorer.rs:288— FileExplorerState::handle_key has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileExplorerState::handle_search_key (cyclomatic 17) apps/zerocode/src/file_explorer.rs:428— FileExplorerState::handle_search_key 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.
OidcAuthProvider::claims_to_identity (cyclomatic 29) crates/zeroclaw-runtime/src/security/auth_provider/oidc.rs:809— OidcAuthProvider::claims_to_identity has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OidcAuthProvider::verify_jwks (cyclomatic 16) crates/zeroclaw-runtime/src/security/auth_provider/oidc.rs:651— OidcAuthProvider::verify_jwks has cyclomatic complexity 16 (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.
SseTransport::send_and_recv (cyclomatic 28) crates/zeroclaw-tools/src/mcp_transport.rs:1940— SseTransport::send_and_recv 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.
SseTransport::ensure_connected (cyclomatic 26) crates/zeroclaw-tools/src/mcp_transport.rs:1413— SseTransport::ensure_connected has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConversationDock::layout (cyclomatic 26) apps/zerocode/src/app.rs:106— ConversationDock::layout has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConversationDock::handle_mouse (cyclomatic 20) apps/zerocode/src/app.rs:462— ConversationDock::handle_mouse 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.
zeroclaw_log::reader::matches_filter (cyclomatic 25) crates/zeroclaw-log/src/reader.rs:346— zeroclaw_log::reader::matches_filter 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.
zeroclaw_log::observer_bridge::project (cyclomatic 17) crates/zeroclaw-log/src/observer_bridge.rs:43— zeroclaw_log::observer_bridge::project has cyclomatic complexity 17 (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.
Logs::handle_mouse (cyclomatic 24) apps/zerocode/src/logs.rs:1789— Logs::handle_mouse 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.
Logs::load_page (cyclomatic 16) apps/zerocode/src/logs.rs:636— Logs::load_page has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Logs::handle_detail_key (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
zeroclaw_hardware::peripherals::create_peripheral_tools (cyclomatic 21) crates/zeroclaw-hardware/src/peripherals/mod.rs:48— zeroclaw_hardware::peripherals::create_peripheral_tools 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.
zeroclaw_hardware::wizard::run_setup (cyclomatic 17) crates/zeroclaw-hardware/src/wizard.rs:11— zeroclaw_hardware::wizard::run_setup 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.
AgentSidebar::draw_session_rows (cyclomatic 20) apps/zerocode/src/agent_sidebar.rs:304— AgentSidebar::draw_session_rows 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.
AgentSidebar::draw (cyclomatic 18) apps/zerocode/src/agent_sidebar.rs:184— AgentSidebar::draw 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.
RpcClient::spawn_ws_session (cyclomatic 20) apps/zerocode/src/client.rs:1983— RpcClient::spawn_ws_session 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.
RpcClient::connect (cyclomatic 17) apps/zerocode/src/client.rs:1705— RpcClient::connect 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.
zeroclaw_plugins::component_websocket::run_connection (cyclomatic 20) crates/zeroclaw-plugins/src/component_websocket.rs:499— zeroclaw_plugins::component_websocket::run_connection 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.
zeroclaw_plugins::config::compile_manifest_config (cyclomatic 17) crates/zeroclaw-plugins/src/config.rs:289— zeroclaw_plugins::config::compile_manifest_config 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.
xtask::cmd::mdbook::peer_groups::parse_kv_args (cyclomatic 20) xtask/src/cmd/mdbook/peer_groups.rs:619— xtask::cmd::mdbook::peer_groups::parse_kv_args has cyclomatic complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
xtask::cmd::fluent::scan::run (cyclomatic 19) xtask/src/cmd/fluent/scan.rs:6— xtask::cmd::fluent::scan::run 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.
AcpSessionStore::load_message_page (cyclomatic 19) REDACTED:852— AcpSessionStore::load_message_page 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.
AcpSessionStore::provider_safe_history (cyclomatic 16) REDACTED:2645— AcpSessionStore::provider_safe_history 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.
ZerocodePane::move_cursor (cyclomatic 18) apps/zerocode/src/zerocode_pane.rs:1224— ZerocodePane::move_cursor has cyclomatic complexity 18 (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.
ZerocodePane::handle_key (cyclomatic 17) apps/zerocode/src/zerocode_pane.rs:1094— ZerocodePane::handle_key has cyclomatic complexity 17 (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.
PluginHost::remove_with_report (cyclomatic 18) crates/zeroclaw-plugins/src/host.rs:742— PluginHost::remove_with_report has cyclomatic complexity 18 (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.
PluginHost::recover_update (cyclomatic 16) crates/zeroclaw-plugins/src/host.rs:1455— PluginHost::recover_update has cyclomatic complexity 16 (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.
HttpRequestTool::execute (cyclomatic 18) crates/zeroclaw-tools/src/http_request.rs:564— HttpRequestTool::execute has cyclomatic complexity 18 (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.
HttpRequestTool::validate_url_policy (cyclomatic 16) crates/zeroclaw-tools/src/http_request.rs:119— HttpRequestTool::validate_url_policy 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.
QQChannel::listen (cognitive 115) crates/zeroclaw-channels/src/qq.rs:1401— QQChannel::listen has cognitive complexity 115 (threshold 15). Drivers by points: if/else 30 (94 pts), match/switch 7 (18 pts), loops 2, boolean chains 1 (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QQChannel::compose_qq_message (cognitive 54) crates/zeroclaw-channels/src/qq.rs:1067— QQChannel::compose_qq_message has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (43 pts), match/switch 3 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 29). 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.
SignalChannel::listen (cognitive 102) crates/zeroclaw-channels/src/signal.rs:695— SignalChannel::listen has cognitive complexity 102 (threshold 15). Drivers by points: if/else 12 (64 pts), loops 5 (19 pts), match/switch 5 (17 pts), boolean chains 2 (nesting depth added 78). 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.
SignalChannel::process_envelope (cognitive 16) crates/zeroclaw-channels/src/signal.rs:435— SignalChannel::process_envelope has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MatrixChannel::finalize_draft (cognitive 52) crates/zeroclaw-channels/src/matrix.rs:5084— MatrixChannel::finalize_draft has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (37 pts), match/switch 4 (12 pts), boolean chains 3 (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.
MatrixChannel::multi_update (cognitive 16) crates/zeroclaw-channels/src/matrix.rs:4729— MatrixChannel::multi_update 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.
SseTransport::ensure_connected (cognitive 52) crates/zeroclaw-tools/src/mcp_transport.rs:1413— SseTransport::ensure_connected has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (42 pts), match/switch 2 (5 pts), boolean chains 3, loops 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SseTransport::send_and_recv (cognitive 50) crates/zeroclaw-tools/src/mcp_transport.rs:1940— SseTransport::send_and_recv has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 6, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcClient::spawn_ws_session (cognitive 38) apps/zerocode/src/client.rs:1983— RpcClient::spawn_ws_session has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (30 pts), match/switch 4 (6 pts), loops 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RpcClient::connect (cognitive 29) apps/zerocode/src/client.rs:1705— RpcClient::connect has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 6 (10 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConversationDock::layout (cognitive 35) apps/zerocode/src/app.rs:106— ConversationDock::layout has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 5, match/switch 4, 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.
ConversationDock::handle_mouse (cognitive 25) apps/zerocode/src/app.rs:462— ConversationDock::handle_mouse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 4 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_hardware::peripherals::create_peripheral_tools (cognitive 33) crates/zeroclaw-hardware/src/peripherals/mod.rs:48— zeroclaw_hardware::peripherals::create_peripheral_tools has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 7, match/switch 2 (5 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_hardware::wizard::run_setup (cognitive 17) crates/zeroclaw-hardware/src/wizard.rs:11— zeroclaw_hardware::wizard::run_setup has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_desktop::daemon::terminate_supervisor_tree (cognitive 32) apps/tauri/src/daemon.rs:415— zeroclaw_desktop::daemon::terminate_supervisor_tree has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 5 (8 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_desktop::daemon::find_zeroclaw_binary (cognitive 18) apps/tauri/src/daemon.rs:44— zeroclaw_desktop::daemon::find_zeroclaw_binary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_eval::grader::evaluate_expects (cognitive 29) crates/zeroclaw-eval/src/grader.rs:140— zeroclaw_eval::grader::evaluate_expects has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 7, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_eval::grader::grade_payload (cognitive 16) crates/zeroclaw-eval/src/grader.rs:70— zeroclaw_eval::grader::grade_payload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 4 (5 pts) (nesting depth added 6). 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.
LogDetail::detail_lines (cognitive 24) apps/zerocode/src/logs.rs:318— LogDetail::detail_lines has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3 (7 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.
LogDetail::clipboard_text (cognitive 16) apps/zerocode/src/logs.rs:458— LogDetail::clipboard_text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QdrantMemory::list_limited (cognitive 22) crates/zeroclaw-memory/src/qdrant.rs:262— QdrantMemory::list_limited has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QdrantMemory::migrate_session_ids_to_sanitized (cognitive 19) crates/zeroclaw-memory/src/qdrant.rs:440— QdrantMemory::migrate_session_ids_to_sanitized has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HttpRequestTool::execute (cognitive 22) crates/zeroclaw-tools/src/http_request.rs:564— HttpRequestTool::execute has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 8 (11 pts), if/else 7 (9 pts), boolean chains 2 (nesting depth added 5). 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.
HttpRequestTool::validate_url_policy (cognitive 18) crates/zeroclaw-tools/src/http_request.rs:119— HttpRequestTool::validate_url_policy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
zeroclaw_infra::net_guard::normalize_egress_pattern (cognitive 21) crates/zeroclaw-infra/src/net_guard.rs:214— zeroclaw_infra::net_guard::normalize_egress_pattern has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3, match/switch 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
zeroclaw_infra::net_guard::validate_resolved_ips_are_public (cognitive 21) crates/zeroclaw-infra/src/net_guard.rs:894— zeroclaw_infra::net_guard::validate_resolved_ips_are_public has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ApplicationFeedback::summary_line (cognitive 19) apps/zerocode/src/config_application.rs:157— ApplicationFeedback::summary_line has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
ApplicationFeedback::detail_lines (cognitive 17) apps/zerocode/src/config_application.rs:259— ApplicationFeedback::detail_lines has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BuildRegistry::claim_search (cognitive 19) crates/zeroclaw-runtime/src/tools/scoped.rs:137— BuildRegistry::claim_search has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BuildRegistry::seal (cognitive 16) crates/zeroclaw-runtime/src/tools/scoped.rs:224— BuildRegistry::seal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), match/switch 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Near-duplicate member pair (52 shared lines) crates/zeroclaw-memory/src/qdrant.rs:740— crates/zeroclaw-memory/src/qdrant.rs:740-839 | crates/zeroclaw-memory/src/qdrant.rs:1125-1229 — These two members are variants of one another: 52 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (52 shared lines) crates/zeroclaw-tools/src/discord_search.rs:57— crates/zeroclaw-tools/src/discord_search.rs:57-145 | crates/zeroclaw-tools/src/memory_recall.rs:58-136 — These two members are variants of one another: 52 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (9 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (9 members, 50+ identical tokens) crates/zeroclaw-hardware/src/peripherals/rpi.rs:93— crates/zeroclaw-hardware/src/peripherals/rpi.rs:93-121 | crates/zeroclaw-hardware/src/peripherals/rpi.rs:154-194 | crates/zeroclaw-hardware/src/peripherals/serial.rs:263-277 | crates/zeroclaw-hardware/src/peripherals/serial.rs:312-336 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:93-126 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:159-202 | crates/zeroclaw-hardware/src/rpi.rs:387-451 | crates/zeroclaw-hardware/src/rpi.rs:483-534 | crates/zeroclaw-hardware/src/rpi.rs:578-653 — These 9 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 9 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 9 times.
Members sharing a duplicated core (9 members, 50+ identical tokens) crates/zeroclaw-tools/src/jira_tool.rs:79— crates/zeroclaw-tools/src/jira_tool.rs:79-158 | crates/zeroclaw-tools/src/jira_tool.rs:186-257 | crates/zeroclaw-tools/src/jira_tool.rs:261-327 | crates/zeroclaw-tools/src/jira_tool.rs:333-400 | crates/zeroclaw-tools/src/jira_tool.rs:402-598 | crates/zeroclaw-tools/src/jira_tool.rs:600-653 | crates/zeroclaw-tools/src/jira_tool.rs:687-731 | crates/zeroclaw-tools/src/jira_tool.rs:750-833 | crates/zeroclaw-tools/src/jira_tool.rs:845-943 — These 9 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 9 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 9 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (7 members, 50+ identical tokens) crates/zeroclaw-gateway/src/api_skills.rs:80— crates/zeroclaw-gateway/src/api_skills.rs:80-103 | crates/zeroclaw-gateway/src/api_skills.rs:110-133 | crates/zeroclaw-gateway/src/api_skills.rs:139-156 | crates/zeroclaw-gateway/src/api_skills.rs:215-246 | crates/zeroclaw-gateway/src/api_skills.rs:253-275 | crates/zeroclaw-gateway/src/api_skills.rs:283-303 | crates/zeroclaw-gateway/src/api_skills.rs:311-332 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) crates/zeroclaw-tools/src/web_search_tool.rs:731— crates/zeroclaw-tools/src/web_search_tool.rs:731-770 | crates/zeroclaw-tools/src/web_search_tool.rs:881-922 | crates/zeroclaw-tools/src/web_search_tool.rs:1035-1118 | crates/zeroclaw-tools/src/web_search_tool.rs:1433-1473 | crates/zeroclaw-tools/src/web_search_tool.rs:1666-1710 | crates/zeroclaw-tools/src/web_search_tool.rs:1712-1753 | crates/zeroclaw-tools/src/web_search_tool.rs:1853-1890 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Duplicated block (34 lines × 2) crates/zeroclaw-channels/src/telegram.rs:6406— crates/zeroclaw-channels/src/telegram.rs:6406-6439 | crates/zeroclaw-channels/src/telegram.rs:6450-6483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2) crates/zeroclaw-channels/src/telegram.rs:6499— crates/zeroclaw-channels/src/telegram.rs:6499-6532 | crates/zeroclaw-channels/src/telegram.rs:6543-6576 — both copies are in the same file, so extract the 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 (33–34 lines × 2) crates/zeroclaw-providers/src/azure_openai.rs:637— crates/zeroclaw-providers/src/azure_openai.rs:637-670 | crates/zeroclaw-providers/src/azure_openai.rs:712-744 — both copies are in the same file, so extract the 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 (33–34 lines × 2) crates/zeroclaw-providers/src/reliable.rs:2569— crates/zeroclaw-providers/src/reliable.rs:2569-2602 | crates/zeroclaw-providers/src/reliable.rs:2866-2898 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29–32 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:4047— crates/zeroclaw-channels/src/discord/mod.rs:4047-4078 | crates/zeroclaw-channels/src/signal.rs:991-1019 | crates/zeroclaw-channels/src/slack.rs:6294-6322 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 (29–32 lines × 3) crates/zeroclaw-providers/src/compatible.rs:4769— crates/zeroclaw-providers/src/compatible.rs:4769-4799 | crates/zeroclaw-providers/src/compatible.rs:4978-5009 | crates/zeroclaw-providers/src/compatible.rs:5128-5156 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (32 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1396— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1396-1427 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1689-1720 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (32 lines × 2) crates/zeroclaw-providers/src/reliable.rs:4161— crates/zeroclaw-providers/src/reliable.rs:4161-4192 | crates/zeroclaw-providers/src/reliable.rs:4246-4277 — both copies are in the same file, so extract the 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 (28 lines × 2) crates/zeroclaw-macros/src/lib.rs:593— crates/zeroclaw-macros/src/lib.rs:593-620 | crates/zeroclaw-macros/src/lib.rs:1023-1050 — both copies are in the same file, so extract the 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 (28 lines × 2) firmware/nucleo/src/main.rs:33— firmware/nucleo/src/main.rs:33-60 | firmware/pico/src/main.rs:34-61 — before extracting anything, compare `firmware/nucleo/src/main.rs` and `firmware/pico/src/main.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (26–27 lines × 2) crates/zeroclaw-channels/src/slack.rs:6025— crates/zeroclaw-channels/src/slack.rs:6025-6050 | crates/zeroclaw-channels/src/slack.rs:6143-6169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26–27 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:4229— crates/zeroclaw-runtime/src/agent/agent.rs:4229-4254 | crates/zeroclaw-runtime/src/agent/agent.rs:4879-4905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–26 lines × 2) crates/zeroclaw-providers/src/telnyx.rs:189— crates/zeroclaw-providers/src/telnyx.rs:189-214 | crates/zeroclaw-providers/src/telnyx.rs:257-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25–26 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1565— crates/zeroclaw-runtime/src/agent/loop_.rs:1565-1590 | crates/zeroclaw-runtime/src/agent/loop_.rs:3643-3667 — both copies are in the same file, so extract the 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) apps/zerocode/src/wire.rs:274— apps/zerocode/src/wire.rs:274-297 | crates/zeroclaw-config/src/traits.rs:322-345 — 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 (24 lines × 2) crates/zeroclaw-tools/src/sessions.rs:895— crates/zeroclaw-tools/src/sessions.rs:895-918 | crates/zeroclaw-tools/src/sessions.rs:1016-1039 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23–24 lines × 2) crates/zeroclaw-hardware/src/introspect.rs:105— crates/zeroclaw-hardware/src/introspect.rs:105-127 | crates/zeroclaw-tools/src/hardware_board_info.rs:181-204 — 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 (23–24 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:824— crates/zeroclaw-runtime/src/skills/mod.rs:824-847 | crates/zeroclaw-runtime/src/skills/mod.rs:953-975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 3) crates/zeroclaw-infra/src/session_sqlite.rs:1126— crates/zeroclaw-infra/src/session_sqlite.rs:1126-1145 | crates/zeroclaw-infra/src/session_sqlite.rs:1445-1464 | crates/zeroclaw-infra/src/session_sqlite.rs:1497-1516 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (20 lines × 3) crates/zeroclaw-providers/src/reliable.rs:2965— crates/zeroclaw-providers/src/reliable.rs:2965-2984 | crates/zeroclaw-providers/src/reliable.rs:3414-3433 | crates/zeroclaw-providers/src/reliable.rs:3791-3810 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19–20 lines × 2) src/cron/mod.rs:343— src/cron/mod.rs:343-362 | src/cron/mod.rs:523-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 (19–20 lines × 2) src/cron/mod.rs:397— src/cron/mod.rs:397-416 | src/cron/mod.rs:439-457 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–19 lines × 2) crates/zeroclaw-config/src/alias_refs.rs:323— crates/zeroclaw-config/src/alias_refs.rs:323-338 | crates/zeroclaw-config/src/alias_refs.rs:473-491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–19 lines × 2) crates/zeroclaw-gateway/src/canvas.rs:268— crates/zeroclaw-gateway/src/canvas.rs:268-286 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:142-157 — before extracting anything, compare `crates/zeroclaw-gateway/src/canvas.rs` and `crates/zeroclaw-gateway/src/ws_sop_runs.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 3) crates/zeroclaw-runtime/src/sop/dispatch.rs:873— crates/zeroclaw-runtime/src/sop/dispatch.rs:873-890 | crates/zeroclaw-runtime/src/sop/dispatch.rs:922-939 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1163-1180 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18 lines × 3) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:160— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:160-177 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:218-235 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:255-272 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) crates/zeroclaw-runtime/src/sop/dispatch.rs:892— crates/zeroclaw-runtime/src/sop/dispatch.rs:892-907 | crates/zeroclaw-runtime/src/sop/dispatch.rs:941-956 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1183-1198 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (16 lines × 3) crates/zeroclaw-channels/src/qq.rs:135— crates/zeroclaw-channels/src/qq.rs:135-150 | crates/zeroclaw-channels/src/telegram.rs:900-915 | crates/zeroclaw-channels/src/wechat.rs:329-344 — before extracting anything, compare `crates/zeroclaw-channels/src/qq.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12–16 lines × 2) crates/zeroclaw-hardware/src/pico_code.rs:344— crates/zeroclaw-hardware/src/pico_code.rs:344-359 | crates/zeroclaw-hardware/src/pico_code.rs:530-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 (12–16 lines × 2) crates/zeroclaw-runtime/src/sop/executor.rs:1330— crates/zeroclaw-runtime/src/sop/executor.rs:1330-1341 | crates/zeroclaw-runtime/src/sop/executor.rs:1357-1372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 4) crates/zeroclaw-providers/src/azure_openai.rs:556— crates/zeroclaw-providers/src/azure_openai.rs:556-570 | crates/zeroclaw-providers/src/glm.rs:164-178 | crates/zeroclaw-providers/src/openai.rs:509-523 | crates/zeroclaw-providers/src/telnyx.rs:173-187 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 4) crates/zeroclaw-runtime/src/agent/loop_.rs:2098— crates/zeroclaw-runtime/src/agent/loop_.rs:2098-2112 | crates/zeroclaw-runtime/src/agent/loop_.rs:2199-2213 | crates/zeroclaw-runtime/src/agent/loop_.rs:2335-2349 | crates/zeroclaw-runtime/src/agent/loop_.rs:3005-3019 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–15 lines × 3) crates/zeroclaw-channels/src/reddit.rs:131— crates/zeroclaw-channels/src/reddit.rs:131-144 | crates/zeroclaw-channels/src/reddit.rs:328-341 | crates/zeroclaw-channels/src/reddit.rs:353-367 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–15 lines × 3) crates/zeroclaw-tools/src/browser_open.rs:121— crates/zeroclaw-tools/src/browser_open.rs:121-134 | crates/zeroclaw-tools/src/linkedin.rs:175-189 | crates/zeroclaw-tools/src/pushover.rs:143-156 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (10–15 lines × 2) crates/zeroclaw-providers/src/multimodal.rs:3194— crates/zeroclaw-providers/src/multimodal.rs:3194-3208 | crates/zeroclaw-providers/src/multimodal.rs:3282-3291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10–15 lines × 2) crates/zeroclaw-runtime/src/sop/approval/broker.rs:358— crates/zeroclaw-runtime/src/sop/approval/broker.rs:358-367 | crates/zeroclaw-runtime/src/sop/approval/broker.rs:451-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.
Duplicated block (14 lines × 4) crates/zeroclaw-providers/src/openai.rs:643— crates/zeroclaw-providers/src/openai.rs:643-656 | crates/zeroclaw-providers/src/openai.rs:731-744 | crates/zeroclaw-providers/src/openrouter.rs:843-856 | crates/zeroclaw-providers/src/openrouter.rs:1080-1093 — before extracting anything, compare `crates/zeroclaw-providers/src/openai.rs` and `crates/zeroclaw-providers/src/openrouter.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 4) crates/zeroclaw-providers/src/reliable.rs:2547— crates/zeroclaw-providers/src/reliable.rs:2547-2560 | crates/zeroclaw-providers/src/reliable.rs:2844-2857 | crates/zeroclaw-providers/src/reliable.rs:3284-3297 | crates/zeroclaw-providers/src/reliable.rs:3656-3669 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–14 lines × 2) apps/zerocode/src/config/keybindings.rs:72— apps/zerocode/src/config/keybindings.rs:72-85 | apps/zerocode/src/config/keybindings.rs:108-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–14 lines × 2) crates/zeroclaw-channels/src/telegram.rs:5368— crates/zeroclaw-channels/src/telegram.rs:5368-5379 | crates/zeroclaw-channels/src/telegram.rs:5783-5796 — both copies are in the same file, so extract the 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–13 lines × 3) REDACTED:820— REDACTED:820-832 | REDACTED:1075-1086 | REDACTED:1202-1213 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–13 lines × 3) crates/zeroclaw-memory/src/hygiene.rs:232— crates/zeroclaw-memory/src/hygiene.rs:232-243 | crates/zeroclaw-memory/src/hygiene.rs:281-293 | crates/zeroclaw-memory/src/hygiene.rs:325-336 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–13 lines × 2) crates/zeroclaw-config/src/schema.rs:22564— crates/zeroclaw-config/src/schema.rs:22564-22576 | crates/zeroclaw-config/src/schema.rs:22633-22641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–13 lines × 2) crates/zeroclaw-gateway/src/canvas.rs:253— crates/zeroclaw-gateway/src/canvas.rs:253-265 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:132-140 — before extracting anything, compare `crates/zeroclaw-gateway/src/canvas.rs` and `crates/zeroclaw-gateway/src/ws_sop_runs.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 53 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11–13 lines × 2) crates/zeroclaw-runtime/src/observability/otel.rs:440— crates/zeroclaw-runtime/src/observability/otel.rs:440-450 | crates/zeroclaw-runtime/src/observability/otel.rs:531-543 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–13 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:1208— crates/zeroclaw-tool-call-parser/src/lib.rs:1208-1220 | src/main.rs:9056-9066 — 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–12 lines × 2) crates/zeroclaw-gateway/src/api_sections.rs:300— crates/zeroclaw-gateway/src/api_sections.rs:300-307 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:11262-11273 — 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–12 lines × 2) crates/zeroclaw-runtime/src/tools/read_skill.rs:55— crates/zeroclaw-runtime/src/tools/read_skill.rs:55-66 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:74-81 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–11 lines × 3) crates/zeroclaw-runtime/src/agent/agent.rs:2929— crates/zeroclaw-runtime/src/agent/agent.rs:2929-2939 | crates/zeroclaw-runtime/src/agent/loop_.rs:1697-1706 | crates/zeroclaw-runtime/src/agent/loop_.rs:3741-3750 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10–11 lines × 3) crates/zeroclaw-tool-call-parser/src/lib.rs:1210— crates/zeroclaw-tool-call-parser/src/lib.rs:1210-1220 | src/main.rs:9057-9066 | xtask/src/cmd/mdbook/check.rs:223-232 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (10 lines × 7) crates/zeroclaw-channels/src/telegram.rs:6412— crates/zeroclaw-channels/src/telegram.rs:6412-6421 | crates/zeroclaw-channels/src/telegram.rs:6456-6465 | crates/zeroclaw-channels/src/telegram.rs:6505-6514 | crates/zeroclaw-channels/src/telegram.rs:6549-6558 | crates/zeroclaw-channels/src/telegram.rs:6598-6607 | crates/zeroclaw-channels/src/telegram.rs:6647-6656 | crates/zeroclaw-channels/src/telegram.rs:6696-6705 — 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.
Duplicated block (10 lines × 7) crates/zeroclaw-tools/src/web_search_tool.rs:744— crates/zeroclaw-tools/src/web_search_tool.rs:744-753 | crates/zeroclaw-tools/src/web_search_tool.rs:892-901 | crates/zeroclaw-tools/src/web_search_tool.rs:1066-1075 | crates/zeroclaw-tools/src/web_search_tool.rs:1446-1455 | crates/zeroclaw-tools/src/web_search_tool.rs:1679-1688 | crates/zeroclaw-tools/src/web_search_tool.rs:1726-1735 | crates/zeroclaw-tools/src/web_search_tool.rs:1866-1875 — 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.
Duplicated block (10 lines × 6) crates/zeroclaw-channels/src/cli.rs:71— crates/zeroclaw-channels/src/cli.rs:71-81 | crates/zeroclaw-channels/src/imessage.rs:305-315 | crates/zeroclaw-channels/src/irc.rs:666-676 | crates/zeroclaw-channels/src/mochat.rs:234-244 | crates/zeroclaw-channels/src/qq.rs:1704-1713 | crates/zeroclaw-channels/src/qq.rs:1777-1786 — before extracting anything, compare `crates/zeroclaw-channels/src/imessage.rs` and `crates/zeroclaw-channels/src/irc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:6480— crates/zeroclaw-channels/src/orchestrator/mod.rs:6480-6489 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6516-6525 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6535-6547 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6566-6575 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6873-6882 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6890-6899 — 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.
Duplicated block (9–10 lines × 3) apps/zerocode/src/config_manager.rs:3199— apps/zerocode/src/config_manager.rs:3199-3207 | apps/zerocode/src/config_manager.rs:3375-3384 | apps/zerocode/src/config_manager.rs:3638-3646 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–10 lines × 3) crates/zeroclaw-gateway/src/api_sop_author.rs:443— crates/zeroclaw-gateway/src/api_sop_author.rs:443-452 | crates/zeroclaw-gateway/src/api_sop_author.rs:672-680 | crates/zeroclaw-gateway/src/api_sop_author.rs:703-712 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6–10 lines × 3) crates/zeroclaw-providers/src/azure_openai.rs:647— crates/zeroclaw-providers/src/azure_openai.rs:647-656 | crates/zeroclaw-providers/src/azure_openai.rs:721-730 | crates/zeroclaw-providers/src/copilot.rs:482-487 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6–10 lines × 3) crates/zeroclaw-runtime/src/agent/tool_execution.rs:184— crates/zeroclaw-runtime/src/agent/tool_execution.rs:184-193 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3618-3623 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3663-3669 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8–10 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1823— crates/zeroclaw-channels/src/discord/mod.rs:1823-1830 | crates/zeroclaw-channels/src/discord/mod.rs:1848-1857 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–10 lines × 2) crates/zeroclaw-channels/src/slack.rs:4977— crates/zeroclaw-channels/src/slack.rs:4977-4986 | crates/zeroclaw-gateway/src/lib.rs:5118-5125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7–10 lines × 2) crates/zeroclaw-channels/src/email_channel.rs:480— crates/zeroclaw-channels/src/email_channel.rs:480-486 | crates/zeroclaw-channels/src/email_channel.rs:529-538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–10 lines × 2) crates/zeroclaw-runtime/src/security/auth_provider/enrollment.rs:283— crates/zeroclaw-runtime/src/security/auth_provider/enrollment.rs:283-292 | crates/zeroclaw-runtime/src/security/auth_provider/enrollment.rs:321-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–10 lines × 2) crates/zeroclaw-channels/src/slack.rs:2162— crates/zeroclaw-channels/src/slack.rs:2162-2171 | crates/zeroclaw-channels/src/slack.rs:2952-2957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–10 lines × 2) crates/zeroclaw-runtime/src/agent/tool_execution.rs:186— crates/zeroclaw-runtime/src/agent/tool_execution.rs:186-195 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:88-93 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 7) crates/zeroclaw-providers/src/azure_openai.rs:653— crates/zeroclaw-providers/src/azure_openai.rs:653-661 | crates/zeroclaw-providers/src/azure_openai.rs:727-735 | crates/zeroclaw-providers/src/compatible.rs:4569-4577 | crates/zeroclaw-providers/src/openai.rs:649-657 | crates/zeroclaw-providers/src/openai.rs:737-745 | crates/zeroclaw-providers/src/openrouter.rs:849-857 | crates/zeroclaw-providers/src/openrouter.rs:1086-1094 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/compatible.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 7) crates/zeroclaw-tools/src/jira_tool.rs:129— crates/zeroclaw-tools/src/jira_tool.rs:129-137 | crates/zeroclaw-tools/src/jira_tool.rs:226-234 | crates/zeroclaw-tools/src/jira_tool.rs:298-306 | crates/zeroclaw-tools/src/jira_tool.rs:377-385 | crates/zeroclaw-tools/src/jira_tool.rs:624-632 | crates/zeroclaw-tools/src/jira_tool.rs:715-723 | crates/zeroclaw-tools/src/jira_tool.rs:914-922 — 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.
Duplicated block (6–9 lines × 6) crates/zeroclaw-channels/src/discord/mod.rs:3887— crates/zeroclaw-channels/src/discord/mod.rs:3887-3892 | crates/zeroclaw-channels/src/line.rs:1246-1251 | crates/zeroclaw-channels/src/nextcloud_talk.rs:678-683 | crates/zeroclaw-channels/src/nextcloud_talk.rs:753-759 | crates/zeroclaw-channels/src/telegram.rs:8279-8287 | crates/zeroclaw-channels/src/transcription.rs:1361-1366 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–9 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:10160— crates/zeroclaw-channels/src/orchestrator/mod.rs:10160-10165 | crates/zeroclaw-channels/src/signal.rs:756-764 | crates/zeroclaw-channels/src/signal.rs:772-780 | crates/zeroclaw-channels/src/wechat.rs:2251-2259 | crates/zeroclaw-memory/src/consolidation.rs:226-231 | crates/zeroclaw-memory/src/consolidation.rs:359-364 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 5) apps/zerocode/src/dashboard.rs:785— apps/zerocode/src/dashboard.rs:785-793 | apps/zerocode/src/dashboard.rs:957-965 | apps/zerocode/src/dashboard.rs:1147-1155 | apps/zerocode/src/dashboard.rs:1634-1642 | apps/zerocode/src/logs.rs:994-1002 — 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.
Duplicated block (9 lines × 5) crates/zeroclaw-memory/src/qdrant.rs:416— crates/zeroclaw-memory/src/qdrant.rs:416-424 | crates/zeroclaw-memory/src/qdrant.rs:458-466 | crates/zeroclaw-memory/src/qdrant.rs:579-587 | crates/zeroclaw-memory/src/qdrant.rs:784-792 | crates/zeroclaw-memory/src/qdrant.rs:1176-1184 — 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.
Duplicated block (8 lines × 10) crates/zeroclaw-channels/src/whatsapp_storage.rs:622— crates/zeroclaw-channels/src/whatsapp_storage.rs:622-629 | crates/zeroclaw-channels/src/whatsapp_storage.rs:678-685 | crates/zeroclaw-channels/src/whatsapp_storage.rs:712-719 | crates/zeroclaw-channels/src/whatsapp_storage.rs:795-802 | crates/zeroclaw-channels/src/whatsapp_storage.rs:848-855 | crates/zeroclaw-channels/src/whatsapp_storage.rs:936-943 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1081-1088 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1109-1116 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1273-1280 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1307-1314 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 10) crates/zeroclaw-tools/src/microsoft365/mod.rs:85— crates/zeroclaw-tools/src/microsoft365/mod.rs:85-92 | crates/zeroclaw-tools/src/microsoft365/mod.rs:117-124 | crates/zeroclaw-tools/src/microsoft365/mod.rs:167-174 | crates/zeroclaw-tools/src/microsoft365/mod.rs:220-227 | crates/zeroclaw-tools/src/microsoft365/mod.rs:250-257 | crates/zeroclaw-tools/src/microsoft365/mod.rs:307-314 | crates/zeroclaw-tools/src/microsoft365/mod.rs:345-352 | crates/zeroclaw-tools/src/microsoft365/mod.rs:418-425 | crates/zeroclaw-tools/src/microsoft365/mod.rs:474-481 | crates/zeroclaw-tools/src/microsoft365/mod.rs:548-555 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 6) crates/zeroclaw-providers/src/dispatch.rs:745— crates/zeroclaw-providers/src/dispatch.rs:745-752 | crates/zeroclaw-providers/src/dispatch.rs:780-787 | crates/zeroclaw-providers/src/dispatch.rs:812-819 | crates/zeroclaw-providers/src/dispatch.rs:1125-1132 | crates/zeroclaw-providers/src/dispatch.rs:1158-1165 | crates/zeroclaw-providers/src/dispatch.rs:1190-1197 — 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.
Duplicated block (8 lines × 6) crates/zeroclaw-runtime/src/hooks/runner.rs:311— crates/zeroclaw-runtime/src/hooks/runner.rs:311-318 | crates/zeroclaw-runtime/src/hooks/runner.rs:337-344 | crates/zeroclaw-runtime/src/hooks/runner.rs:372-379 | crates/zeroclaw-runtime/src/hooks/runner.rs:420-427 | crates/zeroclaw-runtime/src/hooks/runner.rs:449-456 | crates/zeroclaw-runtime/src/hooks/runner.rs:488-495 — 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.
Duplicated block (7–8 lines × 4) crates/zeroclaw-channels/src/lark.rs:1942— crates/zeroclaw-channels/src/lark.rs:1942-1949 | crates/zeroclaw-channels/src/lark.rs:2068-2075 | crates/zeroclaw-channels/src/slack.rs:3085-3091 | crates/zeroclaw-channels/src/slack.rs:3823-3829 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7–8 lines × 4) crates/zeroclaw-providers/src/compatible.rs:3348— crates/zeroclaw-providers/src/compatible.rs:3348-3354 | crates/zeroclaw-providers/src/compatible.rs:3371-3378 | crates/zeroclaw-providers/src/compatible.rs:3422-3428 | crates/zeroclaw-providers/src/openrouter.rs:428-435 — before extracting anything, compare `crates/zeroclaw-providers/src/compatible.rs` and `crates/zeroclaw-providers/src/openrouter.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7–8 lines × 3) crates/zeroclaw-channels/src/discord/markers.rs:877— crates/zeroclaw-channels/src/discord/markers.rs:877-884 | crates/zeroclaw-channels/src/matrix.rs:3383-3390 | crates/zeroclaw-channels/src/whatsapp_web.rs:3137-3143 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/markers.rs` and `crates/zeroclaw-channels/src/matrix.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–8 lines × 3) crates/zeroclaw-providers/src/auth/email_oauth2.rs:148— crates/zeroclaw-providers/src/auth/email_oauth2.rs:148-155 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:193-200 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:294-300 — before extracting anything, compare `crates/zeroclaw-providers/src/auth/email_oauth2.rs` and `crates/zeroclaw-providers/src/auth/openai_oauth.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (1–8 lines × 4) crates/zeroclaw-channels/src/linq.rs:351— crates/zeroclaw-channels/src/linq.rs:351-351 | crates/zeroclaw-channels/src/linq.rs:355-362 | crates/zeroclaw-channels/src/nextcloud_talk.rs:537-544 | crates/zeroclaw-channels/src/whatsapp.rs:813-813 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (1–8 lines × 4) crates/zeroclaw-runtime/src/hooks/runner.rs:302— crates/zeroclaw-runtime/src/hooks/runner.rs:302-309 | crates/zeroclaw-runtime/src/hooks/runner.rs:370-370 | crates/zeroclaw-runtime/src/hooks/runner.rs:410-418 | crates/zeroclaw-runtime/src/hooks/runner.rs:483-486 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7 lines × 7) crates/zeroclaw-channels/src/orchestrator/mod.rs:16745— crates/zeroclaw-channels/src/orchestrator/mod.rs:16745-16751 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16771-16777 | crates/zeroclaw-gateway/src/ws.rs:530-536 | crates/zeroclaw-gateway/src/ws.rs:1199-1205 | crates/zeroclaw-gateway/src/ws.rs:1290-1296 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5159-5168 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5223-5232 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-gateway/src/ws.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 7) crates/zeroclaw-tools/src/image_gen.rs:423— crates/zeroclaw-tools/src/image_gen.rs:423-429 | crates/zeroclaw-tools/src/linkedin_client.rs:623-629 | crates/zeroclaw-tools/src/linkedin_client.rs:638-644 | crates/zeroclaw-tools/src/linkedin_client.rs:973-979 | crates/zeroclaw-tools/src/linkedin_client.rs:1036-1042 | crates/zeroclaw-tools/src/linkedin_client.rs:1094-1100 | crates/zeroclaw-tools/src/linkedin_client.rs:1150-1156 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 18) crates/zeroclaw-providers/src/anthropic.rs:2868— crates/zeroclaw-providers/src/anthropic.rs:2868-2872 | crates/zeroclaw-providers/src/anthropic.rs:2980-2984 | crates/zeroclaw-providers/src/azure_openai.rs:543-547 | crates/zeroclaw-providers/src/azure_openai.rs:614-618 | crates/zeroclaw-providers/src/azure_openai.rs:679-683 | crates/zeroclaw-providers/src/gemini.rs:1180-1184 | crates/zeroclaw-providers/src/gemini.rs:1211-1215 | crates/zeroclaw-providers/src/gemini.rs:1535-1542 | crates/zeroclaw-providers/src/openai.rs:495-499 | crates/zeroclaw-providers/src/openai.rs:583-587 | crates/zeroclaw-providers/src/openai.rs:679-683 | crates/zeroclaw-providers/src/openrouter.rs:652-656 | crates/zeroclaw-providers/src/openrouter.rs:718-722 | crates/zeroclaw-providers/src/openrouter.rs:791-795 | crates/zeroclaw-providers/src/openrouter.rs:996-1000 | crates/zeroclaw-providers/src/telnyx.rs:64-68 | crates/zeroclaw-providers/src/telnyx.rs:160-164 | crates/zeroclaw-providers/src/telnyx.rs:233-237 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 18) crates/zeroclaw-channels/src/orchestrator/mod.rs:14862— crates/zeroclaw-channels/src/orchestrator/mod.rs:14862-14866 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14932-14936 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15077-15081 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15281-15285 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15371-15375 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15396-15400 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15431-15435 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15475-15479 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15540-15544 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15578-15582 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15620-15624 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15670-15674 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15709-15713 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15753-15757 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15788-15792 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15833-15837 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15870-15874 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15967-15971 — all 18 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 8) crates/zeroclaw-providers/src/anthropic.rs:3553— crates/zeroclaw-providers/src/anthropic.rs:3553-3557 | crates/zeroclaw-providers/src/compatible.rs:3015-3019 | crates/zeroclaw-providers/src/compatible.rs:4860-4864 | crates/zeroclaw-providers/src/compatible.rs:5039-5043 | crates/zeroclaw-providers/src/compatible.rs:5183-5187 | crates/zeroclaw-providers/src/openai.rs:1586-1590 | crates/zeroclaw-providers/src/openai_codex.rs:1679-1683 | crates/zeroclaw-providers/src/openrouter.rs:983-987 — before extracting anything, compare `crates/zeroclaw-providers/src/compatible.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 8) crates/zeroclaw-tools/src/web_search_tool.rs:388— crates/zeroclaw-tools/src/web_search_tool.rs:388-392 | crates/zeroclaw-tools/src/web_search_tool.rs:610-614 | crates/zeroclaw-tools/src/web_search_tool.rs:786-790 | crates/zeroclaw-tools/src/web_search_tool.rs:925-929 | crates/zeroclaw-tools/src/web_search_tool.rs:1125-1129 | crates/zeroclaw-tools/src/web_search_tool.rs:1322-1326 | crates/zeroclaw-tools/src/web_search_tool.rs:1499-1503 | crates/zeroclaw-tools/src/web_search_tool.rs:1765-1769 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–5 lines × 3) crates/zeroclaw-channels/src/wechat.rs:491— crates/zeroclaw-channels/src/wechat.rs:491-495 | crates/zeroclaw-channels/src/wechat.rs:518-521 | crates/zeroclaw-channels/src/wechat.rs:550-554 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–5 lines × 3) crates/zeroclaw-providers/src/azure_openai.rs:119— crates/zeroclaw-providers/src/azure_openai.rs:119-123 | crates/zeroclaw-providers/src/openai.rs:150-154 | crates/zeroclaw-tools/src/pipeline.rs:328-331 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 5) crates/zeroclaw-channels/src/transcription.rs:177— crates/zeroclaw-channels/src/transcription.rs:177-187 | crates/zeroclaw-channels/src/transcription.rs:284-294 | crates/zeroclaw-channels/src/transcription.rs:388-398 | crates/zeroclaw-channels/src/transcription.rs:506-516 | crates/zeroclaw-channels/src/transcription.rs:681-691 — 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.
Duplicated block (11 lines × 5) crates/zeroclaw-plugins/src/wasm_channel.rs:1347— crates/zeroclaw-plugins/src/wasm_channel.rs:1347-1357 | crates/zeroclaw-plugins/src/wasm_channel.rs:1377-1387 | crates/zeroclaw-plugins/src/wasm_channel.rs:1408-1418 | crates/zeroclaw-plugins/src/wasm_channel.rs:1467-1477 | crates/zeroclaw-plugins/src/wasm_channel.rs:1492-1502 — 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.
Duplicated block (5 lines × 6) crates/zeroclaw-channels/src/dingtalk.rs:313— crates/zeroclaw-channels/src/dingtalk.rs:313-320 | crates/zeroclaw-channels/src/lark.rs:2368-2372 | crates/zeroclaw-channels/src/lark.rs:2654-2658 | crates/zeroclaw-channels/src/mattermost.rs:2274-2278 | crates/zeroclaw-channels/src/nextcloud_talk.rs:267-271 | crates/zeroclaw-channels/src/nextcloud_talk.rs:396-400 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/mattermost.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:17896— crates/zeroclaw-channels/src/orchestrator/mod.rs:17896-17900 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17915-17919 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17941-17945 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17972-17976 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17998-18002 | crates/zeroclaw-channels/src/orchestrator/mod.rs:18144-18148 — 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.
AC2 · Forms & labels· <ComboBox> field component without a label · ×1
<ComboBox> field component without a label web/src/components/sections/FieldForm.tsx:2597— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no a11y linter (eslint-plugin-jsx-a11y) and no axe/pa11y/Lighthouse in tests or CI. Start with the linter to catch issues at author time. What was searched, so you can tell an absence from a miss: the 81 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
ScopedToolRegistry::assemble (cyclomatic 59) crates/zeroclaw-runtime/src/tools/scoped.rs:551— ScopedToolRegistry::assemble has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SqliteSessionBackend::migrate_from_jsonl_with_handlers (cyclomatic 44) crates/zeroclaw-infra/src/session_sqlite.rs:510— SqliteSessionBackend::migrate_from_jsonl_with_handlers has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SqliteMemory::recall_scoped (cyclomatic 43) crates/zeroclaw-memory/src/sqlite.rs:1050— SqliteMemory::recall_scoped has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
IrcChannel::listen (cyclomatic 42) crates/zeroclaw-channels/src/irc.rs:419— IrcChannel::listen has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OtelObserver::record_event (cyclomatic 42) crates/zeroclaw-runtime/src/observability/otel.rs:268— OtelObserver::record_event has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ChatState::apply_update (cyclomatic 39) apps/zerocode/src/chat.rs:11442— ChatState::apply_update has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GoogleWorkspaceTool::execute (cyclomatic 38) crates/zeroclaw-tools/src/google_workspace.rs:187— GoogleWorkspaceTool::execute has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
V2Config::migrate (cyclomatic 36) crates/zeroclaw-config/src/schema/v2.rs:112— V2Config::migrate has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HailoOllamaModelProvider::normalize_messages (cyclomatic 34) crates/zeroclaw-providers/src/hailo_ollama.rs:692— HailoOllamaModelProvider::normalize_messages has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileUploadBundleTool::execute (cyclomatic 32) crates/zeroclaw-tools/src/file_upload_bundle.rs:216— FileUploadBundleTool::execute has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FileUploadBundleTool::mime_for_filename (cyclomatic 81) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
JiraTool::execute (cyclomatic 32) crates/zeroclaw-tools/src/jira_tool.rs:1038— JiraTool::execute has cyclomatic complexity 32 (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.
NativeBrowserState::execute_action (cyclomatic 31) crates/zeroclaw-tools/src/browser.rs:1623— NativeBrowserState::execute_action has cyclomatic complexity 31 (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.
V1Config::migrate (cyclomatic 30) crates/zeroclaw-config/src/schema/v1.rs:48— V1Config::migrate has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EventCollector::put (cyclomatic 30) crates/zeroclaw-log/src/layer.rs:316— EventCollector::put has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VoiceWakeChannel::listen (cyclomatic 28) crates/zeroclaw-channels/src/voice_wake.rs:220— VoiceWakeChannel::listen 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.
LogCaptureLayer::on_event (cyclomatic 28) crates/zeroclaw-log/src/layer.rs:101— LogCaptureLayer::on_event 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.
CronAddTool::execute (cyclomatic 27) crates/zeroclaw-runtime/src/tools/cron_add.rs:321— CronAddTool::execute has cyclomatic complexity 27 (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.
MatrixChannel::finalize_draft (cyclomatic 26) crates/zeroclaw-channels/src/matrix.rs:5084— MatrixChannel::finalize_draft has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SignalChannel::listen (cyclomatic 26) crates/zeroclaw-channels/src/signal.rs:695— SignalChannel::listen has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileDownloadTool::execute (cyclomatic 26) crates/zeroclaw-tools/src/file_download.rs:451— FileDownloadTool::execute has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FileWriteTool::execute (cyclomatic 26) crates/zeroclaw-tools/src/file_write.rs:73— FileWriteTool::execute has cyclomatic complexity 26 (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.
LinkedInTool::execute (cyclomatic 26) crates/zeroclaw-tools/src/linkedin.rs:161— LinkedInTool::execute has cyclomatic complexity 26 (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.
ClaudeCodeTool::execute (cyclomatic 25) crates/zeroclaw-tools/src/claude_code.rs:87— ClaudeCodeTool::execute has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OidcConfig::validate (cyclomatic 24) crates/zeroclaw-config/src/schema.rs:14330— OidcConfig::validate has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_desktop::daemon::terminate_supervisor_tree (cyclomatic 22) apps/tauri/src/daemon.rs:415— zeroclaw_desktop::daemon::terminate_supervisor_tree has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
WhatsAppChannel::parse_webhook_payload (cyclomatic 22) crates/zeroclaw-channels/src/whatsapp.rs:464— WhatsAppChannel::parse_webhook_payload 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.
GeminiModelProvider::send_generate_content (cyclomatic 22) crates/zeroclaw-providers/src/gemini.rs:1173— GeminiModelProvider::send_generate_content 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.
SopAdvanceTool::execute (cyclomatic 22) crates/zeroclaw-runtime/src/tools/sop_advance.rs:69— SopAdvanceTool::execute has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SopGraph::from_sop_with_specs (cyclomatic 22) crates/zeroclaw-runtime/src/sop/graph.rs:292— SopGraph::from_sop_with_specs 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.
MattermostChannel::listen_websocket (cyclomatic 21) crates/zeroclaw-channels/src/mattermost.rs:1466— MattermostChannel::listen_websocket has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SopMetricsCollector::rebuild_from_persistence (cyclomatic 21) crates/zeroclaw-runtime/src/sop/metrics.rs:231— SopMetricsCollector::rebuild_from_persistence 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.
ShellTool::execute (cyclomatic 21) crates/zeroclaw-runtime/src/tools/shell.rs:213— ShellTool::execute 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.
ClaudeCodeRunnerTool::execute (cyclomatic 21) crates/zeroclaw-tools/src/claude_code_runner.rs:109— ClaudeCodeRunnerTool::execute has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
zeroclaw_infra::net_guard::normalize_egress_pattern (cyclomatic 20) crates/zeroclaw-infra/src/net_guard.rs:214— zeroclaw_infra::net_guard::normalize_egress_pattern has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OpenAiCompatibleModelProvider::stream_chat (cyclomatic 20) crates/zeroclaw-providers/src/compatible.rs:4610— OpenAiCompatibleModelProvider::stream_chat 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.
FileUploadTool::execute (cyclomatic 20) crates/zeroclaw-tools/src/file_upload.rs:164— FileUploadTool::execute has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: FileUploadTool::mime_for_filename (cyclomatic 58) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
WasmChannel::listen (cyclomatic 19) crates/zeroclaw-plugins/src/wasm_channel.rs:1067— WasmChannel::listen 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.
FrameScanner::feed (cyclomatic 19) crates/zeroclaw-runtime/src/rpc/wss.rs:331— FrameScanner::feed 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.
SdJwt::resolve_disclosures (cyclomatic 19) crates/zeroclaw-runtime/src/verifiable_intent/crypto.rs:660— SdJwt::resolve_disclosures 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.
EscalateToHumanTool::execute (cyclomatic 19) crates/zeroclaw-tools/src/escalate.rs:173— EscalateToHumanTool::execute 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.
zeroclaw_eval::grader::evaluate_expects (cyclomatic 18) crates/zeroclaw-eval/src/grader.rs:140— zeroclaw_eval::grader::evaluate_expects 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.
ArduinoUploadTool::execute (cyclomatic 18) crates/zeroclaw-hardware/src/peripherals/arduino_upload.rs:227— ArduinoUploadTool::execute has cyclomatic complexity 18 (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.
StreamTextGuard::evaluate_pending (cyclomatic 18) crates/zeroclaw-runtime/src/agent/turn/stream_guard.rs:334— StreamTextGuard::evaluate_pending 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.
PrometheusObserver::record_event (cyclomatic 18) crates/zeroclaw-runtime/src/observability/prometheus.rs:251— PrometheusObserver::record_event 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.
PluginActivationPlan::build (cyclomatic 18) crates/zeroclaw-runtime/src/plugin_runtime.rs:104— PluginActivationPlan::build 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.
WssTransport::next_frame (cyclomatic 18) crates/zeroclaw-runtime/src/rpc/wss.rs:733— WssTransport::next_frame has cyclomatic complexity 18 (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.
SendViaTool::execute (cyclomatic 18) crates/zeroclaw-tools/src/send_via.rs:298— SendViaTool::execute 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.
nucleo::main (cyclomatic 18) firmware/nucleo/src/main.rs:19— nucleo::main has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LogDetail::detail_lines (cyclomatic 17) apps/zerocode/src/logs.rs:318— LogDetail::detail_lines has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Logs::handle_detail_key (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
FileReadTool::read_path (cyclomatic 17) crates/zeroclaw-runtime/src/tools/file_read.rs:101— FileReadTool::read_path 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.
ScheduleTool::handle_create_like (cyclomatic 17) crates/zeroclaw-runtime/src/tools/schedule.rs:334— ScheduleTool::handle_create_like 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.
GlobSearchTool::execute (cyclomatic 17) crates/zeroclaw-tools/src/glob_search.rs:45— GlobSearchTool::execute 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.
fill_translations::main (cyclomatic 17) tools/fill-translations/src/main.rs:453— fill_translations::main 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.
pico::main (cyclomatic 17) firmware/pico/src/main.rs:23— pico::main has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
JsonRpcFrame::from_value (cyclomatic 16) crates/zeroclaw-api/src/jsonrpc.rs:83— JsonRpcFrame::from_value 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.
TwitterChannel::listen (cyclomatic 16) crates/zeroclaw-channels/src/twitter.rs:221— TwitterChannel::listen 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.
DatasheetTool::execute (cyclomatic 16) crates/zeroclaw-hardware/src/datasheet.rs:498— DatasheetTool::execute has cyclomatic complexity 16 (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.
SkillShellTool::execute (cyclomatic 16) crates/zeroclaw-runtime/src/tools/skill_tool.rs:168— SkillShellTool::execute has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
CodexCliTool::execute (cyclomatic 16) crates/zeroclaw-tools/src/codex_cli.rs:90— CodexCliTool::execute 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.
ComposioTool::execute (cyclomatic 16) crates/zeroclaw-tools/src/composio.rs:614— ComposioTool::execute 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.
ContentSearchTool::execute (cyclomatic 16) crates/zeroclaw-tools/src/content_search.rs:119— ContentSearchTool::execute 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.
GeminiCliTool::execute (cyclomatic 16) crates/zeroclaw-tools/src/gemini_cli.rs:70— GeminiCliTool::execute 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.
NotionTool::execute (cyclomatic 16) crates/zeroclaw-tools/src/notion_tool.rs:224— NotionTool::execute has cyclomatic complexity 16 (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.
OpenCodeCliTool::execute (cyclomatic 16) crates/zeroclaw-tools/src/opencode_cli.rs:70— OpenCodeCliTool::execute 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.
ProxyConfigTool::handle_set (cyclomatic 16) crates/zeroclaw-tools/src/proxy_config.rs:247— ProxyConfigTool::handle_set has cyclomatic complexity 16 (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.
ScopedToolRegistry::assemble (cognitive 144) crates/zeroclaw-runtime/src/tools/scoped.rs:551— ScopedToolRegistry::assemble has cognitive complexity 144 (threshold 15). Drivers by points: if/else 38 (104 pts), loops 5 (16 pts), boolean chains 14, match/switch 5 (10 pts) (nesting depth added 82). 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.
SqliteMemory::recall_scoped (cognitive 99) crates/zeroclaw-memory/src/sqlite.rs:1050— SqliteMemory::recall_scoped has cognitive complexity 99 (threshold 15). Drivers by points: if/else 40 (79 pts), loops 5 (14 pts), boolean chains 6 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SqliteSessionBackend::migrate_from_jsonl_with_handlers (cognitive 89) crates/zeroclaw-infra/src/session_sqlite.rs:510— SqliteSessionBackend::migrate_from_jsonl_with_handlers has cognitive complexity 89 (threshold 15). Drivers by points: if/else 28 (61 pts), match/switch 9 (19 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IrcChannel::listen (cognitive 83) crates/zeroclaw-channels/src/irc.rs:419— IrcChannel::listen has cognitive complexity 83 (threshold 15). Drivers by points: if/else 28 (72 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OtelObserver::record_event (cognitive 70) crates/zeroclaw-runtime/src/observability/otel.rs:268— OtelObserver::record_event has cognitive complexity 70 (threshold 15). Drivers by points: if/else 27 (64 pts), boolean chains 5, match/switch 1 (nesting depth added 37). 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.
WhatsAppChannel::parse_webhook_payload (cognitive 69) crates/zeroclaw-channels/src/whatsapp.rs:464— WhatsAppChannel::parse_webhook_payload has cognitive complexity 69 (threshold 15). Drivers by points: if/else 16 (43 pts), match/switch 4 (20 pts), loops 3 (6 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.
GoogleWorkspaceTool::execute (cognitive 56) crates/zeroclaw-tools/src/google_workspace.rs:187— GoogleWorkspaceTool::execute has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (29 pts), match/switch 9 (15 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FrameScanner::feed (cognitive 53) crates/zeroclaw-runtime/src/rpc/wss.rs:331— FrameScanner::feed has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (38 pts), loops 3 (7 pts), match/switch 2 (6 pts), boolean chains 2 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TwitterChannel::listen (cognitive 51) crates/zeroclaw-channels/src/twitter.rs:221— TwitterChannel::listen has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (41 pts), loops 2 (5 pts), match/switch 2 (5 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HailoOllamaModelProvider::normalize_messages (cognitive 49) crates/zeroclaw-providers/src/hailo_ollama.rs:692— HailoOllamaModelProvider::normalize_messages has cognitive complexity 49 (threshold 15). Drivers by points: if/else 20 (32 pts), match/switch 4 (7 pts), boolean chains 6, loops 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogCaptureLayer::on_event (cognitive 48) crates/zeroclaw-log/src/layer.rs:101— LogCaptureLayer::on_event has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (34 pts), loops 3 (10 pts), boolean chains 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClaudeCodeTool::execute (cognitive 47) crates/zeroclaw-tools/src/claude_code.rs:87— ClaudeCodeTool::execute has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (35 pts), loops 2 (5 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VoiceWakeChannel::listen (cognitive 46) crates/zeroclaw-channels/src/voice_wake.rs:220— VoiceWakeChannel::listen has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (32 pts), match/switch 4 (11 pts), boolean chains 2, loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
V2Config::migrate (cognitive 46) crates/zeroclaw-config/src/schema/v2.rs:112— V2Config::migrate has cognitive complexity 46 (threshold 15). Drivers by points: if/else 31 (41 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FileUploadBundleTool::execute (cognitive 45) crates/zeroclaw-tools/src/file_upload_bundle.rs:216— FileUploadBundleTool::execute has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (30 pts), match/switch 5 (9 pts), loops 4, boolean chains 2 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
CronAddTool::execute (cognitive 44) crates/zeroclaw-runtime/src/tools/cron_add.rs:321— CronAddTool::execute has cognitive complexity 44 (threshold 15). Drivers by points: match/switch 16 (27 pts), if/else 9 (17 pts) (nesting depth added 19). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
nucleo::main (cognitive 43) firmware/nucleo/src/main.rs:19— nucleo::main has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (34 pts), match/switch 1 (5 pts), boolean chains 3, loops 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
V1Config::migrate (cognitive 42) crates/zeroclaw-config/src/schema/v1.rs:48— V1Config::migrate has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25 (33 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
pico::main (cognitive 42) firmware/pico/src/main.rs:23— pico::main has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (33 pts), match/switch 1 (5 pts), boolean chains 3, loops 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MochatChannel::listen (cognitive 40) crates/zeroclaw-channels/src/mochat.rs:134— MochatChannel::listen has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (30 pts), loops 2 (5 pts), match/switch 2 (5 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.
SopGraph::from_sop_with_specs (cognitive 40) crates/zeroclaw-runtime/src/sop/graph.rs:292— SopGraph::from_sop_with_specs has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 6 (9 pts), match/switch 2 (5 pts), boolean chains 3 (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.
NostrChannel::listen (cognitive 39) crates/zeroclaw-channels/src/nostr.rs:168— NostrChannel::listen has cognitive complexity 39 (threshold 15). Drivers by points: if/else 6 (25 pts), match/switch 4 (13 pts), 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.
GeminiModelProvider::send_generate_content (cognitive 38) crates/zeroclaw-providers/src/gemini.rs:1173— GeminiModelProvider::send_generate_content has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (26 pts), match/switch 4 (9 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LinkedInTool::execute (cognitive 35) crates/zeroclaw-tools/src/linkedin.rs:161— LinkedInTool::execute has cognitive complexity 35 (threshold 15). Drivers by points: match/switch 9 (18 pts), if/else 8 (14 pts), boolean chains 3 (nesting depth added 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SopStatusTool::execute (cognitive 34) crates/zeroclaw-runtime/src/tools/sop_status.rs:73— SopStatusTool::execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 4 (11 pts), match/switch 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SopMetricsCollector::rebuild_from_persistence (cognitive 33) crates/zeroclaw-runtime/src/sop/metrics.rs:231— SopMetricsCollector::rebuild_from_persistence has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 9 (11 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileDownloadTool::execute (cognitive 33) crates/zeroclaw-tools/src/file_download.rs:451— FileDownloadTool::execute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (18 pts), match/switch 7 (8 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NotionChannel::listen (cognitive 32) crates/zeroclaw-channels/src/notion.rs:370— NotionChannel::listen has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (20 pts), match/switch 3 (7 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PluginActivationPlan::build (cognitive 31) crates/zeroclaw-runtime/src/plugin_runtime.rs:104— PluginActivationPlan::build has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 5 (7 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SdJwt::resolve_disclosures (cognitive 31) crates/zeroclaw-runtime/src/verifiable_intent/crypto.rs:660— SdJwt::resolve_disclosures has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 3 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HardwareCapabilitiesTool::execute (cognitive 30) crates/zeroclaw-hardware/src/peripherals/capabilities_tool.rs:47— HardwareCapabilitiesTool::execute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EventCollector::put (cognitive 30) crates/zeroclaw-log/src/layer.rs:316— EventCollector::put has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 4, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
OidcAuthProvider::claims_to_identity (cognitive 30) crates/zeroclaw-runtime/src/security/auth_provider/oidc.rs:809— OidcAuthProvider::claims_to_identity has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 6, match/switch 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
JiraTool::execute (cognitive 30) crates/zeroclaw-tools/src/jira_tool.rs:1038— JiraTool::execute has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 14 (21 pts), if/else 5 (7 pts), boolean chains 2 (nesting depth added 9). 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.
WssTransport::next_frame (cognitive 29) crates/zeroclaw-runtime/src/rpc/wss.rs:733— WssTransport::next_frame has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 6 (17 pts), if/else 5 (11 pts), loops 1 (nesting depth added 17). 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.
SendViaTool::execute (cognitive 28) crates/zeroclaw-tools/src/send_via.rs:298— SendViaTool::execute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 6 (12 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
LandlockSandbox::build_ruleset (cognitive 27) crates/zeroclaw-runtime/src/security/landlock.rs:339— LandlockSandbox::build_ruleset has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (5 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShellTool::execute (cognitive 27) crates/zeroclaw-runtime/src/tools/shell.rs:213— ShellTool::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (18 pts), match/switch 4, loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClaudeCodeRunnerTool::execute (cognitive 27) crates/zeroclaw-tools/src/claude_code_runner.rs:109— ClaudeCodeRunnerTool::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (16 pts), match/switch 6 (9 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
EscalateToHumanTool::execute (cognitive 27) crates/zeroclaw-tools/src/escalate.rs:173— EscalateToHumanTool::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
FileWriteTool::execute (cognitive 27) crates/zeroclaw-tools/src/file_write.rs:73— FileWriteTool::execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 8 (11 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WasmChannel::listen (cognitive 26) crates/zeroclaw-plugins/src/wasm_channel.rs:1067— WasmChannel::listen has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 5 (9 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexCliTool::execute (cognitive 26) crates/zeroclaw-tools/src/codex_cli.rs:90— CodexCliTool::execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 3 (5 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ComposioTool::execute (cognitive 26) crates/zeroclaw-tools/src/composio.rs:614— ComposioTool::execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 5 (9 pts), boolean chains 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
GeminiCliTool::execute (cognitive 26) crates/zeroclaw-tools/src/gemini_cli.rs:70— GeminiCliTool::execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 3 (5 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenCodeCliTool::execute (cognitive 26) crates/zeroclaw-tools/src/opencode_cli.rs:70— OpenCodeCliTool::execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 3 (5 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DingTalkChannel::listen (cognitive 25) crates/zeroclaw-channels/src/dingtalk.rs:192— DingTalkChannel::listen has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 4 (9 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LeakDetector::check_private_keys (cognitive 25) crates/zeroclaw-runtime/src/security/leak_detector.rs:326— LeakDetector::check_private_keys has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (9 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileReadTool::read_path (cognitive 25) crates/zeroclaw-runtime/src/tools/file_read.rs:101— FileReadTool::read_path has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 6 (8 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.
OidcConfig::validate (cognitive 24) crates/zeroclaw-config/src/schema.rs:14330— OidcConfig::validate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 5, match/switch 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WideCellCleanupBackend::draw (cognitive 23) apps/zerocode/src/terminal_backend.rs:84— WideCellCleanupBackend::draw has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 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.
EmailChannel::build_email_message (cognitive 23) crates/zeroclaw-channels/src/email_channel.rs:882— EmailChannel::build_email_message has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 2 (6 pts), boolean chains 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.
ProjectedGroup::entries_to_messages (cognitive 23) REDACTED:3140— ProjectedGroup::entries_to_messages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillShellTool::execute (cognitive 23) crates/zeroclaw-runtime/src/tools/skill_tool.rs:168— SkillShellTool::execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (7 pts), match/switch 3, 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.
GlobSearchTool::execute (cognitive 22) crates/zeroclaw-tools/src/glob_search.rs:45— GlobSearchTool::execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 4 (6 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextSnapshot::selected_text (cognitive 21) apps/zerocode/src/text_selection.rs:246— TextSnapshot::selected_text has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RelayServer::serve (cognitive 21) apps/zerorelay/src/lib.rs:666— RelayServer::serve has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (8 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.
BlueskyChannel::listen (cognitive 21) crates/zeroclaw-channels/src/bluesky.rs:514— BlueskyChannel::listen has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (6 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScheduleTool::handle_create_like (cognitive 21) crates/zeroclaw-runtime/src/tools/schedule.rs:334— ScheduleTool::handle_create_like has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 4 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileUploadTool::execute (cognitive 21) crates/zeroclaw-tools/src/file_upload.rs:164— FileUploadTool::execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, match/switch 5, boolean chains 1, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GmailPushChannel::fetch_history_inner (cognitive 20) crates/zeroclaw-channels/src/gmail_push.rs:256— GmailPushChannel::fetch_history_inner has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MatrixConfig::validate_stream_tool_arguments (cognitive 20) crates/zeroclaw-config/src/schema.rs:17897— MatrixConfig::validate_stream_tool_arguments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RouterModelProvider::resolve_cost_optimized (cognitive 20) crates/zeroclaw-providers/src/router.rs:224— RouterModelProvider::resolve_cost_optimized has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SkillsService::list_skills (cognitive 20) crates/zeroclaw-runtime/src/skills/service.rs:136— SkillsService::list_skills has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolSearchTool::search_tools (cognitive 20) crates/zeroclaw-tools/src/tool_search.rs:262— ToolSearchTool::search_tools has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), boolean chains 2, 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.
GitChannel::poll_repo (cognitive 19) crates/zeroclaw-channels/src/git/channel.rs:279— GitChannel::poll_repo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PacedChannel::paced_dispatch (cognitive 19) crates/zeroclaw-channels/src/paced_channel.rs:176— PacedChannel::paced_dispatch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrincipalResolver::resolve_grants (cognitive 19) crates/zeroclaw-runtime/src/security/principal_resolver.rs:273— PrincipalResolver::resolve_grants has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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.
ApprovalBroker::count_qualified_voters (cognitive 19) crates/zeroclaw-runtime/src/sop/approval/broker.rs:569— ApprovalBroker::count_qualified_voters has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CustomTunnel::start (cognitive 19) crates/zeroclaw-runtime/src/tunnel/custom.rs:34— CustomTunnel::start has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitForgeTool::execute (cognitive 19) crates/zeroclaw-tools/src/git_forge.rs:897— GitForgeTool::execute has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 7 (9 pts) (nesting depth added 6). 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.
LinkedInClient::update_env_token (cognitive 19) crates/zeroclaw-tools/src/linkedin_client.rs:744— LinkedInClient::update_env_token has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
McpPromptsTool::execute (cognitive 19) crates/zeroclaw-tools/src/mcp_prompts_tool.rs:69— McpPromptsTool::execute has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 9 (19 pts) (nesting depth added 10). 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.
McpResourcesTool::execute (cognitive 19) crates/zeroclaw-tools/src/mcp_resources_tool.rs:68— McpResourcesTool::execute has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 9 (19 pts) (nesting depth added 10). 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.
TranscriptLayoutCache::rebuild_screen_ranges (cognitive 18) apps/zerocode/src/chat/transcript_layout.rs:280— TranscriptLayoutCache::rebuild_screen_ranges has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StatusReporter::sync_to (cognitive 18) apps/zerocode/src/osc_status.rs:185— StatusReporter::sync_to has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (18 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.
FilesystemChannel::dispatch_loop (cognitive 18) crates/zeroclaw-channels/src/filesystem.rs:123— FilesystemChannel::dispatch_loop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 3 (7 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NativeBrowserState::execute_action (cognitive 18) crates/zeroclaw-tools/src/browser.rs:1623— NativeBrowserState::execute_action has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 4 (7 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ContentSearchTool::execute (cognitive 18) crates/zeroclaw-tools/src/content_search.rs:119— ContentSearchTool::execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 4 (6 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Chord::display (cognitive 17) apps/zerocode/src/keymap/chord.rs:89— Chord::display has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
IMessageChannel::listen (cognitive 17) crates/zeroclaw-channels/src/imessage.rs:186— IMessageChannel::listen has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ChannelNotifyObserver::record_event (cognitive 17) crates/zeroclaw-channels/src/orchestrator/mod.rs:189— ChannelNotifyObserver::record_event has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GrokCliModelProvider::normalize_and_validate_extra_args (cognitive 17) crates/zeroclaw-providers/src/grok_cli.rs:667— GrokCliModelProvider::normalize_and_validate_extra_args has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConfigApplicationLedger::published (cognitive 17) crates/zeroclaw-runtime/src/config_application.rs:93— ConfigApplicationLedger::published has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (7 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.
LiveSessionRefreshScope::resolve_provider_ref (cognitive 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:769— LiveSessionRefreshScope::resolve_provider_ref has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SopAdvanceTool::execute (cognitive 17) crates/zeroclaw-runtime/src/tools/sop_advance.rs:69— SopAdvanceTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 5 (7 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpawnSubagentTool::execute (cognitive 17) crates/zeroclaw-runtime/src/tools/spawn_subagent.rs:141— SpawnSubagentTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 5 (6 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PinggyTunnel::start (cognitive 17) crates/zeroclaw-runtime/src/tunnel/pinggy.rs:28— PinggyTunnel::start has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 5 (7 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CanvasTool::execute (cognitive 17) crates/zeroclaw-tools/src/canvas.rs:229— CanvasTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 7 (12 pts), if/else 3 (5 pts) (nesting depth added 7). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
McpServer::dispatch_rpc (cognitive 17) crates/zeroclaw-tools/src/mcp_client.rs:619— McpServer::dispatch_rpc has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PollTool::execute (cognitive 17) crates/zeroclaw-tools/src/poll.rs:183— PollTool::execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 4 (7 pts) (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ZerocodePane::handle_mouse (cognitive 16) apps/zerocode/src/zerocode_pane.rs:1755— ZerocodePane::handle_mouse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_api::model_provider::projected_entry_count (cognitive 16) crates/zeroclaw-api/src/model_provider.rs:333— zeroclaw_api::model_provider::projected_entry_count has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (7 pts), match/switch 2 (6 pts), if/else 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiscordEmbed::to_api (cognitive 16) crates/zeroclaw-channels/src/discord/embed.rs:51— DiscordEmbed::to_api has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
LinqChannel::parse_webhook_payload (cognitive 16) crates/zeroclaw-channels/src/linq.rs:123— LinqChannel::parse_webhook_payload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (15 pts), match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RedditChannel::listen (cognitive 16) crates/zeroclaw-channels/src/reddit.rs:375— RedditChannel::listen has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DatasheetTool::execute (cognitive 16) crates/zeroclaw-hardware/src/datasheet.rs:498— DatasheetTool::execute has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 9 (13 pts), if/else 2 (3 pts) (nesting depth added 5). 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.
DeviceRegistry::discover (cognitive 16) crates/zeroclaw-hardware/src/device.rs:391— DeviceRegistry::discover has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResolvedDestination::new (cognitive 16) crates/zeroclaw-infra/src/net_guard.rs:1230— ResolvedDestination::new has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SecretInput::interact_with_events (cognitive 16) crates/zeroclaw-runtime/src/cli_input.rs:213— SecretInput::interact_with_events has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PrometheusObserver::record_event (cognitive 16) crates/zeroclaw-runtime/src/observability/prometheus.rs:251— PrometheusObserver::record_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). 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.
A2aHttpClient::send_message (cognitive 16) crates/zeroclaw-tools/src/a2a_client.rs:967— A2aHttpClient::send_message has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
BrowserDelegateTool::execute (cognitive 16) crates/zeroclaw-tools/src/browser_delegate.rs:170— BrowserDelegateTool::execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
esp32::main (cognitive 16) firmware/esp32/src/main.rs:15— esp32::main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Near-duplicate member family (7 members, 21 shared lines) · ×1
Near-duplicate member family (7 members, 21 shared lines) crates/zeroclaw-channels/src/telegram.rs:6399— crates/zeroclaw-channels/src/telegram.rs:6399-6439 | crates/zeroclaw-channels/src/telegram.rs:6449-6483 | crates/zeroclaw-channels/src/telegram.rs:6492-6532 | crates/zeroclaw-channels/src/telegram.rs:6542-6576 | crates/zeroclaw-channels/src/telegram.rs:6585-6625 | crates/zeroclaw-channels/src/telegram.rs:6634-6674 | crates/zeroclaw-channels/src/telegram.rs:6683-6723 — These 7 members are variants of one another: a block of 21 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 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 60 shared lines) · ×1
Near-duplicate member family (5 members, 60 shared lines) crates/zeroclaw-tools/src/claude_code.rs:87— crates/zeroclaw-tools/src/claude_code.rs:87-307 | crates/zeroclaw-tools/src/claude_code_runner.rs:109-336 | crates/zeroclaw-tools/src/codex_cli.rs:90-233 | crates/zeroclaw-tools/src/gemini_cli.rs:70-213 | crates/zeroclaw-tools/src/opencode_cli.rs:70-213 — These 5 members are variants of one another: a block of 60 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 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· Near-duplicate member family (4 members, 169 shared lines) · ×1
Near-duplicate member family (4 members, 169 shared lines) crates/zeroclaw-providers/src/reliable.rs:2526— crates/zeroclaw-providers/src/reliable.rs:2526-2818 | crates/zeroclaw-providers/src/reliable.rs:2825-3128 | crates/zeroclaw-providers/src/reliable.rs:3257-3577 | crates/zeroclaw-providers/src/reliable.rs:3600-3958 — These 4 members are variants of one another: a block of 169 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 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· Near-duplicate member family (4 members, 36 shared lines) · ×1
Near-duplicate member family (4 members, 36 shared lines) crates/zeroclaw-providers/src/auth/mod.rs:204— crates/zeroclaw-providers/src/auth/mod.rs:204-286 | crates/zeroclaw-providers/src/auth/mod.rs:293-383 | crates/zeroclaw-providers/src/auth/mod.rs:390-471 | crates/zeroclaw-providers/src/auth/mod.rs:504-593 — These 4 members are variants of one another: a block of 36 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 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· Near-duplicate member family (3 members, 34 shared lines) · ×1
Near-duplicate member family (3 members, 34 shared lines) crates/zeroclaw-tools/src/ask_user.rs:87— crates/zeroclaw-tools/src/ask_user.rs:87-288 | crates/zeroclaw-tools/src/escalate.rs:173-435 | crates/zeroclaw-tools/src/poll.rs:183-410 — These 3 members are variants of one another: a block of 34 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
Near-duplicate member pair (107 shared lines) crates/zeroclaw-tools/src/file_upload.rs:164— crates/zeroclaw-tools/src/file_upload.rs:164-379 | crates/zeroclaw-tools/src/file_upload_bundle.rs:216-542 — These two members are variants of one another: 107 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (76 shared lines) crates/zeroclaw-runtime/src/skills/mod.rs:774— crates/zeroclaw-runtime/src/skills/mod.rs:774-877 | crates/zeroclaw-runtime/src/skills/mod.rs:903-1005 — These two members are variants of one another: 76 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (56 shared lines) firmware/nucleo/src/main.rs:19— firmware/nucleo/src/main.rs:19-95 | firmware/pico/src/main.rs:23-97 — These two members are variants of one another: 56 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (55 shared lines) apps/zerocode/src/config_manager.rs:3357— apps/zerocode/src/config_manager.rs:3357-3550 | apps/zerocode/src/config_manager.rs:3619-3761 — These two members are variants of one another: 55 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (53 shared lines) crates/zeroclaw-config/src/schema.rs:12256— crates/zeroclaw-config/src/schema.rs:12256-12345 | crates/zeroclaw-config/src/schema.rs:12355-12502 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (49 shared lines) crates/zeroclaw-channels/src/lark.rs:1855— crates/zeroclaw-channels/src/lark.rs:1855-1986 | crates/zeroclaw-channels/src/lark.rs:1995-2126 — These two members are variants of one another: 49 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (41 shared lines) crates/zeroclaw-channels/src/mochat.rs:134— crates/zeroclaw-channels/src/mochat.rs:134-283 | crates/zeroclaw-channels/src/twitter.rs:221-420 — These two members are variants of one another: 41 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (39 shared lines) crates/zeroclaw-tools/src/mcp_prompts_tool.rs:69— crates/zeroclaw-tools/src/mcp_prompts_tool.rs:69-143 | crates/zeroclaw-tools/src/mcp_resources_tool.rs:68-141 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (36 shared lines) crates/zeroclaw-memory/src/qdrant.rs:153— crates/zeroclaw-memory/src/qdrant.rs:153-216 | crates/zeroclaw-memory/src/qdrant.rs:854-919 — These two members are variants of one another: 36 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (34 shared lines) apps/zerocode/src/jsonrpc.rs:220— apps/zerocode/src/jsonrpc.rs:220-260 | crates/zeroclaw-api/src/jsonrpc.rs:352-389 — These two members are variants of one another: 34 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (33 shared lines) apps/zerocode/src/diff.rs:121— apps/zerocode/src/diff.rs:121-175 | apps/zerocode/src/diff.rs:198-244 — These two members are variants of one another: 33 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (32 shared lines) crates/zeroclaw-channels/src/discord/mod.rs:538— crates/zeroclaw-channels/src/discord/mod.rs:538-673 | crates/zeroclaw-channels/src/discord/mod.rs:675-769 — These two members are variants of one another: 32 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (28 shared lines) crates/zeroclaw-tools/src/model_routing_config.rs:92— crates/zeroclaw-tools/src/model_routing_config.rs:92-133 | crates/zeroclaw-tools/src/proxy_config.rs:22-62 — These two members are variants of one another: 28 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (22 shared lines) crates/zeroclaw-tools/src/linkedin_client.rs:76— crates/zeroclaw-tools/src/linkedin_client.rs:76-157 | crates/zeroclaw-tools/src/pushover.rs:44-103 — These two members are variants of one another: 22 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) crates/zeroclaw-memory/src/lucid.rs:415— crates/zeroclaw-memory/src/lucid.rs:415-503 | crates/zeroclaw-memory/src/markdown.rs:204-289 — 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· Members sharing a duplicated core (17 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (17 members, 50+ identical tokens) crates/zeroclaw-providers/src/anthropic.rs:2866— crates/zeroclaw-providers/src/anthropic.rs:2866-2951 | crates/zeroclaw-providers/src/anthropic.rs:2974-3104 | crates/zeroclaw-providers/src/azure_openai.rs:542-606 | crates/zeroclaw-providers/src/azure_openai.rs:613-670 | crates/zeroclaw-providers/src/azure_openai.rs:678-744 | crates/zeroclaw-providers/src/gemini.rs:1179-1441 | crates/zeroclaw-providers/src/gemini.rs:1529-1587 | crates/zeroclaw-providers/src/openai.rs:494-559 | crates/zeroclaw-providers/src/openai.rs:582-666 | crates/zeroclaw-providers/src/openai.rs:678-754 | crates/zeroclaw-providers/src/openrouter.rs:651-710 | crates/zeroclaw-providers/src/openrouter.rs:717-783 | crates/zeroclaw-providers/src/openrouter.rs:790-866 | crates/zeroclaw-providers/src/openrouter.rs:995-1103 | crates/zeroclaw-providers/src/telnyx.rs:63-89 | crates/zeroclaw-providers/src/telnyx.rs:159-225 | crates/zeroclaw-providers/src/telnyx.rs:232-292 — These 17 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 17 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 17 times.
D4 · Code Duplication· Members sharing a duplicated core (13 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (13 members, 50+ identical tokens) crates/zeroclaw-channels/src/lark.rs:3745— crates/zeroclaw-channels/src/lark.rs:3745-3876 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:69-281 | crates/zeroclaw-runtime/src/tools/sop_approve.rs:62-216 | crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:122-160 | crates/zeroclaw-tools/src/browser.rs:2368-2643 | crates/zeroclaw-tools/src/file_edit.rs:76-257 | crates/zeroclaw-tools/src/file_write.rs:73-334 | crates/zeroclaw-tools/src/google_workspace.rs:187-486 | crates/zeroclaw-tools/src/knowledge_tool.rs:159-247 | crates/zeroclaw-tools/src/knowledge_tool.rs:330-403 | crates/zeroclaw-tools/src/knowledge_tool.rs:489-559 | crates/zeroclaw-tools/src/memory_store.rs:52-108 | crates/zeroclaw-tools/src/reaction.rs:71-202 — These 13 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 13 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 13 times.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) crates/zeroclaw-tools/src/microsoft365/mod.rs:78— crates/zeroclaw-tools/src/microsoft365/mod.rs:78-105 | crates/zeroclaw-tools/src/microsoft365/mod.rs:110-155 | crates/zeroclaw-tools/src/microsoft365/mod.rs:160-211 | crates/zeroclaw-tools/src/microsoft365/mod.rs:213-238 | crates/zeroclaw-tools/src/microsoft365/mod.rs:243-295 | crates/zeroclaw-tools/src/microsoft365/mod.rs:300-334 | crates/zeroclaw-tools/src/microsoft365/mod.rs:338-406 | crates/zeroclaw-tools/src/microsoft365/mod.rs:411-462 | crates/zeroclaw-tools/src/microsoft365/mod.rs:467-536 | crates/zeroclaw-tools/src/microsoft365/mod.rs:541-574 — These 10 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 10 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 10 times.
Duplicated block (84–91 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1217— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1217-1307 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1554-1637 — both copies are in the same file, so extract the 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 (75–80 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:1968— crates/zeroclaw-channels/src/orchestrator/mod.rs:1968-2042 | crates/zeroclaw-channels/src/util.rs:228-307 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/util.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 (56–58 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2450— crates/zeroclaw-runtime/src/agent/loop_.rs:2450-2505 | crates/zeroclaw-runtime/src/agent/loop_.rs:3129-3186 — both copies are in the same file, so extract the 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 (50–55 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1801— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1801-1855 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3042-3091 — both copies are in the same file, so extract the 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 (51–52 lines × 2) crates/zeroclaw-providers/src/reliable.rs:3306— crates/zeroclaw-providers/src/reliable.rs:3306-3356 | crates/zeroclaw-providers/src/reliable.rs:3682-3733 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (48 lines × 5) crates/zeroclaw-tools/src/claude_code.rs:141— crates/zeroclaw-tools/src/claude_code.rs:141-188 | crates/zeroclaw-tools/src/claude_code_runner.rs:139-186 | crates/zeroclaw-tools/src/codex_cli.rs:123-170 | crates/zeroclaw-tools/src/gemini_cli.rs:103-150 | crates/zeroclaw-tools/src/opencode_cli.rs:103-150 — before extracting anything, compare `crates/zeroclaw-tools/src/claude_code.rs` and `crates/zeroclaw-tools/src/codex_cli.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (44–48 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4940— crates/zeroclaw-providers/src/compatible.rs:4940-4987 | crates/zeroclaw-providers/src/compatible.rs:5094-5137 — both copies are in the same file, so extract the 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 (48 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2246— crates/zeroclaw-runtime/src/agent/loop_.rs:2246-2293 | crates/zeroclaw-runtime/src/agent/loop_.rs:2881-2928 — both copies are in the same file, so extract the 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 (44–47 lines × 2) crates/zeroclaw-providers/src/reliable.rs:4112— crates/zeroclaw-providers/src/reliable.rs:4112-4158 | crates/zeroclaw-providers/src/reliable.rs:4201-4244 — both copies are in the same file, so extract the 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 (43–46 lines × 2) crates/zeroclaw-providers/src/compatible.rs:2727— crates/zeroclaw-providers/src/compatible.rs:2727-2772 | crates/zeroclaw-providers/src/compatible.rs:2847-2889 — both copies are in the same file, so extract the 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 (39–44 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1154— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1154-1197 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1496-1534 — both copies are in the same file, so extract the 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 (43 lines × 4) crates/zeroclaw-providers/src/reliable.rs:2760— crates/zeroclaw-providers/src/reliable.rs:2760-2802 | crates/zeroclaw-providers/src/reliable.rs:3074-3116 | crates/zeroclaw-providers/src/reliable.rs:3523-3565 | crates/zeroclaw-providers/src/reliable.rs:3900-3942 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (43 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:2050— crates/zeroclaw-channels/src/orchestrator/mod.rs:2050-2092 | crates/zeroclaw-channels/src/util.rs:318-360 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/util.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 (42 lines × 2) crates/zeroclaw-providers/src/reliable.rs:3387— crates/zeroclaw-providers/src/reliable.rs:3387-3428 | crates/zeroclaw-providers/src/reliable.rs:3764-3805 — both copies are in the same file, so extract the 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 (39–40 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2330— crates/zeroclaw-runtime/src/agent/loop_.rs:2330-2369 | crates/zeroclaw-runtime/src/agent/loop_.rs:3001-3039 — both copies are in the same file, so extract the 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 (40 lines × 2) src/cron/mod.rs:292— src/cron/mod.rs:292-331 | src/cron/mod.rs:479-518 — both copies are in the same file, so extract the 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 (37–39 lines × 4) crates/zeroclaw-providers/src/reliable.rs:2682— crates/zeroclaw-providers/src/reliable.rs:2682-2720 | crates/zeroclaw-providers/src/reliable.rs:2998-3034 | crates/zeroclaw-providers/src/reliable.rs:3447-3483 | crates/zeroclaw-providers/src/reliable.rs:3824-3860 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (38–39 lines × 2) crates/zeroclaw-channels/src/telegram.rs:3954— crates/zeroclaw-channels/src/telegram.rs:3954-3991 | crates/zeroclaw-channels/src/telegram.rs:4023-4061 — both copies are in the same file, so extract the 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 (35–38 lines × 2) crates/zeroclaw-providers/src/compatible.rs:5001— crates/zeroclaw-providers/src/compatible.rs:5001-5038 | crates/zeroclaw-providers/src/compatible.rs:5148-5182 — both copies are in the same file, so extract the 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 (37 lines × 4) crates/zeroclaw-providers/src/reliable.rs:2610— crates/zeroclaw-providers/src/reliable.rs:2610-2646 | crates/zeroclaw-providers/src/reliable.rs:2907-2943 | crates/zeroclaw-providers/src/reliable.rs:3358-3394 | crates/zeroclaw-providers/src/reliable.rs:3735-3771 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (33–36 lines × 2) crates/zeroclaw-gateway/src/api_pairing.rs:539— crates/zeroclaw-gateway/src/api_pairing.rs:539-571 | crates/zeroclaw-gateway/src/api_pairing.rs:639-674 — both copies are in the same file, so extract the 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 (31–33 lines × 2) crates/zeroclaw-gateway/src/api_sop_author.rs:529— crates/zeroclaw-gateway/src/api_sop_author.rs:529-559 | crates/zeroclaw-gateway/src/api_sop_author.rs:811-843 — both copies are in the same file, so extract the 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 (33 lines × 2) crates/zeroclaw-gateway/src/nodes.rs:179— crates/zeroclaw-gateway/src/nodes.rs:179-211 | crates/zeroclaw-gateway/src/ws.rs:105-137 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (27–33 lines × 2) crates/zeroclaw-runtime/src/observability/otel.rs:400— crates/zeroclaw-runtime/src/observability/otel.rs:400-432 | crates/zeroclaw-runtime/src/observability/otel.rs:457-483 — both copies are in the same file, so extract the 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–33 lines × 2) src/alias_cli/export.rs:828— src/alias_cli/export.rs:828-860 | src/alias_cli/export.rs:939-968 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (32 lines × 4) crates/zeroclaw-providers/src/reliable.rs:2726— crates/zeroclaw-providers/src/reliable.rs:2726-2757 | crates/zeroclaw-providers/src/reliable.rs:3040-3071 | crates/zeroclaw-providers/src/reliable.rs:3489-3520 | crates/zeroclaw-providers/src/reliable.rs:3866-3897 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (29–32 lines × 2) crates/zeroclaw-runtime/src/tools/deliver_file.rs:231— crates/zeroclaw-runtime/src/tools/deliver_file.rs:231-259 | crates/zeroclaw-runtime/src/tools/file_read.rs:115-146 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/deliver_file.rs` and `crates/zeroclaw-runtime/src/tools/file_read.rs` 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. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16–31 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1934— crates/zeroclaw-runtime/src/agent/loop_.rs:1934-1949 | crates/zeroclaw-runtime/src/agent/loop_.rs:3910-3940 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29–30 lines × 2) apps/zerocode/src/config_manager.rs:3377— apps/zerocode/src/config_manager.rs:3377-3406 | apps/zerocode/src/config_manager.rs:3640-3668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26–30 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:6443— crates/zeroclaw-runtime/src/sop/engine.rs:6443-6472 | crates/zeroclaw-runtime/src/sop/engine.rs:6502-6527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) apps/zerocode/src/enroll.rs:410— apps/zerocode/src/enroll.rs:410-438 | apps/zerorelay/src/enroll_proxy.rs:420-448 — before extracting anything, compare `apps/zerocode/src/enroll.rs` and `apps/zerorelay/src/enroll_proxy.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 (27–29 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1329— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1329-1357 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1658-1684 — both copies are in the same file, so extract the 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 (28–29 lines × 2) crates/zeroclaw-providers/src/gemini.rs:1352— crates/zeroclaw-providers/src/gemini.rs:1352-1379 | crates/zeroclaw-providers/src/gemini.rs:1380-1408 — both copies are in the same file, so extract the 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 (28 lines × 3) crates/zeroclaw-runtime/src/tools/cron_add.rs:79— crates/zeroclaw-runtime/src/tools/cron_add.rs:79-106 | crates/zeroclaw-runtime/src/tools/cron_remove.rs:30-57 | crates/zeroclaw-runtime/src/tools/cron_update.rs:50-77 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/cron_add.rs` and `crates/zeroclaw-runtime/src/tools/cron_update.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 114 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26–28 lines × 2) crates/zeroclaw-tools/src/ask_user.rs:261— crates/zeroclaw-tools/src/ask_user.rs:261-288 | crates/zeroclaw-tools/src/escalate.rs:395-420 — before extracting anything, compare `crates/zeroclaw-tools/src/ask_user.rs` and `crates/zeroclaw-tools/src/escalate.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (23–27 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:2993— crates/zeroclaw-providers/src/anthropic.rs:2993-3019 | crates/zeroclaw-providers/src/anthropic.rs:3245-3267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:775— crates/zeroclaw-runtime/src/skills/mod.rs:775-801 | crates/zeroclaw-runtime/src/skills/mod.rs:904-930 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23–26 lines × 2) crates/zeroclaw-channels/src/slack.rs:4536— crates/zeroclaw-channels/src/slack.rs:4536-4558 | crates/zeroclaw-channels/src/slack.rs:5987-6012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–26 lines × 2) crates/zeroclaw-providers/src/gemini.rs:1210— crates/zeroclaw-providers/src/gemini.rs:1210-1229 | crates/zeroclaw-providers/src/gemini.rs:1532-1557 — both copies are in the same file, so extract the 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 (2–25 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:2490— crates/zeroclaw-channels/src/discord/mod.rs:2490-2491 | crates/zeroclaw-channels/src/discord/mod.rs:2505-2529 | crates/zeroclaw-channels/src/discord/mod.rs:2537-2538 | crates/zeroclaw-channels/src/discord/mod.rs:2717-2741 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (22–25 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2560— crates/zeroclaw-channels/src/telegram.rs:2560-2584 | crates/zeroclaw-channels/src/wechat.rs:1002-1023 — before extracting anything, compare `crates/zeroclaw-channels/src/telegram.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 158 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–25 lines × 2) crates/zeroclaw-config/src/schema.rs:26523— crates/zeroclaw-config/src/schema.rs:26523-26547 | crates/zeroclaw-config/src/schema.rs:26632-26648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–24 lines × 3) crates/zeroclaw-providers/src/reliable.rs:2648— crates/zeroclaw-providers/src/reliable.rs:2648-2668 | crates/zeroclaw-providers/src/reliable.rs:3396-3419 | crates/zeroclaw-providers/src/reliable.rs:3773-3796 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (21–24 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1776— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1776-1796 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3014-3037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 3) crates/zeroclaw-tools/src/codex_cli.rs:185— crates/zeroclaw-tools/src/codex_cli.rs:185-207 | crates/zeroclaw-tools/src/gemini_cli.rs:165-187 | crates/zeroclaw-tools/src/opencode_cli.rs:165-187 — before extracting anything, compare `crates/zeroclaw-tools/src/codex_cli.rs` and `crates/zeroclaw-tools/src/gemini_cli.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–23 lines × 2) crates/zeroclaw-gateway/src/api.rs:1955— crates/zeroclaw-gateway/src/api.rs:1955-1971 | crates/zeroclaw-gateway/src/api.rs:2048-2070 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19–22 lines × 3) crates/zeroclaw-channels/src/line.rs:827— crates/zeroclaw-channels/src/line.rs:827-846 | crates/zeroclaw-channels/src/telegram.rs:2569-2590 | crates/zeroclaw-channels/src/wechat.rs:1011-1029 — before extracting anything, compare `crates/zeroclaw-channels/src/line.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 3) crates/zeroclaw-channels/src/qq.rs:156— crates/zeroclaw-channels/src/qq.rs:156-177 | crates/zeroclaw-channels/src/telegram.rs:918-939 | crates/zeroclaw-channels/src/wechat.rs:347-368 — before extracting anything, compare `crates/zeroclaw-channels/src/qq.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21–22 lines × 2) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:94— crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:94-114 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:181-202 — `crates/zeroclaw-channels/src/git/providers/gitea/provider.rs` and `crates/zeroclaw-channels/src/git/providers/github/provider.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 52 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (20–22 lines × 2) crates/zeroclaw-memory/src/qdrant.rs:818— crates/zeroclaw-memory/src/qdrant.rs:818-839 | crates/zeroclaw-memory/src/qdrant.rs:1210-1229 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 3) crates/zeroclaw-providers/src/reliable.rs:2578— crates/zeroclaw-providers/src/reliable.rs:2578-2598 | crates/zeroclaw-providers/src/reliable.rs:2647-2667 | crates/zeroclaw-providers/src/reliable.rs:2874-2894 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (1–21 lines × 10) crates/zeroclaw-channels/src/discord/mod.rs:2486— crates/zeroclaw-channels/src/discord/mod.rs:2486-2487 | crates/zeroclaw-channels/src/discord/mod.rs:2501-2502 | crates/zeroclaw-channels/src/discord/mod.rs:2533-2534 | crates/zeroclaw-channels/src/discord/mod.rs:2713-2714 | crates/zeroclaw-channels/src/discord/mod.rs:2769-2770 | crates/zeroclaw-channels/src/discord/mod.rs:2797-2817 | crates/zeroclaw-channels/src/discord/mod.rs:2839-2839 | crates/zeroclaw-channels/src/discord/mod.rs:2901-2921 | crates/zeroclaw-channels/src/discord/mod.rs:2956-2956 | crates/zeroclaw-channels/src/discord/mod.rs:2978-2979 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17–21 lines × 2) crates/zeroclaw-config/src/schema.rs:12296— crates/zeroclaw-config/src/schema.rs:12296-12312 | crates/zeroclaw-config/src/schema.rs:12459-12479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–20 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:254— crates/zeroclaw-providers/src/auth/mod.rs:254-270 | crates/zeroclaw-providers/src/auth/mod.rs:345-364 | crates/zeroclaw-providers/src/auth/mod.rs:435-451 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (17–20 lines × 2) apps/zerocode/src/client.rs:1799— apps/zerocode/src/client.rs:1799-1818 | apps/zerocode/src/client.rs:2082-2098 — both copies are in the same file, so extract the 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–20 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:372— crates/zeroclaw-runtime/src/agent/loop_.rs:372-391 | src/main.rs:72-85 — 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 × 3) apps/zerocode/src/i18n.rs:117— apps/zerocode/src/i18n.rs:117-135 | crates/zeroclaw-runtime/src/i18n.rs:222-240 | crates/zeroclaw-tools/src/i18n.rs:91-109 — before extracting anything, compare `apps/zerocode/src/i18n.rs` and `crates/zeroclaw-tools/src/i18n.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–19 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1784— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1784-1799 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3022-3040 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3115-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.
Duplicated block (17–19 lines × 3) crates/zeroclaw-providers/src/compatible.rs:1036— crates/zeroclaw-providers/src/compatible.rs:1036-1054 | crates/zeroclaw-providers/src/compatible.rs:1111-1129 | crates/zeroclaw-providers/src/openai.rs:1198-1214 — before extracting anything, compare `crates/zeroclaw-providers/src/compatible.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–19 lines × 2) apps/zerocode/src/app.rs:1787— apps/zerocode/src/app.rs:1787-1805 | apps/zerocode/src/app.rs:1844-1860 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–18 lines × 4) crates/zeroclaw-providers/src/auth/mod.rs:220— crates/zeroclaw-providers/src/auth/mod.rs:220-236 | crates/zeroclaw-providers/src/auth/mod.rs:308-324 | crates/zeroclaw-providers/src/auth/mod.rs:405-419 | crates/zeroclaw-providers/src/auth/mod.rs:521-538 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–18 lines × 3) apps/zerocode/src/chat.rs:8355— apps/zerocode/src/chat.rs:8355-8371 | apps/zerocode/src/chat.rs:8432-8445 | apps/zerocode/src/file_explorer.rs:549-566 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (17–18 lines × 3) crates/zeroclaw-api/src/model_provider.rs:238— crates/zeroclaw-api/src/model_provider.rs:238-254 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6016-6033 | crates/zeroclaw-providers/src/ollama.rs:258-275 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (16–18 lines × 3) crates/zeroclaw-providers/src/compatible.rs:3348— crates/zeroclaw-providers/src/compatible.rs:3348-3363 | crates/zeroclaw-providers/src/compatible.rs:3371-3388 | crates/zeroclaw-providers/src/openrouter.rs:428-445 — before extracting anything, compare `crates/zeroclaw-providers/src/compatible.rs` and `crates/zeroclaw-providers/src/openrouter.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13–18 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:4057— crates/zeroclaw-runtime/src/sop/engine.rs:4057-4074 | crates/zeroclaw-runtime/src/sop/engine.rs:4725-4737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 4) crates/zeroclaw-providers/src/openrouter.rs:673— crates/zeroclaw-providers/src/openrouter.rs:673-689 | crates/zeroclaw-providers/src/openrouter.rs:746-762 | crates/zeroclaw-providers/src/openrouter.rs:817-833 | crates/zeroclaw-providers/src/openrouter.rs:1054-1070 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14–17 lines × 3) crates/zeroclaw-config/src/alias_refs.rs:325— crates/zeroclaw-config/src/alias_refs.rs:325-338 | crates/zeroclaw-config/src/alias_refs.rs:397-410 | crates/zeroclaw-config/src/alias_refs.rs:475-491 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15–17 lines × 2) crates/zeroclaw-providers/src/azure_openai.rs:304— crates/zeroclaw-providers/src/azure_openai.rs:304-318 | crates/zeroclaw-providers/src/compatible.rs:1331-1347 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/compatible.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13–16 lines × 4) crates/zeroclaw-gateway/src/api_webauthn.rs:70— crates/zeroclaw-gateway/src/api_webauthn.rs:70-85 | crates/zeroclaw-gateway/src/api_webauthn.rs:164-176 | crates/zeroclaw-gateway/src/api_webauthn.rs:250-262 | crates/zeroclaw-gateway/src/api_webauthn.rs:295-310 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–16 lines × 3) crates/zeroclaw-api/src/channel.rs:1028— crates/zeroclaw-api/src/channel.rs:1028-1043 | crates/zeroclaw-channels/src/signal.rs:682-693 | crates/zeroclaw-channels/src/whatsapp.rs:1048-1062 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (13–16 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:6513— crates/zeroclaw-channels/src/orchestrator/mod.rs:6513-6525 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6532-6547 — both copies are in the same file, so extract the 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 (3–15 lines × 3) crates/zeroclaw-config/src/alias_refs.rs:345— crates/zeroclaw-config/src/alias_refs.rs:345-359 | crates/zeroclaw-config/src/alias_refs.rs:414-416 | crates/zeroclaw-config/src/alias_refs.rs:503-517 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12–15 lines × 2) crates/zeroclaw-config/src/schema.rs:23263— crates/zeroclaw-config/src/schema.rs:23263-23277 | crates/zeroclaw-config/src/schema.rs:23310-23321 — both copies are in the same file, so extract the 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–15 lines × 2) crates/zeroclaw-macros/src/lib.rs:1604— crates/zeroclaw-macros/src/lib.rs:1604-1614 | crates/zeroclaw-macros/src/lib.rs:1639-1653 — both copies are in the same file, so extract the 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 × 6) crates/zeroclaw-gateway/src/api_webauthn.rs:69— crates/zeroclaw-gateway/src/api_webauthn.rs:69-82 | crates/zeroclaw-gateway/src/api_webauthn.rs:109-122 | crates/zeroclaw-gateway/src/api_webauthn.rs:163-176 | crates/zeroclaw-gateway/src/api_webauthn.rs:200-213 | crates/zeroclaw-gateway/src/api_webauthn.rs:249-262 | crates/zeroclaw-gateway/src/api_webauthn.rs:294-307 — 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.
Duplicated block (10–14 lines × 4) crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:88— crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:88-97 | crates/zeroclaw-runtime/src/tunnel/custom.rs:61-74 | crates/zeroclaw-runtime/src/tunnel/ngrok.rs:75-84 | crates/zeroclaw-runtime/src/tunnel/openvpn.rs:89-98 — before extracting anything, compare `crates/zeroclaw-runtime/src/tunnel/cloudflare.rs` and `crates/zeroclaw-runtime/src/tunnel/ngrok.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10–14 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1735— crates/zeroclaw-runtime/src/agent/loop_.rs:1735-1748 | crates/zeroclaw-runtime/src/agent/loop_.rs:3779-3788 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–14 lines × 2) src/alias_cli/export.rs:806— src/alias_cli/export.rs:806-819 | src/alias_cli/export.rs:927-935 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–13 lines × 2) apps/zerocode/src/config_manager.rs:3437— apps/zerocode/src/config_manager.rs:3437-3449 | apps/zerocode/src/config_manager.rs:3580-3587 — both copies are in the same file, so extract the 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 (1–13 lines × 4) crates/zeroclaw-runtime/src/security/estop.rs:83— crates/zeroclaw-runtime/src/security/estop.rs:83-83 | crates/zeroclaw-runtime/src/security/estop.rs:89-89 | crates/zeroclaw-runtime/src/skills/mod.rs:850-862 | crates/zeroclaw-runtime/src/skills/mod.rs:978-990 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (10–13 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:1450— crates/zeroclaw-runtime/src/tools/delegate.rs:1450-1459 | crates/zeroclaw-runtime/src/tools/delegate.rs:1497-1509 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–13 lines × 2) crates/zeroclaw-runtime/src/tools/scoped.rs:810— crates/zeroclaw-runtime/src/tools/scoped.rs:810-822 | crates/zeroclaw-runtime/src/tools/scoped.rs:1083-1088 — both copies are in the same file, so extract the 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–12 lines × 6) crates/zeroclaw-channels/src/imessage.rs:304— crates/zeroclaw-channels/src/imessage.rs:304-315 | crates/zeroclaw-channels/src/irc.rs:665-676 | crates/zeroclaw-channels/src/lark.rs:1758-1768 | crates/zeroclaw-channels/src/mochat.rs:233-244 | crates/zeroclaw-channels/src/qq.rs:1703-1713 | crates/zeroclaw-channels/src/qq.rs:1776-1786 — before extracting anything, compare `crates/zeroclaw-channels/src/imessage.rs` and `crates/zeroclaw-channels/src/irc.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 5) crates/zeroclaw-tools/src/claude_code.rs:96— crates/zeroclaw-tools/src/claude_code.rs:96-107 | crates/zeroclaw-tools/src/claude_code_runner.rs:118-129 | crates/zeroclaw-tools/src/codex_cli.rs:99-110 | crates/zeroclaw-tools/src/gemini_cli.rs:79-90 | crates/zeroclaw-tools/src/opencode_cli.rs:79-90 — before extracting anything, compare `crates/zeroclaw-tools/src/claude_code.rs` and `crates/zeroclaw-tools/src/codex_cli.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (10–12 lines × 3) crates/zeroclaw-runtime/src/tools/delegate.rs:2175— crates/zeroclaw-runtime/src/tools/delegate.rs:2175-2186 | crates/zeroclaw-runtime/src/tools/delegate.rs:2233-2242 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:498-507 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (9–12 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2151— crates/zeroclaw-runtime/src/agent/loop_.rs:2151-2162 | crates/zeroclaw-runtime/src/agent/loop_.rs:4093-4101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–11 lines × 9) crates/zeroclaw-runtime/src/sop/engine.rs:836— crates/zeroclaw-runtime/src/sop/engine.rs:836-846 | crates/zeroclaw-runtime/src/sop/engine.rs:4009-4016 | crates/zeroclaw-runtime/src/sop/engine.rs:6217-6227 | crates/zeroclaw-runtime/src/sop/engine.rs:6264-6271 | crates/zeroclaw-runtime/src/sop/executor.rs:225-231 | crates/zeroclaw-runtime/src/sop/executor.rs:677-684 | crates/zeroclaw-runtime/src/sop/executor.rs:987-997 | crates/zeroclaw-runtime/src/sop/executor.rs:1152-1162 | crates/zeroclaw-runtime/src/sop/executor.rs:1194-1204 — before extracting anything, compare `crates/zeroclaw-runtime/src/sop/engine.rs` and `crates/zeroclaw-runtime/src/sop/executor.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 6) crates/zeroclaw-providers/src/azure_openai.rs:651— crates/zeroclaw-providers/src/azure_openai.rs:651-661 | crates/zeroclaw-providers/src/azure_openai.rs:725-735 | crates/zeroclaw-providers/src/openai.rs:647-657 | crates/zeroclaw-providers/src/openai.rs:735-745 | crates/zeroclaw-providers/src/openrouter.rs:847-857 | crates/zeroclaw-providers/src/openrouter.rs:1084-1094 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/openai.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 143 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8–11 lines × 4) crates/zeroclaw-api/src/model_provider.rs:884— crates/zeroclaw-api/src/model_provider.rs:884-892 | crates/zeroclaw-providers/src/compatible.rs:3743-3750 | crates/zeroclaw-providers/src/hailo_ollama.rs:950-960 | crates/zeroclaw-providers/src/ollama.rs:513-520 — before extracting anything, compare `crates/zeroclaw-providers/src/hailo_ollama.rs` and `crates/zeroclaw-providers/src/ollama.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9–11 lines × 4) crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:66— crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:66-75 | crates/zeroclaw-runtime/src/tunnel/ngrok.rs:54-62 | crates/zeroclaw-runtime/src/tunnel/openvpn.rs:67-76 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:64-74 — before extracting anything, compare `crates/zeroclaw-runtime/src/tunnel/cloudflare.rs` and `crates/zeroclaw-runtime/src/tunnel/ngrok.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9–11 lines × 3) crates/zeroclaw-channels/src/slack.rs:1581— crates/zeroclaw-channels/src/slack.rs:1581-1590 | crates/zeroclaw-channels/src/slack.rs:2178-2188 | crates/zeroclaw-channels/src/slack.rs:2666-2674 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–11 lines × 2) crates/zeroclaw-gateway/src/lib.rs:2100— crates/zeroclaw-gateway/src/lib.rs:2100-2110 | crates/zeroclaw-gateway/src/lib.rs:2948-2955 — both copies are in the same file, so extract the 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 (2–11 lines × 3) crates/zeroclaw-tools/src/ask_user.rs:141— crates/zeroclaw-tools/src/ask_user.rs:141-149 | crates/zeroclaw-tools/src/escalate.rs:249-259 | crates/zeroclaw-tools/src/poll.rs:246-247 — before extracting anything, compare `crates/zeroclaw-tools/src/ask_user.rs` and `crates/zeroclaw-tools/src/escalate.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 80 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5–10 lines × 9) crates/zeroclaw-channels/src/lark.rs:1878— crates/zeroclaw-channels/src/lark.rs:1878-1887 | crates/zeroclaw-channels/src/lark.rs:2015-2024 | crates/zeroclaw-channels/src/mattermost.rs:939-948 | crates/zeroclaw-channels/src/mattermost.rs:2153-2161 | crates/zeroclaw-channels/src/slack.rs:1565-1574 | crates/zeroclaw-channels/src/slack.rs:2650-2659 | crates/zeroclaw-channels/src/slack.rs:4755-4759 | crates/zeroclaw-channels/src/slack.rs:4953-4957 | crates/zeroclaw-channels/src/telegram.rs:8393-8399 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/mattermost.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6–10 lines × 5) crates/zeroclaw-channels/src/lark.rs:927— crates/zeroclaw-channels/src/lark.rs:927-932 | crates/zeroclaw-channels/src/lark.rs:960-965 | crates/zeroclaw-channels/src/lark.rs:974-979 | crates/zeroclaw-runtime/src/sop/executor.rs:941-950 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:285-291 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7–10 lines × 4) crates/zeroclaw-channels/src/mattermost.rs:2173— crates/zeroclaw-channels/src/mattermost.rs:2173-2179 | crates/zeroclaw-channels/src/mochat.rs:159-168 | crates/zeroclaw-channels/src/telegram.rs:8410-8417 | crates/zeroclaw-channels/src/twitter.rs:258-267 — before extracting anything, compare `crates/zeroclaw-channels/src/mattermost.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6–10 lines × 4) crates/zeroclaw-runtime/src/plugin_runtime.rs:1146— crates/zeroclaw-runtime/src/plugin_runtime.rs:1146-1151 | crates/zeroclaw-runtime/src/plugin_runtime.rs:1159-1164 | crates/zeroclaw-runtime/src/plugin_runtime.rs:1201-1210 | crates/zeroclaw-runtime/src/tools/mod.rs:3213-3218 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (4–10 lines × 4) crates/zeroclaw-hardware/src/peripherals/rpi.rs:159— crates/zeroclaw-hardware/src/peripherals/rpi.rs:159-168 | crates/zeroclaw-hardware/src/peripherals/serial.rs:317-326 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:164-173 | crates/zeroclaw-hardware/src/rpi.rs:398-401 — before extracting anything, compare `crates/zeroclaw-hardware/src/peripherals/rpi.rs` and `crates/zeroclaw-hardware/src/rpi.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–10 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:238— crates/zeroclaw-providers/src/auth/mod.rs:238-247 | crates/zeroclaw-providers/src/auth/mod.rs:326-335 | crates/zeroclaw-providers/src/auth/mod.rs:421-428 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8–9 lines × 4) crates/zeroclaw-channels/src/slack.rs:671— crates/zeroclaw-channels/src/slack.rs:671-679 | crates/zeroclaw-channels/src/slack.rs:736-744 | crates/zeroclaw-channels/src/slack.rs:1175-1182 | crates/zeroclaw-channels/src/slack.rs:1225-1232 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6–9 lines × 3) crates/zeroclaw-runtime/src/agent/loop_.rs:2150— crates/zeroclaw-runtime/src/agent/loop_.rs:2150-2158 | crates/zeroclaw-runtime/src/agent/loop_.rs:2743-2751 | crates/zeroclaw-runtime/src/agent/loop_.rs:4092-4097 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5–9 lines × 3) crates/zeroclaw-runtime/src/agent/tool_execution.rs:186— crates/zeroclaw-runtime/src/agent/tool_execution.rs:186-194 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3665-3669 | crates/zeroclaw-runtime/src/agent/turn/results_collect.rs:88-93 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6–9 lines × 2) crates/zeroclaw-channels/src/line.rs:409— crates/zeroclaw-channels/src/line.rs:409-414 | crates/zeroclaw-channels/src/line.rs:524-532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 18) crates/zeroclaw-channels/src/orchestrator/mod.rs:14859— crates/zeroclaw-channels/src/orchestrator/mod.rs:14859-14866 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14929-14936 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15278-15285 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15314-15321 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15368-15375 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15393-15400 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15428-15435 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15472-15479 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15537-15544 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15575-15582 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15617-15624 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15667-15674 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15706-15713 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15750-15757 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15785-15792 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15830-15837 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15867-15874 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15964-15971 — all 18 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (1–8 lines × 5) crates/zeroclaw-channels/src/signal.rs:718— crates/zeroclaw-channels/src/signal.rs:718-725 | crates/zeroclaw-channels/src/telegram.rs:3879-3886 | crates/zeroclaw-channels/src/telegram.rs:8724-8731 | crates/zeroclaw-channels/src/twitter.rs:404-404 | crates/zeroclaw-channels/src/twitter.rs:405-405 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6–8 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:1210— crates/zeroclaw-providers/src/auth/mod.rs:1210-1215 | crates/zeroclaw-providers/src/auth/mod.rs:1456-1461 | crates/zeroclaw-providers/src/auth/mod.rs:1719-1726 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–8 lines × 4) apps/zerocode/src/config_manager.rs:1548— apps/zerocode/src/config_manager.rs:1548-1550 | apps/zerocode/src/config_manager.rs:1627-1629 | apps/zerocode/src/config_manager.rs:3155-3162 | apps/zerocode/src/config_manager.rs:5077-5084 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–8 lines × 3) crates/zeroclaw-tools/src/hardware_board_info.rs:159— crates/zeroclaw-tools/src/hardware_board_info.rs:159-166 | crates/zeroclaw-tools/src/hardware_memory_map.rs:144-151 | crates/zeroclaw-tools/src/hardware_memory_read.rs:151-154 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (7 lines × 8) crates/zeroclaw-channels/src/lark.rs:2316— crates/zeroclaw-channels/src/lark.rs:2316-2323 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17036-17042 | crates/zeroclaw-channels/src/telegram.rs:4239-4245 | crates/zeroclaw-channels/src/whatsapp_web.rs:1513-1519 | crates/zeroclaw-config/src/cost/tracker.rs:971-977 | crates/zeroclaw-gateway/src/lib.rs:2000-2006 | crates/zeroclaw-memory/src/lib.rs:1176-1182 | crates/zeroclaw-runtime/src/restart.rs:213-219 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.rs` and `crates/zeroclaw-channels/src/telegram.rs` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6–7 lines × 8) crates/zeroclaw-channels/src/lark.rs:3286— crates/zeroclaw-channels/src/lark.rs:3286-3291 | crates/zeroclaw-channels/src/lark.rs:3431-3437 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15501-15507 | crates/zeroclaw-gateway/src/lib.rs:1720-1726 | crates/zeroclaw-gateway/src/ws.rs:503-509 | crates/zeroclaw-memory/src/lib.rs:828-833 | crates/zeroclaw-runtime/src/rpc/auth.rs:336-341 | crates/zeroclaw-runtime/src/security/principal_resolver.rs:237-242 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-gateway/src/lib.rs` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–7 lines × 6) crates/zeroclaw-config/src/migration.rs:271— crates/zeroclaw-config/src/migration.rs:271-276 | crates/zeroclaw-gateway/src/api_pairing.rs:506-511 | crates/zeroclaw-gateway/src/api_plugins.rs:249-255 | crates/zeroclaw-gateway/src/ws.rs:713-718 | crates/zeroclaw-providers/src/grok_cli.rs:883-889 | crates/zeroclaw-runtime/src/tools/skill_http.rs:193-198 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times.
Duplicated block (4–7 lines × 6) crates/zeroclaw-tools/src/proxy_config.rs:41— crates/zeroclaw-tools/src/proxy_config.rs:41-44 | crates/zeroclaw-tools/src/web_search_tool.rs:404-410 | crates/zeroclaw-tools/src/web_search_tool.rs:626-632 | crates/zeroclaw-tools/src/web_search_tool.rs:802-808 | crates/zeroclaw-tools/src/web_search_tool.rs:941-947 | crates/zeroclaw-tools/src/web_search_tool.rs:1781-1787 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6–7 lines × 4) crates/zeroclaw-tools/src/linkedin.rs:333— crates/zeroclaw-tools/src/linkedin.rs:333-338 | crates/zeroclaw-tools/src/linkedin.rs:365-370 | crates/zeroclaw-tools/src/linkedin.rs:399-405 | crates/zeroclaw-tools/src/linkedin.rs:422-428 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (4–7 lines × 9) crates/zeroclaw-hardware/src/peripherals/rpi.rs:94— crates/zeroclaw-hardware/src/peripherals/rpi.rs:94-97 | crates/zeroclaw-hardware/src/peripherals/rpi.rs:155-158 | crates/zeroclaw-hardware/src/peripherals/serial.rs:264-267 | crates/zeroclaw-hardware/src/peripherals/serial.rs:313-316 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:94-97 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:160-163 | crates/zeroclaw-hardware/src/rpi.rs:391-397 | crates/zeroclaw-hardware/src/rpi.rs:487-493 | crates/zeroclaw-hardware/src/rpi.rs:582-588 — before extracting anything, compare `crates/zeroclaw-hardware/src/peripherals/rpi.rs` and `crates/zeroclaw-hardware/src/rpi.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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–7 lines × 2) crates/zeroclaw-channels/src/mattermost.rs:1919— crates/zeroclaw-channels/src/mattermost.rs:1919-1925 | crates/zeroclaw-channels/src/mattermost.rs:2103-2107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 7) crates/zeroclaw-gateway/src/api_skills.rs:81— crates/zeroclaw-gateway/src/api_skills.rs:81-86 | crates/zeroclaw-gateway/src/api_skills.rs:111-116 | crates/zeroclaw-gateway/src/api_skills.rs:140-145 | crates/zeroclaw-gateway/src/api_skills.rs:216-221 | crates/zeroclaw-gateway/src/api_skills.rs:254-259 | crates/zeroclaw-gateway/src/api_skills.rs:284-289 | crates/zeroclaw-gateway/src/api_skills.rs:312-317 — 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.
Duplicated block (5–6 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:632— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:632-636 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2799-2804 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2858-2863 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (3–6 lines × 3) apps/zerocode/src/app.rs:3525— apps/zerocode/src/app.rs:3525-3531 | apps/zerocode/src/app.rs:3661-3666 | apps/zerocode/src/app.rs:3721-3723 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (2–6 lines × 3) crates/zeroclaw-channels/src/lark.rs:3101— crates/zeroclaw-channels/src/lark.rs:3101-3106 | crates/zeroclaw-channels/src/mochat.rs:266-267 | crates/zeroclaw-channels/src/nextcloud_talk.rs:560-565 — before extracting anything, compare `crates/zeroclaw-channels/src/mochat.rs` and `crates/zeroclaw-channels/src/nextcloud_talk.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–6 lines × 3) crates/zeroclaw-providers/src/gemini.rs:357— crates/zeroclaw-providers/src/gemini.rs:357-360 | crates/zeroclaw-providers/src/lib.rs:403-408 | crates/zeroclaw-providers/src/lib.rs:548-553 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 15) crates/zeroclaw-channels/src/matrix.rs:2529— crates/zeroclaw-channels/src/matrix.rs:2529-2533 | crates/zeroclaw-channels/src/notion.rs:391-395 | crates/zeroclaw-channels/src/notion.rs:448-455 | crates/zeroclaw-channels/src/notion.rs:499-503 | crates/zeroclaw-channels/src/orchestrator/mod.rs:7862-7866 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11211-11218 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15034-15038 | crates/zeroclaw-channels/src/wechat.rs:2837-2844 | crates/zeroclaw-channels/src/wechat.rs:2946-2953 | crates/zeroclaw-channels/src/whatsapp_web.rs:1864-1868 | crates/zeroclaw-gateway/src/lib.rs:3222-3226 | crates/zeroclaw-gateway/src/ws.rs:715-719 | crates/zeroclaw-providers/src/openai_codex.rs:1179-1183 | crates/zeroclaw-runtime/src/observability/mod.rs:399-406 | crates/zeroclaw-runtime/src/tools/mod.rs:2937-2941 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/orchestrator/mod.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 11) crates/zeroclaw-channels/src/clawdtalk.rs:339— crates/zeroclaw-channels/src/clawdtalk.rs:339-343 | crates/zeroclaw-channels/src/mattermost.rs:847-851 | crates/zeroclaw-channels/src/mattermost.rs:922-927 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15935-15939 | crates/zeroclaw-channels/src/qq.rs:1126-1134 | crates/zeroclaw-channels/src/slack.rs:3721-3725 | crates/zeroclaw-channels/src/wechat.rs:2186-2190 | crates/zeroclaw-channels/src/wechat.rs:2611-2615 | crates/zeroclaw-runtime/src/security/playbook.rs:94-101 | crates/zeroclaw-runtime/src/sop/mod.rs:998-1002 | crates/zeroclaw-runtime/src/tools/mod.rs:2625-2629 — before extracting anything, compare `crates/zeroclaw-channels/src/mattermost.rs` and `crates/zeroclaw-channels/src/slack.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 9) crates/zeroclaw-channels/src/imessage.rs:322— crates/zeroclaw-channels/src/imessage.rs:322-326 | crates/zeroclaw-channels/src/mattermost.rs:1000-1004 | crates/zeroclaw-channels/src/qq.rs:1285-1289 | crates/zeroclaw-channels/src/slack.rs:3770-3774 | crates/zeroclaw-channels/src/voice_wake.rs:405-412 | crates/zeroclaw-channels/src/voice_wake.rs:490-497 | crates/zeroclaw-memory/src/lib.rs:627-631 | crates/zeroclaw-providers/src/pricing.rs:534-538 | crates/zeroclaw-runtime/src/skills/review.rs:224-228 — before extracting anything, compare `crates/zeroclaw-channels/src/imessage.rs` and `crates/zeroclaw-channels/src/qq.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–5 lines × 6) crates/zeroclaw-runtime/src/agent/tool_execution.rs:98— crates/zeroclaw-runtime/src/agent/tool_execution.rs:98-101 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:162-165 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:221-224 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:362-366 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:413-417 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:459-463 — 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.
Duplicated block (1–5 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:2298— crates/zeroclaw-channels/src/discord/mod.rs:2298-2302 | crates/zeroclaw-channels/src/discord/mod.rs:2371-2371 | crates/zeroclaw-channels/src/discord/mod.rs:2569-2573 | crates/zeroclaw-channels/src/discord/mod.rs:3101-3102 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (2–5 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:2181— crates/zeroclaw-channels/src/discord/mod.rs:2181-2182 | crates/zeroclaw-channels/src/discord/mod.rs:2399-2403 | crates/zeroclaw-channels/src/qq.rs:1588-1593 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/qq.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 21) crates/zeroclaw-channels/src/bluesky.rs:628— crates/zeroclaw-channels/src/bluesky.rs:628-636 | crates/zeroclaw-channels/src/imessage.rs:324-332 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11244-11252 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14829-14837 | crates/zeroclaw-channels/src/orchestrator/mqtt.rs:92-101 | crates/zeroclaw-channels/src/reddit.rs:428-436 | crates/zeroclaw-channels/src/transcription.rs:1085-1093 | crates/zeroclaw-channels/src/voice_wake.rs:476-489 | crates/zeroclaw-memory/src/lib.rs:629-637 | crates/zeroclaw-providers/src/lib.rs:656-664 | crates/zeroclaw-runtime/src/daemon/mod.rs:2841-2849 | crates/zeroclaw-runtime/src/tools/mod.rs:1841-1849 | crates/zeroclaw-runtime/src/tools/mod.rs:1947-1955 | crates/zeroclaw-runtime/src/tools/mod.rs:1987-1995 | crates/zeroclaw-runtime/src/tools/mod.rs:2035-2043 | crates/zeroclaw-runtime/src/tools/mod.rs:2114-2122 | crates/zeroclaw-runtime/src/tools/mod.rs:2140-2148 | crates/zeroclaw-runtime/src/tools/mod.rs:2627-2635 | crates/zeroclaw-runtime/src/tools/mod.rs:3109-3117 | crates/zeroclaw-tools/src/linkedin.rs:287-298 | crates/zeroclaw-tools/src/web_fetch.rs:578-586 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/imessage.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 32) crates/zeroclaw-channels/src/bluesky.rs:628— crates/zeroclaw-channels/src/bluesky.rs:628-635 | crates/zeroclaw-channels/src/imessage.rs:324-331 | crates/zeroclaw-channels/src/matrix.rs:1571-1578 | crates/zeroclaw-channels/src/matrix.rs:4571-4578 | crates/zeroclaw-channels/src/mochat.rs:272-279 | crates/zeroclaw-channels/src/nextcloud_talk.rs:720-727 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4476-4485 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11244-11251 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14829-14836 | crates/zeroclaw-channels/src/orchestrator/mqtt.rs:92-100 | crates/zeroclaw-channels/src/reddit.rs:428-435 | crates/zeroclaw-channels/src/slack.rs:5890-5900 | crates/zeroclaw-channels/src/transcription.rs:1085-1092 | crates/zeroclaw-channels/src/twitter.rs:409-416 | crates/zeroclaw-channels/src/voice_wake.rs:476-488 | crates/zeroclaw-channels/src/voice_wake.rs:492-502 | crates/zeroclaw-memory/src/consolidation.rs:256-263 | crates/zeroclaw-memory/src/consolidation.rs:389-396 | crates/zeroclaw-memory/src/lib.rs:629-636 | crates/zeroclaw-providers/src/lib.rs:656-663 | crates/zeroclaw-runtime/src/daemon/mod.rs:2841-2848 | crates/zeroclaw-runtime/src/tools/mod.rs:1841-1848 | crates/zeroclaw-runtime/src/tools/mod.rs:1947-1954 | crates/zeroclaw-runtime/src/tools/mod.rs:1987-1994 | crates/zeroclaw-runtime/src/tools/mod.rs:2035-2042 | crates/zeroclaw-runtime/src/tools/mod.rs:2114-2121 | crates/zeroclaw-runtime/src/tools/mod.rs:2140-2147 | crates/zeroclaw-runtime/src/tools/mod.rs:2627-2634 | crates/zeroclaw-runtime/src/tools/mod.rs:3109-3116 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:196-203 | crates/zeroclaw-tools/src/linkedin.rs:287-297 | crates/zeroclaw-tools/src/web_fetch.rs:578-585 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/imessage.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (4–6 lines × 50) crates/zeroclaw-channels/src/bluesky.rs:628— crates/zeroclaw-channels/src/bluesky.rs:628-634 | crates/zeroclaw-channels/src/imessage.rs:324-330 | crates/zeroclaw-channels/src/matrix.rs:1571-1577 | crates/zeroclaw-channels/src/matrix.rs:4571-4577 | crates/zeroclaw-channels/src/mochat.rs:272-278 | crates/zeroclaw-channels/src/nextcloud_talk.rs:720-726 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4111-4117 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4442-4445 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4476-4484 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4675-4681 | crates/zeroclaw-channels/src/orchestrator/mod.rs:5569-5573 | crates/zeroclaw-channels/src/orchestrator/mod.rs:9481-9487 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11244-11250 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14829-14835 | crates/zeroclaw-channels/src/orchestrator/mqtt.rs:92-99 | crates/zeroclaw-channels/src/reddit.rs:428-434 | crates/zeroclaw-channels/src/slack.rs:5890-5899 | crates/zeroclaw-channels/src/transcription.rs:1085-1091 | crates/zeroclaw-channels/src/twitter.rs:409-415 | crates/zeroclaw-channels/src/voice_wake.rs:476-487 | crates/zeroclaw-channels/src/voice_wake.rs:492-501 | crates/zeroclaw-gateway/src/acp.rs:157-163 | crates/zeroclaw-gateway/src/acp.rs:173-179 | crates/zeroclaw-hardware/src/rpi.rs:290-295 | crates/zeroclaw-memory/src/consolidation.rs:256-262 | crates/zeroclaw-memory/src/consolidation.rs:389-395 | crates/zeroclaw-memory/src/lib.rs:576-582 | crates/zeroclaw-memory/src/lib.rs:594-600 | crates/zeroclaw-memory/src/lib.rs:629-635 | crates/zeroclaw-providers/src/lib.rs:656-662 | crates/zeroclaw-runtime/src/daemon/mod.rs:2450-2459 | crates/zeroclaw-runtime/src/daemon/mod.rs:2794-2803 | crates/zeroclaw-runtime/src/daemon/mod.rs:2841-2847 | crates/zeroclaw-runtime/src/observability/otel.rs:900-906 | crates/zeroclaw-runtime/src/observability/otel.rs:909-915 | crates/zeroclaw-runtime/src/sop/dispatch.rs:699-705 | crates/zeroclaw-runtime/src/sop/dispatch.rs:714-720 | crates/zeroclaw-runtime/src/tools/mod.rs:1841-1847 | crates/zeroclaw-runtime/src/tools/mod.rs:1947-1953 | crates/zeroclaw-runtime/src/tools/mod.rs:1987-1993 | crates/zeroclaw-runtime/src/tools/mod.rs:2035-2041 | crates/zeroclaw-runtime/src/tools/mod.rs:2114-2120 | crates/zeroclaw-runtime/src/tools/mod.rs:2140-2146 | crates/zeroclaw-runtime/src/tools/mod.rs:2627-2633 | crates/zeroclaw-runtime/src/tools/mod.rs:3109-3115 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:185-191 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:196-202 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:125-131 | crates/zeroclaw-tools/src/linkedin.rs:287-296 | crates/zeroclaw-tools/src/web_fetch.rs:578-584 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/imessage.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 7) crates/zeroclaw-channels/src/telegram.rs:6423— crates/zeroclaw-channels/src/telegram.rs:6423-6433 | crates/zeroclaw-channels/src/telegram.rs:6467-6477 | crates/zeroclaw-channels/src/telegram.rs:6516-6526 | crates/zeroclaw-channels/src/telegram.rs:6560-6570 | crates/zeroclaw-channels/src/telegram.rs:6609-6619 | crates/zeroclaw-channels/src/telegram.rs:6658-6668 | crates/zeroclaw-channels/src/telegram.rs:6707-6717 — 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.
Duplicated block (10 lines × 9) crates/zeroclaw-tools/src/jira_tool.rs:122— crates/zeroclaw-tools/src/jira_tool.rs:122-131 | crates/zeroclaw-tools/src/jira_tool.rs:219-228 | crates/zeroclaw-tools/src/jira_tool.rs:291-300 | crates/zeroclaw-tools/src/jira_tool.rs:370-379 | crates/zeroclaw-tools/src/jira_tool.rs:419-428 | crates/zeroclaw-tools/src/jira_tool.rs:617-626 | crates/zeroclaw-tools/src/jira_tool.rs:708-717 | crates/zeroclaw-tools/src/jira_tool.rs:809-818 | crates/zeroclaw-tools/src/jira_tool.rs:907-916 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10 lines × 5) crates/zeroclaw-runtime/src/daemon/mod.rs:1147— crates/zeroclaw-runtime/src/daemon/mod.rs:1147-1156 | crates/zeroclaw-runtime/src/daemon/mod.rs:1181-1190 | crates/zeroclaw-runtime/src/daemon/mod.rs:1206-1215 | crates/zeroclaw-runtime/src/daemon/mod.rs:1231-1240 | crates/zeroclaw-runtime/src/daemon/mod.rs:1304-1313 — 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.
Duplicated block (5 lines × 26) crates/zeroclaw-channels/src/lark.rs:3770— crates/zeroclaw-channels/src/lark.rs:3770-3779 | crates/zeroclaw-channels/src/lark.rs:3784-3792 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:80-85 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:92-97 | crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:136-143 | crates/zeroclaw-tools/src/browser.rs:2425-2429 | crates/zeroclaw-tools/src/browser.rs:2452-2456 | crates/zeroclaw-tools/src/browser.rs:2609-2613 | crates/zeroclaw-tools/src/browser.rs:2618-2625 | crates/zeroclaw-tools/src/file_edit.rs:78-83 | crates/zeroclaw-tools/src/file_edit.rs:87-95 | crates/zeroclaw-tools/src/file_edit.rs:101-109 | crates/zeroclaw-tools/src/file_write.rs:83-91 | crates/zeroclaw-tools/src/google_workspace.rs:189-196 | crates/zeroclaw-tools/src/google_workspace.rs:200-207 | crates/zeroclaw-tools/src/google_workspace.rs:213-217 | crates/zeroclaw-tools/src/knowledge_tool.rs:161-170 | crates/zeroclaw-tools/src/knowledge_tool.rs:175-179 | crates/zeroclaw-tools/src/knowledge_tool.rs:188-195 | crates/zeroclaw-tools/src/knowledge_tool.rs:332-341 | crates/zeroclaw-tools/src/knowledge_tool.rs:346-350 | crates/zeroclaw-tools/src/knowledge_tool.rs:359-366 | crates/zeroclaw-tools/src/memory_store.rs:62-70 | crates/zeroclaw-tools/src/reaction.rs:96-104 | crates/zeroclaw-tools/src/reaction.rs:110-118 | crates/zeroclaw-tools/src/reaction.rs:124-129 — there are 26 copies across 10 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 26 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 10) crates/zeroclaw-channels/src/orchestrator/mod.rs:4043— crates/zeroclaw-channels/src/orchestrator/mod.rs:4043-4052 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16745-16751 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16771-16777 | crates/zeroclaw-channels/src/whatsapp_web.rs:1613-1619 | crates/zeroclaw-gateway/src/ws.rs:530-536 | crates/zeroclaw-gateway/src/ws.rs:1199-1205 | crates/zeroclaw-gateway/src/ws.rs:1290-1296 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5159-5168 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5223-5232 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:13856-13862 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 14) crates/zeroclaw-channels/src/discord/mod.rs:1246— crates/zeroclaw-channels/src/discord/mod.rs:1246-1251 | crates/zeroclaw-channels/src/discord/mod.rs:1292-1297 | crates/zeroclaw-channels/src/discord/mod.rs:1369-1373 | crates/zeroclaw-channels/src/discord/mod.rs:1392-1396 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4041-4050 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16743-16749 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16769-16775 | crates/zeroclaw-channels/src/whatsapp_web.rs:1611-1617 | crates/zeroclaw-gateway/src/lib.rs:1682-1687 | crates/zeroclaw-gateway/src/ws.rs:528-534 | crates/zeroclaw-gateway/src/ws.rs:1197-1203 | crates/zeroclaw-memory/src/sqlite.rs:398-404 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:13854-13860 | crates/zeroclaw-runtime/src/skills/creator.rs:111-117 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-channels/src/whatsapp_web.rs` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 11) crates/zeroclaw-config/src/schema/v2.rs:3961— crates/zeroclaw-config/src/schema/v2.rs:3961-3967 | crates/zeroclaw-config/src/schema/v2.rs:4004-4010 | crates/zeroclaw-memory/src/qdrant.rs:416-424 | crates/zeroclaw-memory/src/qdrant.rs:458-466 | crates/zeroclaw-memory/src/qdrant.rs:508-515 | crates/zeroclaw-memory/src/qdrant.rs:579-587 | crates/zeroclaw-memory/src/qdrant.rs:635-642 | crates/zeroclaw-memory/src/qdrant.rs:784-792 | crates/zeroclaw-memory/src/qdrant.rs:994-1000 | crates/zeroclaw-memory/src/qdrant.rs:1103-1110 | crates/zeroclaw-memory/src/qdrant.rs:1176-1184 — there are 11 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 11 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 7) crates/zeroclaw-runtime/src/tools/read_skill.rs:47— crates/zeroclaw-runtime/src/tools/read_skill.rs:47-54 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:129-136 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:146-153 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:163-170 | crates/zeroclaw-tools/src/file_download.rs:482-489 | crates/zeroclaw-tools/src/file_download.rs:500-507 | crates/zeroclaw-tools/src/pushover.rs:158-165 — there are 7 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (4–6 lines × 20) crates/zeroclaw-channels/src/orchestrator/mod.rs:13161— crates/zeroclaw-channels/src/orchestrator/mod.rs:13161-13164 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13205-13210 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13249-13254 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13297-13302 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13333-13338 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13470-13475 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13495-13500 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13526-13531 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13553-13558 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13623-13628 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13653-13658 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13697-13702 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13741-13746 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13764-13769 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13787-13792 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13819-13824 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13845-13850 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13868-13873 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13887-13892 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13930-13935 — all 20 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (1–5 lines × 5) crates/zeroclaw-channels/src/telegram.rs:4909— crates/zeroclaw-channels/src/telegram.rs:4909-4913 | crates/zeroclaw-gateway/src/api_upload.rs:146-150 | crates/zeroclaw-runtime/src/agent/agent.rs:2852-2852 | crates/zeroclaw-runtime/src/agent/agent.rs:2853-2853 | crates/zeroclaw-runtime/src/agent_lifecycle.rs:126-130 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Weak hash algorithm crates/zeroclaw-channels/src/wechat.rs:1709— MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`sha2::Sha256::digest(…)`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
Third-party script without Subresource Integrity crates/zeroclaw-gateway/src/openapi_docs.html:53— `https://cdn.jsdelivr.net/npm/@scalar/api-reference` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 2 such include(s) across the repository's markup.
Silent fallback default on Err REDACTED:2200— `bound_trigger_detail` turns every `Err` into `String::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-channels/src/discord_slash_state.rs:42— `load` turns every `Err` into `Self::default()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-channels/src/matrix.rs:4933— `multi_message_confirmed_offset` turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-channels/src/slack.rs:2786— `redact_raw_slack_url` turns every `Err` into `"<invalid-url>".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-config/src/schema.rs:22743— `unknown_keys` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-config/src/schema.rs:22783— `retired_wati_config_sections` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-config/src/schema.rs:22815— `unknown_provider_families` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-config/src/schema.rs:22856— `extra_nested_model_provider_tables` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-config/src/helpers.rs:193— `enum_variants` turns every `Err` into `"(unknown variants)".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-config/src/helpers.rs:360— `object_array_json_display_value` turns every `Err` into `"[]".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-eval/src/report.rs:115— `to_json` turns every `Err` into `"{}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-gateway/src/a2a.rs:263— `exposed_skills` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-hardware/src/datasheet.rs:403— `list_datasheets` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-hardware/src/rpi.rs:188— `get_ip_address` turns every `Err` into `"unknown".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_sqlite.rs:892— `load` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_sqlite.rs:918— `load_with_timestamps` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_sqlite.rs:1086— `list_sessions` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_sqlite.rs:1104— `list_sessions_with_metadata` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_sqlite.rs:1425— `list_running_sessions` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_sqlite.rs:1477— `list_stuck_sessions` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_sqlite.rs:1535— `search` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-infra/src/session_store.rs:367— `list_sessions` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-memory/src/rerank.rs:192— `recency_factor` turns every `Err` into `1.0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-plugins/src/host.rs:3199— `migrate_plugins_dir` turns every `Err` into `Ok(0)` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Silent fallback default on Err crates/zeroclaw-providers/src/openai.rs:1259— `http_client` turns every `Err` into `Client::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Duplicated predicate web/src/components/SettingsModal.tsx:192— `el.offsetParent !== null || el === document.activeElement` appears character-identically in 4 files — web/src/components/SettingsModal.tsx, web/src/components/ui/ConfirmDialog.tsx, web/src/hooks/useFocusTrap.ts, web/src/pages/AgentWorkspaceExplorer.tsx. 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 web/src/hooks/useDevices.ts:17— `localStorage.getItem('zeroclaw_token') || ''` appears character-identically in 2 files — web/src/hooks/useDevices.ts, web/src/pages/Pairing.tsx. 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 web/src/components/ui/ComboBox.tsx:71— `rootRef.current && !rootRef.current.contains(e.target as Node)` appears character-identically in 2 files — web/src/components/ui/ComboBox.tsx, web/src/components/ui/Select.tsx. 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 web/src/components/sections/SectionNavigator.tsx:72— `s.shape === "one_tier_alias_map" || s.shape === "typed_family_map"` appears character-identically in 2 files — web/src/components/sections/SectionNavigator.tsx, web/src/lib/configSearch.ts. 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 web/src/lib/sse.ts:172— `this.intentionallyClosed || !this.autoReconnect` appears character-identically in 2 files — web/src/lib/sse.ts, web/src/lib/ws.ts. 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 scripts/ci/check_internal_docs_links.py:37— `target.startswith("<") and target.endswith(">")` appears character-identically in 2 files — scripts/ci/check_internal_docs_links.py, scripts/ci/collect_changed_links.py. 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 crates/zeroclaw-log/src/layer.rs:656— `!found && std::time::Instant::now() < deadline` appears character-identically in 3 files — crates/zeroclaw-log/src/layer.rs, crates/zeroclaw-providers/src/dispatch.rs, crates/zeroclaw-runtime/src/tools/model_switch.rs. 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 crates/zeroclaw-api/src/channel.rs:1112— `!handle_norm.is_empty() && handle_norm == sender_norm` appears character-identically in 3 files — crates/zeroclaw-api/src/channel.rs, crates/zeroclaw-plugins/src/wasm_channel.rs, crates/zeroclaw-runtime/src/peers.rs. 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 crates/zeroclaw-infra/src/net_guard.rs:72— `!parsed.username().is_empty() || parsed.password().is_some()` appears character-identically in 7 files — crates/zeroclaw-infra/src/net_guard.rs, crates/zeroclaw-tools/src/a2a_client.rs, crates/zeroclaw-tools/src/browser.rs, crates/zeroclaw-tools/src/file_download.rs. 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 crates/zeroclaw-plugins/src/component.rs:525— `!self.charge_host_call() || !self.instance_services_enabled()` appears character-identically in 2 files — crates/zeroclaw-plugins/src/component.rs, crates/zeroclaw-plugins/src/component_websocket.rs. 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 crates/zeroclaw-providers/src/gemini_cli.rs:78— `!trimmed.is_empty() && trimmed != DEFAULT_MODEL_MARKER` appears character-identically in 3 files — crates/zeroclaw-providers/src/gemini_cli.rs, crates/zeroclaw-providers/src/grok_cli.rs, crates/zeroclaw-providers/src/kilocli.rs. 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 crates/zeroclaw-tools/src/http_request.rs:130— `!url.starts_with("http://") && !url.starts_with("https://")` appears character-identically in 3 files — crates/zeroclaw-tools/src/http_request.rs, crates/zeroclaw-tools/src/text_browser.rs, crates/zeroclaw-tools/src/web_fetch.rs. 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 apps/zerocode/src/oidc_enroll.rs:127— `!url.username().is_empty() || url.password().is_some()` appears character-identically in 8 files — apps/zerocode/src/oidc_enroll.rs, crates/zeroclaw-hardware/src/datasheet.rs, crates/zeroclaw-providers/src/hailo_ollama.rs, crates/zeroclaw-runtime/src/security/auth_provider/oidc.rs. 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 crates/zeroclaw-tools/src/discord_search.rs:96— `( chrono::DateTime::parse_from_rfc3339(s), chrono::DateTime::parse_from_rfc3339(u), ) && s_dt >= u_dt` appears character-identically in 2 files — crates/zeroclaw-tools/src/discord_search.rs, crates/zeroclaw-tools/src/memory_recall.rs. 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 crates/zeroclaw-runtime/src/rpc/auth.rs:627— `auth.principal.expires_at && expires_at <= now` appears character-identically in 2 files — crates/zeroclaw-runtime/src/rpc/auth.rs, crates/zeroclaw-runtime/src/rpc/dispatch.rs. 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 crates/zeroclaw-runtime/src/rpc/auth.rs:634— `auth.principal.revalidate_by && revalidate_by <= now` appears character-identically in 2 files — crates/zeroclaw-runtime/src/rpc/auth.rs, crates/zeroclaw-runtime/src/rpc/dispatch.rs. 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 crates/zeroclaw-tools/src/hardware_board_info.rs:111— `board == "nucleo-f401re" || board == "nucleo-f411re"` appears character-identically in 2 files — crates/zeroclaw-tools/src/hardware_board_info.rs, crates/zeroclaw-tools/src/hardware_memory_map.rs. 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 crates/zeroclaw-providers/src/azure_openai.rs:885— `body.get("tools").is_some() && body .get("reasoning_effort") .and_then(serde_json::Value::as_str) != Some("none")` appears character-identically in 2 files — crates/zeroclaw-providers/src/azure_openai.rs, crates/zeroclaw-providers/src/compatible.rs. 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 crates/zeroclaw-channels/src/lark.rs:3987— `bytes.len() >= 2 && bytes.starts_with(b"BM")` appears character-identically in 2 files — crates/zeroclaw-channels/src/lark.rs, crates/zeroclaw-channels/src/slack.rs. 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 crates/zeroclaw-config/src/policy.rs:960— `bytes.len() >= 2 && bytes[1] == b':' && bytes[0].is_ascii_alphabetic()` appears character-identically in 2 files — crates/zeroclaw-config/src/policy.rs, src/plugin_registry.rs. 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 crates/zeroclaw-channels/src/lark.rs:3981— `bytes.len() >= 6 && (bytes.starts_with(b"GIF87a") || bytes.starts_with(b"GIF89a"))` appears character-identically in 2 files — crates/zeroclaw-channels/src/lark.rs, crates/zeroclaw-channels/src/slack.rs. 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 crates/zeroclaw-api/src/media.rs:343— `bytes.starts_with(b"GIF87a") || bytes.starts_with(b"GIF89a")` appears character-identically in 4 files — crates/zeroclaw-api/src/media.rs, crates/zeroclaw-channels/src/wecom_ws.rs, crates/zeroclaw-runtime/src/tools/file_read.rs, crates/zeroclaw-tools/src/embedded_resource.rs. 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 crates/zeroclaw-channels/src/wecom_ws.rs:2125— `ch.is_ascii_alphanumeric() || ch == '-' || ch == '_'` appears character-identically in 2 files — crates/zeroclaw-channels/src/wecom_ws.rs, crates/zeroclaw-runtime/src/sop/procedural_memory.rs. 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 crates/zeroclaw-channels/src/orchestrator/acp_server.rs:7897— `chat.content == "old request" || chat.content == "old answer"` appears character-identically in 2 files — crates/zeroclaw-channels/src/orchestrator/acp_server.rs, crates/zeroclaw-runtime/src/agent/agent.rs. 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 REDACTED:4101— `chat.role == "assistant" && chat.content == "checking"` appears character-identically in 2 files — REDACTED, crates/zeroclaw-runtime/src/rpc/dispatch.rs. 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.
Classify ADR enforcement: Rust is the implementation language for ZeroClaw docs/book/src/architecture/decisions/ADR-001-rust-first.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: First-party extension surfaces use trait contracts docs/book/src/architecture/decisions/ADR-002-trait-driven-extensibility.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: WASM plugins use Extism as the initial execution bridge docs/book/src/architecture/decisions/ADR-003-wasm-plugin-model.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Tool-held shared state follows daemon-owned identity and handle ownership docs/book/src/architecture/decisions/ADR-004-tool-shared-state-ownership.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Memory storage is backend-neutral with SQLite as the default docs/book/src/architecture/decisions/ADR-005-pluggable-memory-backends.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Make runtime plugins the target for optional channels docs/book/src/architecture/decisions/ADR-006-runtime-channel-plugins.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Extract the gateway into a separate optional process docs/book/src/architecture/decisions/ADR-007-gateway-extraction.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Anchor goal mode in the durable task control plane docs/book/src/architecture/decisions/ADR-008-goal-mode-control-plane-and-usage-accounting.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: WIT components and direct wasmtime replace the Extism plugin bridge docs/book/src/architecture/decisions/ADR-009-wit-wasmtime-plugin-execution.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Separate conversation history, curated memory, and enrichment authority docs/book/src/architecture/decisions/ADR-010-memory-authority-boundaries.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Configured agents have explicit runtime boundaries under one daemon docs/book/src/architecture/decisions/ADR-011-multi-agent-runtime-boundaries.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Live config application uses generation-scoped publication and results docs/book/src/architecture/decisions/ADR-012-generation-scoped-live-config-apply.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Master key acquisition uses one configured key-source authority docs/book/src/architecture/decisions/ADR-013-key-source-authority.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Plugin instances reach the network only through one host-owned egress authority docs/book/src/architecture/decisions/ADR-014-plugin-egress-authority.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Unified capability catalog is a read-only projection over canonical owners docs/book/src/architecture/decisions/ADR-015-unified-capability-catalog.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Holding-crate exceptions are bounded, recorded, and granted by the Core Team docs/book/src/architecture/decisions/ADR-016-holding-crate-exceptions.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Inbound authentication resolves canonical principals before authorization docs/book/src/architecture/decisions/ADR-017-inbound-authentication-and-principals.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Classify ADR enforcement: Runtime security and provenance use runtime-owned decision boundaries docs/book/src/architecture/decisions/ADR-018-runtime-security-and-provenance.md— This record carries no `enforcement:` field, so nothing says whether the decision is checked by anything or is upheld by convention alone — and an unclassified record is counted as UNENFORCED in this dimension's score, which is the same bucket as a rule known to have no check behind it. If this is a mechanizable rule, add an analyzer/test (or `enforcement: analyzer|test`); if it's a design decision, mark `enforcement: not-applicable` so it isn't counted as unenforced.
Subsumed condition operand xtask/src/cmd/mdbook/protected.rs:681— `text.contains(".jsonl")` can never decide this `||` — every value satisfying `text.contains(".jsonl")` also satisfies `text.contains(".json")`, 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 xtask/src/cmd/fluent/scan.rs:94— `key.ends_with("-long-about")` can never decide this `||` — every value satisfying `key.ends_with("-long-about")` also satisfies `key.ends_with("-about")`, 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 crates/zeroclaw-tools/src/ask_user.rs:712— `err.contains("cancelled")` can never decide this `||` — every value satisfying `err.contains("cancelled")` also satisfies `err.contains("cancel")`, 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 crates/zeroclaw-tool-call-parser/src/lib.rs:584— `lower.contains("tool_call_id")` can never decide this `||` — every value satisfying `lower.contains("tool_call_id")` also satisfies `lower.contains("call_id")`, 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 crates/zeroclaw-tool-call-parser/src/lib.rs:2644— `trimmed.contains("[TOOL_CALL]")` can never decide this `||` — every value satisfying `trimmed.contains("[TOOL_CALL]")` also satisfies `trimmed.contains("TOOL_CALL")`, 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 crates/zeroclaw-runtime/src/tools/delegate.rs:12391— `prompt.contains("Shell: powershell")` can never decide this `||` — every value satisfying `prompt.contains("Shell: powershell")` also satisfies `prompt.contains("powershell")`, 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 crates/zeroclaw-runtime/src/agent/system_prompt.rs:1226— `auth.contains("authorized to call (to attempt)")` can never decide this `||` — every value satisfying `auth.contains("authorized to call (to attempt)")` also satisfies `auth.contains("authorized to call")`, 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 crates/zeroclaw-channels/src/lark.rs:588— `lower.starts_with("https://")` can never decide this `||` — every value satisfying `lower.starts_with("https://")` also satisfies `lower.contains("://")`, 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 crates/zeroclaw-channels/src/whatsapp_web.rs:3558— `message.content.contains("<tool_calls")` can never decide this `||` — every value satisfying `message.content.contains("<tool_calls")` also satisfies `message.content.contains("<tool_call")`, 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 crates/zeroclaw-channels/src/whatsapp_web.rs:3559— `message.content.contains("</tool_calls")` can never decide this `||` — every value satisfying `message.content.contains("</tool_calls")` also satisfies `message.content.contains("</tool_call")`, 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.
Orphaned file crates/zeroclaw-runtime/src/security/playbook.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/zeroclaw-runtime/src/security/estop.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/zeroclaw-runtime/src/security/vulnerability.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/zeroclaw-channels/src/login_events.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/zeroclaw-runtime/src/security/prompt_guard.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/zeroclaw-runtime/src/security/otp.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file crates/zeroclaw-gateway/src/voice_duplex.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file firmware/pico/src/main.rs:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Silent fallback default in catch web/src/pages/AgentChat.tsx:179— `AgentChatInner` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch web/src/pages/Cron.tsx:54— `browserProvidedTimezone` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch web/src/components/sections/FieldForm.tsx:405— `parseInput` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch web/src/pages/SopCanvas.tsx:194— `argsEntries` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch web/src/lib/agentChannels.ts:91— `agentBoundChannels` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch web/src/lib/chatHistoryStorage.ts:31— `loadChatHistory` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch web/src/lib/configSearch.ts:66— `loadEntities` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 28 significant file(s) lose their only recent owner: apps/zerorelay/src/lib.rs, crates/zeroclaw-runtime/src/relay.rs, crates/zeroclaw-runtime/src/rpc/auth.rs, crates/zeroclaw-runtime/src/enroll/mod.rs, apps/zerorelay/src/frontdoor_assets.rs, apps/zerorelay/src/frontdoor.rs, crates/zeroclaw-runtime/src/cron/outbox.rs, crates/zeroclaw-runtime/src/security/principal_resolver.rs (+20 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 16 significant file(s) lose their only recent owner: crates/zeroclaw-channels/src/discord/markers.rs, crates/zeroclaw-channels/src/discord/components.rs, crates/zeroclaw-channels/src/discord/slash_options.rs, crates/zeroclaw-memory/src/budget.rs, crates/zeroclaw-channels/src/discord/chunk.rs, crates/zeroclaw-runtime/src/sop/capability/builtins.rs, crates/zeroclaw-channels/src/discord_slash_state.rs, crates/zeroclaw-channels/src/discord/interaction.rs (+8 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 10 significant file(s) lose their only recent owner: crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs, xtask/src/cmd/mdbook/check.rs, crates/zeroclaw-memory/src/sqlite_permissions.rs, crates/zeroclaw-gateway/src/nodes/mdns.rs, apps/zerocode/src/text_selection.rs, crates/zeroclaw-channels/src/voice.rs, crates/zeroclaw-runtime/src/calendar/poller.rs, xtask/src/cmd/mdbook/placeholders.rs (+2 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 7 significant file(s) lose their only recent owner: crates/zeroclaw-hardware/src/rpi.rs, crates/zeroclaw-tools/src/canvas.rs, xtask/src/cmd/mdbook/themes.rs, crates/zeroclaw-runtime/src/rpc/git.rs, crates/zeroclaw-hardware/src/peripherals/rpi.rs, crates/zeroclaw-providers/src/stream_guard.rs, crates/zeroclaw-gateway/src/security_headers.rs. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 3 significant file(s) lose their only recent owner: crates/zeroclaw-runtime/src/tunnel/tailscale.rs, crates/zeroclaw-tools/src/mcp_resources_tool.rs, crates/zeroclaw-tools/src/mcp_prompts_tool.rs. Pair on, review, or document these before any departure.
Interpolated log message defeats structured logging crates/zeroclaw-log/src/writer.rs:266— `warn!` at line 266 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Interpolated log message defeats structured logging crates/zeroclaw-log/src/writer.rs:292— `warn!` at line 292 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
Silent fallback default on parse failure scripts/ci/check_internal_docs_links.py:174— `_read_lines` returns `[]` when `(OSError, UnicodeDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure scripts/ci/windows_test_scope.py:485— `emit_package_args` returns `2` when `json.JSONDecodeError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Partial audit-trail evidence — An audit mechanism is present, but the trail is not yet complete — missing: a write-side hook every change flows through (a SeaORM ActiveModelBehavior hook or a database trigger recording each change, or an event-sourced store), per-entity coverage (an event-sourced aggregate, or a hook on each entity that needs a who-changed-what trail).
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 6 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (71 single-owned of 844 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 844 of the 1054 production source files in this repository met that bar). They are anonymized user #6 (2 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)), anonymized user #10 (1 file(s)), anonymized user #11 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: crates/zeroclaw-hardware/src/manifest.rs, crates/zeroclaw-hardware/src/protocol.rs, crates/zeroclaw-log/src/log_bridge.rs, crates/zeroclaw-runtime/src/tools/verifiable_intent.rs, crates/zeroclaw-runtime/src/tools/shell_output.rs, xtask/src/generate/sop_syntax.rs, crates/zeroclaw-hardware/src/registry.rs.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 9 of 34 project(s) overshoot their size bounds, lowering Project Cohesion to 4.7/10. The most over is `crates/zeroclaw-runtime` (378295 LoC, 1030 module-visible types across 39 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 8 of 844 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 844 of the 1054 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: crates/zeroclaw-runtime/src/security/playbook.rs, crates/zeroclaw-runtime/src/security/estop.rs, crates/zeroclaw-runtime/src/security/vulnerability.rs, crates/zeroclaw-channels/src/login_events.rs, crates/zeroclaw-runtime/src/security/prompt_guard.rs, crates/zeroclaw-runtime/src/security/otp.rs, crates/zeroclaw-gateway/src/voice_duplex.rs, firmware/pico/src/main.rs. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D40 · Network Egress Confinement· No network policy · ×1
No network policy — No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
No runtime threat detection — No runtime threat-detection engine (Tetragon TracingPolicy / Falco) is committed. These observe process, file and network activity in-kernel and can alert or kill on malicious behaviour a static scan cannot catch.
Logging is not universal — Only 10/18 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `apps/tauri`, `apps/zerocode`, `crates/zeroclaw-gateway`, `crates/zeroclaw-memory` and 3 more.
Hand-rolled JSON/XML parsing via regex crates/zeroclaw-tool-call-parser/src/lib.rs:669— 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 Rust code already uses a real parser in the same package; use it here too.
Outdated: clap — `clap` is locked at 4.6.6 but 4.6.7 is the current stable release on crates.io, and it already satisfies the `"4.5"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap` and commit the updated REDACTED.
Outdated: clap_complete — `clap_complete` is locked at 4.6.9 but 4.6.11 is the current stable release on crates.io, and it already satisfies the `"4.5"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p clap_complete` and commit the updated REDACTED.
Outdated: cpal — `cpal` is locked at 0.18.1 but 0.18.2 is the current stable release on crates.io, and it already satisfies the `"0.18.1"` requirement declared in crates/zeroclaw-channels/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p cpal` and commit the updated REDACTED.
Outdated: encoding_rs — `encoding_rs` is locked at 0.8.41 but 0.8.42 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in crates/zeroclaw-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p encoding_rs` and commit the updated REDACTED.
Outdated: flate2 — `flate2` is locked at 1.1.9 but 1.1.10 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p flate2` and commit the updated REDACTED.
Outdated: hyper — `hyper` is locked at 1.11.1 but 1.12.0 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in crates/zeroclaw-gateway/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hyper` and commit the updated REDACTED.
Outdated: hyper-util — `hyper-util` is locked at 0.1.20 but 0.1.21 is the current stable release on crates.io, and it already satisfies the `"0.1"` requirement declared in crates/zeroclaw-gateway/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p hyper-util` and commit the updated REDACTED.
Outdated: lettre — `lettre` is locked at 0.11.22 but 0.11.23 is the current stable release on crates.io, and it already satisfies the `"0.11.22"` requirement declared in crates/zeroclaw-channels/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p lettre` and commit the updated REDACTED.
Outdated: libc — `libc` is locked at 0.2.189 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
Outdated: nusb — `nusb` is locked at 0.2.7 but 0.2.9 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in crates/zeroclaw-hardware/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p nusb` and commit the updated REDACTED.
Outdated: objc2 — `objc2` is locked at 0.6.4 but 0.6.5 is the current stable release on crates.io, and it already satisfies the `"0.6"` requirement declared in apps/tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p objc2` and commit the updated REDACTED.
Outdated: opentelemetry — `opentelemetry` is locked at 0.33.0 but 0.33.1 is the current stable release on crates.io, and it already satisfies the `"0.33"` requirement declared in crates/zeroclaw-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p opentelemetry` and commit the updated REDACTED.
Outdated: opentelemetry-otlp — `opentelemetry-otlp` is locked at 0.33.0 but 0.33.1 is the current stable release on crates.io, and it already satisfies the `"0.33"` requirement declared in crates/zeroclaw-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p opentelemetry-otlp` and commit the updated REDACTED.
Outdated: opentelemetry_sdk — `opentelemetry_sdk` is locked at 0.33.0 but 0.33.1 is the current stable release on crates.io, and it already satisfies the `"0.33"` requirement declared in crates/zeroclaw-runtime/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p opentelemetry_sdk` and commit the updated REDACTED.
Outdated: pulldown-cmark — `pulldown-cmark` is locked at 0.13.4 but 0.13.5 is the current stable release on crates.io, and it already satisfies the `"0.13"` requirement declared in xtask/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p pulldown-cmark` and commit the updated REDACTED.
Outdated: rand — `rand` is locked at 0.10.2 but 0.10.3 is the current stable release on crates.io, and it already satisfies the `"0.10"` requirement declared in crates/zeroclaw-channels/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rand` and commit the updated REDACTED.
Outdated: rustix — `rustix` is locked at 1.1.4 but 1.1.5 is the current stable release on crates.io, and it already satisfies the `"1.1.4"` requirement declared in crates/zeroclaw-plugins/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustix` and commit the updated REDACTED.
Outdated: rustls-native-certs — `rustls-native-certs` is locked at 0.8.4 but 0.8.5 is the current stable release on crates.io, and it already satisfies the `"0.8"` requirement declared in crates/zeroclaw-plugins/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustls-native-certs` and commit the updated REDACTED.
Outdated: schemars — `schemars` is locked at 1.2.2 but 1.2.3 is the current stable release on crates.io, and it already satisfies the `"1.2"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p schemars` and commit the updated REDACTED.
Outdated: serde_json — `serde_json` is locked at 1.0.151 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1.0"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
Outdated: tauri — `tauri` is locked at 2.11.5 but 2.12.5 is the current stable release on crates.io, and it already satisfies the `"2.0"` requirement declared in apps/tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri` and commit the updated REDACTED.
Outdated: tauri-build — `tauri-build` is locked at 2.6.3 but 2.7.4 is the current stable release on crates.io, and it already satisfies the `"2.0"` requirement declared in apps/tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-build` and commit the updated REDACTED.
Outdated: tauri-plugin-single-instance — `tauri-plugin-single-instance` is locked at 2.4.4 but 2.5.4 is the current stable release on crates.io, and it already satisfies the `"2.0"` requirement declared in apps/tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-single-instance` and commit the updated REDACTED.
Outdated: tauri-plugin-store — `tauri-plugin-store` is locked at 2.4.4 but 2.5.0 is the current stable release on crates.io, and it already satisfies the `"2.0"` requirement declared in apps/tauri/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tauri-plugin-store` and commit the updated REDACTED.
Outdated: thiserror — `thiserror` is locked at 2.0.20 but 2.0.21 is the current stable release on crates.io, and it already satisfies the `"2.0"` requirement declared in crates/zeroclaw-api/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p thiserror` and commit the updated REDACTED.
+ 8 more in this group — see findings.md.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 1 file(s) — `crates/zeroclaw-channels/src/telegram.rs` — so the PII/GDPR sweep did not cover them at all.
Run 01a1761c-6442-7ba9-9f35-9335a1d48192 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 86 · Warnings: 3605 · Recommendations: 119 · Info: 33 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 26-10-2026 @ 02:48 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.