Public report of zeroclaw-labs/zeroclaw, published 14 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 14 November 2026, 06:03 UTC · Survey ID cd_b9497a8311e84c09a083389f44cb6f44
zeroclaw-labs/zeroclaw
Measured 14 November 2026, 05:42 UTC, at code version 87461d1
CAI scoreAt riskUp 1 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,313,838 lines of product code in 36 projects, tests not counted · Estimated rebuild effort: about 11.2 person-years · Weakest lens: Event Sourcing, 49
Findings by how serious they are
98 critical4408 serious214 minor
22 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 05:42 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
70of 70 dimensions measured by tools.
4661of 4720 findings point to an exact file and line, so you can open each one in the code. The other 59 concern the repository as a whole, such as missing documentation.
70dimensions across 9 lenses, read from 1,313,838 lines of product code in 36 projects.
zeroclaw-labs/zeroclaw is rated At risk because critical security findings are open. Its score is held back because it has history replays that read the clock or random values. It scores 57 out of 100, which the At risk rating leaves unchanged. We judged it as a preview release, against a lower bar.
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. Replacing the two exposed passwords or keys and switching the old ones off comes next, worth about 2 points. Raising Event Sourcing to 65 would lift the score to about 63.
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 13 parts of the code nobody has worked on for a long time need someone to learn and document them before anyone changes them.
The product code is 1,313,838 lines, about €1,600,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 57 to about 63.
Code composition: what the lines of code are
Product code 95%Tests 5%
New since the last survey: 1419 findings
These 1419 critical or serious findings weren't in the previous survey, on 26 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::loop_::run_inner crates/zeroclaw-runtime/src/agent/loop_.rs
God Classes · MethodTooLong: ScopedToolRegistry.assemble_prepared crates/zeroclaw-runtime/src/tools/scoped.rs
God Classes · FunctionTooLong: zeroclaw_runtime::agent::tool_execution::execute_one_tool_with_provenance crates/zeroclaw-runtime/src/agent/tool_execution.rs
God Classes · FileTooLong: src/types.rs crates/zeroclaw-rpc-proto/src/types.rs
God Classes · FileTooLong: src/api_oidc.rs crates/zeroclaw-gateway/src/api_oidc.rs
God Classes · FileTooLong: src/dashboard_core.rs crates/zeroclaw-gateway/src/dashboard_core.rs
God Classes · FileTooLong: src/dashboard_session.rs crates/zeroclaw-gateway/src/dashboard_session.rs
God Classes · MethodTooLong: RpcDispatcher.handle_session_messages_record crates/zeroclaw-runtime/src/rpc/dispatch.rs
God Classes · FileTooLong: src/chat_core.rs crates/zeroclaw-gateway/src/chat_core.rs
God Classes · ClassTooLong: ScopedToolRegistry crates/zeroclaw-runtime/src/tools/scoped.rs
God Classes · MethodTooLong: Chat.relay_turn crates/zeroclaw-gateway/src/chat_core.rs
God Classes · FunctionTooLong: zeroclaw_runtime::agent::turn::assemble_owned_execution_with_capabilities crates/zeroclaw-runtime/src/agent/turn/mod.rs
God Classes · FunctionTooLong: zeroclaw_gateway::api_oidc_enroll::handle_certificate crates/zeroclaw-gateway/src/api_oidc_enroll.rs
God Classes · FunctionTooLong: zeroclaw_channels::orchestrator::acp_server::notification_for_turn_event_titled crates/zeroclaw-channels/src/orchestrator/acp_server.rs
God Classes · FunctionTooLong: zeroclaw_gateway::api_oidc::finish_pkce_callback crates/zeroclaw-gateway/src/api_oidc.rs
God Classes · FunctionTooLong: zeroclaw_runtime::cron::scheduler::run_agent_job_inner crates/zeroclaw-runtime/src/cron/scheduler.rs
God Classes · FunctionTooLong: zeroclaw::commands::update::run_from src/commands/update.rs
God Classes · FunctionTooLong: zeroclaw_runtime::cron::store::update_job_authorized crates/zeroclaw-runtime/src/cron/store.rs
God Classes · FileTooLong: src/pairing.rs crates/zeroclaw-config/src/pairing.rs
God Classes · TooManyMethods: PairingGuard crates/zeroclaw-config/src/pairing.rs
God Classes · FunctionTooLong: zeroclaw_runtime::relay::serve_established crates/zeroclaw-runtime/src/relay.rs
God Classes · ClassTooLong: AgentScopedMemory crates/zeroclaw-memory/src/agent_scoped.rs
God Classes · MethodTooLong: SopStatusTool.execute crates/zeroclaw-runtime/src/tools/sop_status.rs
God Classes · FileTooLong: src/api_pairing.rs crates/zeroclaw-gateway/src/api_pairing.rs
God Classes · FileTooLong: src/main.rs apps/zerorelay/src/main.rs
God Classes · FileTooLong: agent/tool_execution.rs crates/zeroclaw-runtime/src/agent/tool_execution.rs
God Classes · FunctionTooLong: zerocode::config::load_persisted apps/zerocode/src/config/mod.rs
God Classes · TooManyFields: DelegateTool crates/zeroclaw-runtime/src/tools/delegate.rs
God Classes · MethodTooLong: AcpSessionStore.recover_turn_checkpoint_for_owner_authorized REDACTED
God Classes · MethodTooLong: TurnRelay.relay crates/zeroclaw-gateway/src/chat_core.rs
God Classes · MethodTooLong: RpcDispatcher.handle_sops_run crates/zeroclaw-runtime/src/rpc/dispatch.rs
God Classes · MethodTooLong: OidcAuthProvider.claims_to_identity crates/zeroclaw-runtime/src/security/auth_provider/oidc.rs
Code Duplication · Near-duplicate member family (8 members, 20 shared lines) crates/zeroclaw-tools/src/jira_tool.rs
Code Duplication · Near-duplicate member family (7 members, 22 shared lines) crates/zeroclaw-tools/src/jira_tool.rs
Code Duplication · Near-duplicate member family (6 members, 15 shared lines) crates/zeroclaw-providers/src/dispatch.rs
Code Duplication · Near-duplicate member family (5 members, 21 shared lines) crates/zeroclaw-tools/src/jira_tool.rs
Code Duplication · Near-duplicate member family (5 members, 12 shared lines) crates/zeroclaw-tools/src/web_search_tool.rs
Code Duplication · Near-duplicate member family (4 members, 174 shared lines) crates/zeroclaw-providers/src/reliable.rs
Code Duplication · Near-duplicate member family (4 members, 36 shared lines) crates/zeroclaw-providers/src/auth/mod.rs
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 661 findings
These 661 critical or serious findings were in the previous survey, on 26 October 2026, and are gone from this one. The first 100 are listed here.
God Classes · FunctionTooLong: zeroclaw_runtime::agent::loop_::run crates/zeroclaw-runtime/src/agent/loop_.rs
God Classes · FunctionTooLong: zeroclaw_runtime::agent::tool_execution::execute_one_tool crates/zeroclaw-runtime/src/agent/tool_execution.rs
God Classes · ClassTooLong: SecurityPolicy crates/zeroclaw-config/src/policy.rs
God Classes · FileTooLong: rpc/types.rs crates/zeroclaw-runtime/src/rpc/types.rs
God Classes · MethodTooLong: RpcDispatcher.handle_session_messages crates/zeroclaw-runtime/src/rpc/dispatch.rs
God Classes · FunctionTooLong: zeroclaw_config::policy::split_shell_words_with_metadata crates/zeroclaw-config/src/policy.rs
God Classes · MethodTooLong: App.handle_personality_tab apps/zerocode/src/config_manager.rs
God Classes · FunctionTooLong: zeroclaw_channels::orchestrator::acp_server::notification_for_turn_event crates/zeroclaw-channels/src/orchestrator/acp_server.rs
God Classes · FunctionTooLong: zeroclaw_runtime::agent::turn::assemble_owned_execution_with_admission crates/zeroclaw-runtime/src/agent/turn/mod.rs
God Classes · FunctionTooLong: zeroclaw_runtime::cron::store::update_job_inner crates/zeroclaw-runtime/src/cron/store.rs
God Classes · FunctionTooLong: zeroclaw_runtime::cron::scheduler::run_agent_job crates/zeroclaw-runtime/src/cron/scheduler.rs
God Classes · MethodTooLong: SecurityPolicy.forbidden_path_argument_impl crates/zeroclaw-config/src/policy.rs
God Classes · FunctionTooLong: zeroclaw_config::policy::split_unquoted_segments crates/zeroclaw-config/src/policy.rs
God Classes · MethodTooLong: AcpSessionStore.recover_turn_checkpoint_for_owner REDACTED
God Classes · MethodTooLong: App.handle_skills_tab apps/zerocode/src/config_manager.rs
Code Duplication · Near-duplicate member family (5 members, 60 shared lines) crates/zeroclaw-tools/src/claude_code.rs
Code Duplication · Near-duplicate member family (4 members, 169 shared lines) crates/zeroclaw-providers/src/reliable.rs
Code Duplication · Near-duplicate member family (4 members, 36 shared lines) crates/zeroclaw-providers/src/auth/mod.rs
Code Duplication · Near-duplicate member family (3 members, 34 shared lines) crates/zeroclaw-tools/src/ask_user.rs
Code Duplication · Near-duplicate member pair (107 shared lines) crates/zeroclaw-tools/src/file_upload.rs
Code Duplication · Near-duplicate member pair (76 shared lines) crates/zeroclaw-runtime/src/skills/mod.rs
Code Duplication · Near-duplicate member pair (55 shared lines) apps/zerocode/src/config_manager.rs
Code Duplication · Near-duplicate member pair (53 shared lines) crates/zeroclaw-config/src/schema.rs
Code Duplication · Near-duplicate member pair (52 shared lines) crates/zeroclaw-memory/src/qdrant.rs
Code Duplication · Near-duplicate member pair (52 shared lines) crates/zeroclaw-tools/src/discord_search.rs
Code Duplication · Near-duplicate member pair (49 shared lines) crates/zeroclaw-channels/src/lark.rs
Code Duplication · Near-duplicate member pair (42 shared lines) crates/zeroclaw-providers/src/gemini_cli.rs
Code Duplication · Near-duplicate member pair (42 shared lines) crates/zeroclaw-hardware/src/pico_code.rs
Code Duplication · Near-duplicate member pair (42 shared lines) crates/zeroclaw-providers/src/compatible.rs
Code Duplication · Near-duplicate member pair (41 shared lines) crates/zeroclaw-channels/src/mochat.rs
Code Duplication · Near-duplicate member pair (37 shared lines) apps/zerocode/src/client.rs
Code Duplication · Near-duplicate member pair (37 shared lines) crates/zeroclaw-providers/src/compatible.rs
Code Duplication · Near-duplicate member pair (36 shared lines) crates/zeroclaw-memory/src/qdrant.rs
Code Duplication · Near-duplicate member pair (34 shared lines) apps/zerocode/src/jsonrpc.rs
Code Duplication · Near-duplicate member pair (28 shared lines) crates/zeroclaw-tools/src/model_routing_config.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 (13 members, 50+ identical tokens) crates/zeroclaw-channels/src/lark.rs
Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) crates/zeroclaw-tools/src/microsoft365/mod.rs
Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) crates/zeroclaw-hardware/src/peripherals/rpi.rs
Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) crates/zeroclaw-tools/src/jira_tool.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-gateway/src/api_skills.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/bluesky.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/matrix.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-channels/src/orchestrator/mod.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-providers/src/dispatch.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-runtime/src/sop/engine.rs
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) crates/zeroclaw-tools/src/proxy_config.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) apps/zerocode/src/dashboard.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/discord/markers.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/lark.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-channels/src/orchestrator/acp_server.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-gateway/src/api_pairing.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-runtime/src/agent/turn/approval_gate.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-runtime/src/sop/store/sqlite.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-runtime/src/tools/sop_advance.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-tools/src/model_routing_config.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) crates/zeroclaw-tools/src/reaction.rs
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) xtask/src/generate/container.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) apps/zerocode/src/config_manager.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) apps/zerocode/src/config_manager.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-api/src/model_provider.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/discord/mod.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/git/channel.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/gmail_push.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/lark.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/orchestrator/acp_server.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/orchestrator/mod.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/orchestrator/mod.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/telegram.rs
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-channels/src/telegram.rs
Rebuild cost: about €1,600,000 · Estimate
Cost to rebuild
€540,000 to €2,700,000, for 9,032 to 28,654 hours of work, about 11.2 person-years for 6 to 22 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 57. 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,313,838 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
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 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED, REDACTED.
Raises the score by about 2 points · Low effort · Secret Scanning
3
Resolve the 1 Banned license finding(s) in License Compliance.
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,600,000 to build again, about 11.2 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.2 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 10% on every change. The history of the code shows how much it changes: about 900,696 lines over the last 90 days, which is about 3,652,823 lines a year. At that pace, the extra work comes to an estimated 415.9 to 2495.4 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
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.
1105 modules, with 2344 dependencies between them. 14 loops run through 49 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 1065 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 crossterm.command, so a change to crossterm.command can break crossterm.event, while a change to crossterm.event can't break crossterm.command.
Position
Below the diagonal: crossterm.event 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_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_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.
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.
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 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 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.
zeroclaw_runtime.skills uses crossterm.command, so a change to crossterm.command can break zeroclaw_runtime.skills, while a change to zeroclaw_runtime.skills can't break crossterm.command.
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_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_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.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.
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 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_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_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_providers.azure_openai uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_providers.azure_openai, while a change to zeroclaw_providers.azure_openai can't break zeroclaw_api.a2a_wire.
Position
Below the diagonal: zeroclaw_providers.azure_openai uses a module listed above it, which is the healthy direction.
zeroclaw_providers.azure_openai uses zeroclaw_api.attribution, so a change to zeroclaw_api.attribution can break zeroclaw_providers.azure_openai, while a change to zeroclaw_providers.azure_openai can't break zeroclaw_api.attribution.
Position
Below the diagonal: zeroclaw_providers.azure_openai uses a module listed above it, which is the healthy direction.
zeroclaw_providers.azure_openai uses zeroclaw_api.model_provider, so a change to zeroclaw_api.model_provider can break zeroclaw_providers.azure_openai, while a change to zeroclaw_providers.azure_openai can't break zeroclaw_api.model_provider.
Position
Below the diagonal: zeroclaw_providers.azure_openai uses a module listed above it, which is the healthy direction.
zeroclaw_rpc_proto.types uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_rpc_proto.types, while a change to zeroclaw_rpc_proto.types can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_rpc_proto.types uses a module listed above it, which is the healthy direction.
zeroclaw_rpc_proto.types uses zeroclaw_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_rpc_proto.types, while a change to zeroclaw_rpc_proto.types can't break zeroclaw_api.memory_traits.
Position
Below the diagonal: zeroclaw_rpc_proto.types 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_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_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_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
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.
zeroclaw_providers.compatible uses zeroclaw_providers.azure_openai, so a change to zeroclaw_providers.azure_openai can break zeroclaw_providers.compatible, while a change to zeroclaw_providers.compatible can't break zeroclaw_providers.azure_openai.
Position
Below the diagonal: zeroclaw_providers.compatible 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.live_config_authority uses zeroclaw_rpc_proto.types, so a change to zeroclaw_rpc_proto.types can break zeroclaw_runtime.live_config_authority, while a change to zeroclaw_runtime.live_config_authority can't break zeroclaw_rpc_proto.types.
Position
Below the diagonal: zeroclaw_runtime.live_config_authority 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 zeroclaw_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.sop.types, while a change to zeroclaw_runtime.sop.types can't break zeroclaw_api.memory_traits.
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.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 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_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.sop.engine, while a change to zeroclaw_runtime.sop.engine can't break zeroclaw_api.memory_traits.
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.
26 pairs of types, where a type in zeroclaw_runtime.sop.engine uses a type in zeroclaw_runtime.sop.types. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
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 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_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_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_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_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_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_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_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_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_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.composition uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.composition, while a change to zeroclaw_runtime.composition can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.composition uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.composition uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_runtime.composition, while a change to zeroclaw_runtime.composition can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_runtime.composition uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.composition uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.composition, while a change to zeroclaw_runtime.composition can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.composition uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.composition uses zeroclaw_runtime.live_config_authority, so a change to zeroclaw_runtime.live_config_authority can break zeroclaw_runtime.composition, while a change to zeroclaw_runtime.composition can't break zeroclaw_runtime.live_config_authority.
Position
Below the diagonal: zeroclaw_runtime.composition uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.composition uses zeroclaw_runtime.sop.audit, so a change to zeroclaw_runtime.sop.audit can break zeroclaw_runtime.composition, while a change to zeroclaw_runtime.composition can't break zeroclaw_runtime.sop.audit.
Position
Below the diagonal: zeroclaw_runtime.composition uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.composition uses zeroclaw_runtime.sop.engine, so a change to zeroclaw_runtime.sop.engine can break zeroclaw_runtime.composition, while a change to zeroclaw_runtime.composition can't break zeroclaw_runtime.sop.engine.
Position
Below the diagonal: zeroclaw_runtime.composition uses a module listed above it, which is the healthy direction.
30→38 zeroclaw_runtime.composition uses zeroclaw_runtime.toolspart of a loop✕
Connections
2 pairs of types, where a type in zeroclaw_runtime.composition uses a type in zeroclaw_runtime.tools.
zeroclaw_runtime.composition uses zeroclaw_runtime.tools, so a change to zeroclaw_runtime.tools can break zeroclaw_runtime.composition, while a change to zeroclaw_runtime.composition can't break zeroclaw_runtime.tools.
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.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_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 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_gateway.dashboard_session uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_gateway.dashboard_session, while a change to zeroclaw_gateway.dashboard_session can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_gateway.dashboard_session uses a module listed above it, which is the healthy direction.
zeroclaw_gateway.dashboard_session uses zeroclaw_config.live, so a change to zeroclaw_config.live can break zeroclaw_gateway.dashboard_session, while a change to zeroclaw_gateway.dashboard_session can't break zeroclaw_config.live.
Position
Below the diagonal: zeroclaw_gateway.dashboard_session uses a module listed above it, which is the healthy direction.
zeroclaw_gateway.dashboard_session uses zeroclaw_channels.matrix.streaming, so a change to zeroclaw_channels.matrix.streaming can break zeroclaw_gateway.dashboard_session, while a change to zeroclaw_gateway.dashboard_session can't break zeroclaw_channels.matrix.streaming.
Position
Below the diagonal: zeroclaw_gateway.dashboard_session uses a module listed above it, which is the healthy direction.
zeroclaw_gateway.dashboard_session uses zeroclaw_gateway, so a change to zeroclaw_gateway can break zeroclaw_gateway.dashboard_session, while a change to zeroclaw_gateway.dashboard_session can't break zeroclaw_gateway.
Position
Below the diagonal: zeroclaw_gateway.dashboard_session uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.scoped uses zeroclaw_config.schema, so a change to zeroclaw_config.schema can break zeroclaw_runtime.tools.scoped, while a change to zeroclaw_runtime.tools.scoped can't break zeroclaw_config.schema.
Position
Below the diagonal: zeroclaw_runtime.tools.scoped uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.scoped uses zeroclaw_config.policy, so a change to zeroclaw_config.policy can break zeroclaw_runtime.tools.scoped, while a change to zeroclaw_runtime.tools.scoped can't break zeroclaw_config.policy.
Position
Below the diagonal: zeroclaw_runtime.tools.scoped uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.scoped uses zeroclaw_api.tool, so a change to zeroclaw_api.tool can break zeroclaw_runtime.tools.scoped, while a change to zeroclaw_runtime.tools.scoped can't break zeroclaw_api.tool.
Position
Below the diagonal: zeroclaw_runtime.tools.scoped uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.scoped uses zeroclaw_tools.mcp_deferred, so a change to zeroclaw_tools.mcp_deferred can break zeroclaw_runtime.tools.scoped, while a change to zeroclaw_runtime.tools.scoped can't break zeroclaw_tools.mcp_deferred.
Position
Below the diagonal: zeroclaw_runtime.tools.scoped uses a module listed above it, which is the healthy direction.
zeroclaw_runtime.tools.scoped uses zeroclaw_runtime.composition, so a change to zeroclaw_runtime.composition can break zeroclaw_runtime.tools.scoped, while a change to zeroclaw_runtime.tools.scoped can't break zeroclaw_runtime.composition.
Position
Below the diagonal: zeroclaw_runtime.tools.scoped uses a module listed above it, which is the healthy direction.
33→38 zeroclaw_runtime.tools.scoped uses zeroclaw_runtime.toolspart of a loop✕
Connections
5 pairs of types, where a type in zeroclaw_runtime.tools.scoped uses a type in zeroclaw_runtime.tools.
zeroclaw_runtime.tools.scoped uses zeroclaw_runtime.tools, so a change to zeroclaw_runtime.tools can break zeroclaw_runtime.tools.scoped, while a change to zeroclaw_runtime.tools.scoped can't break zeroclaw_runtime.tools.
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.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_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_api.memory_traits.
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_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.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.sop.types, so a change to zeroclaw_runtime.sop.types can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_runtime.sop.types.
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.agent.turn uses zeroclaw_runtime.composition, so a change to zeroclaw_runtime.composition can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_runtime.composition.
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.tools.scoped, so a change to zeroclaw_runtime.tools.scoped can break zeroclaw_runtime.agent.turn, while a change to zeroclaw_runtime.agent.turn can't break zeroclaw_runtime.tools.scoped.
Position
Below the diagonal: zeroclaw_runtime.agent.turn 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_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_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_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_api.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_api.memory_traits.
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_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.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.composition, so a change to zeroclaw_runtime.composition can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_runtime.composition.
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.tools.scoped, so a change to zeroclaw_runtime.tools.scoped can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_runtime.tools.scoped.
Position
Below the diagonal: zeroclaw_runtime.tools.delegate uses a module listed above it, which is the healthy direction.
35→38 zeroclaw_runtime.tools.delegate uses zeroclaw_runtime.toolspart of a loop✕
Connections
2 pairs of types, where a type in zeroclaw_runtime.tools.delegate uses a type in zeroclaw_runtime.tools.
zeroclaw_runtime.tools.delegate uses zeroclaw_runtime.tools, so a change to zeroclaw_runtime.tools can break zeroclaw_runtime.tools.delegate, while a change to zeroclaw_runtime.tools.delegate can't break zeroclaw_runtime.tools.
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.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_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_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_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_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_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.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.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.composition, so a change to zeroclaw_runtime.composition can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.composition.
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.scoped, so a change to zeroclaw_runtime.tools.scoped can break zeroclaw_runtime.agent.agent, while a change to zeroclaw_runtime.agent.agent can't break zeroclaw_runtime.tools.scoped.
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.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.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_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_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.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_runtime.composition, so a change to zeroclaw_runtime.composition can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_runtime.composition.
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.tools.scoped, so a change to zeroclaw_runtime.tools.scoped can break zeroclaw_runtime.agent.loop_, while a change to zeroclaw_runtime.agent.loop_ can't break zeroclaw_runtime.tools.scoped.
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.tools uses crossterm.command, so a change to crossterm.command can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break crossterm.command.
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_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_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_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_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.memory_traits, so a change to zeroclaw_api.memory_traits can break zeroclaw_runtime.tools, while a change to zeroclaw_runtime.tools can't break zeroclaw_api.memory_traits.
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_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.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_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_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_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_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_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_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_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_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_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_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.scoped, so a change to zeroclaw_runtime.tools.scoped can break zeroclaw_channels.orchestrator, while a change to zeroclaw_channels.orchestrator can't break zeroclaw_runtime.tools.scoped.
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.rpc.dispatch uses zeroclaw_api.a2a_wire, so a change to zeroclaw_api.a2a_wire can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_api.a2a_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 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_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_rpc_proto.types, so a change to zeroclaw_rpc_proto.types can break zeroclaw_runtime.rpc.dispatch, while a change to zeroclaw_runtime.rpc.dispatch can't break zeroclaw_rpc_proto.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.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 · 75% · 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
A03:2025 — Software Supply Chain Failures
33
High / Critical
A02:2025 — Security Misconfiguration
30
High / Critical
A05:2025 — Injection
25
High / Critical
A07:2025 — Authentication Failures
2
High / Critical
Roadmap
Top priorities: Stamp clock/random values into the event in the command; the recovery fold must be a pure function of the event; Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED, REDACTED; 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:459` (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.
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:459` (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.
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.
Code Duplication: Edited copy of a member (10 corresponding lines)
REDACTED
5.8
Mixed
Static Analysis (SAST): High: REDACTED
crates/zeroclaw-plugins/src/component.rs
5.9
Mixed
God Classes: FileTooLong: src/component.rs
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
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 — 98
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 — 4408
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 — 214
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
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 70 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 70 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, 4661 of 4720 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: 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.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 353 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 162 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This 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.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 58 further occurrence(s) are not listed individually; the score already reflects all 98.
AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (docker-compose.alpine.yml). compose up failed (exit -1 — compose exited without a cause this engine recognises) — Tool stalled (no output) after 00:19:30.0354328. zeroclaw Pulling zeroclaw Warning pull access denied for zeroclaw, repository does not exist or may require 'docker login': denied: requested access to the resource is denied; runtime evidence skipped.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 42 further occurrence(s) are not listed individually; the score already reflects all 82.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X17 Uncapped recursion over a caller-supplied document — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X19 Unrestored process-global state — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Scala, Ruby and Python source only, and no C# was loaded and no JavaScript/TypeScript, Java, Scala, Ruby or Python was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 1 further occurrence(s) are not listed individually; the score already reflects all 41.
Repo exclusion declarations: 4 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
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 checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
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.
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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
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.
372 function(s) exceeded the cyclomatic complexity threshold of 15; the worst was zeroclaw::async_main_inner at 378. A further 31 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 zeroclaw_rpc_proto::schema::subschema_for_named at 159 — they are counted neither in the figure above nor in this dimension's score. 14 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-rpc-proto/src/schema.rs (zeroclaw_rpc_proto::schema::subschema_for_named at 159), crates/zeroclaw-rpc-proto/src/method.rs (Method::contract at 104), 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), and 9 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.
+ 114 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 378), Config::validate (cyclomatic 277), 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.
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.
+ 169 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 907), DiscordChannel::listen (cognitive 713), Config::validate (cognitive 486). — 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.
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 561 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 171 FileTooLong finding(s) in God Classes — start with REDACTED (15), lib.rs (7), main.rs (3). — One of this dimension's main actionable groups (171 warning-level).
Resolve the 157 MethodTooLong finding(s) in God Classes — start with dispatch.rs (17), config_manager.rs (8), engine.rs (6). — One of this dimension's main actionable groups (157 warning-level).
Resolve the 106 FunctionTooLong finding(s) in God Classes — start with REDACTED (16), main.rs (11), lib.rs (6). — One of this dimension's main actionable groups (106 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
1828 duplicated block group(s) detected. 4.5 % of the production lines (59,407 of 1,313,838) are in a reported copy. A further 683 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 2 of the 2511 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.
+ 448 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 129 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with REDACTED (11), engine.rs (7), web_search_tool.rs (5). — One of this dimension's main actionable groups (129 warning-level).
Resolve the 122 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with REDACTED (11), lark.rs (5), telegram.rs (4). — One of this dimension's main actionable groups (122 warning-level).
Resolve the 117 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with REDACTED (11), lib.rs (7), dispatch.rs (6). — One of this dimension's main actionable groups (117 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling7.8 / 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.
35 production modules (Cargo), 0 dependency cycle(s), 2 unstable depended-on module(s). Read from the build's own module declarations; 7 module(s) off the main sequence, with abstractness counted on 27 of the 35 (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 · ×7
Unstable project zeroclaw-channels
Unstable project zeroclaw-gateway
What to do
Resolve the 7 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (7 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).
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 pairing.rs, wasm_memory.rs, event.rs. — One of this dimension's main actionable groups (5 warning-level).
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).
Detailed fixes: d7_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 353 tests. Measured on the JavaScript/TypeScript suite only — at least 162 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, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
35 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 · ×35
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 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
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 1235 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 (136×277=37672); src/main.rs (63×378=23814); crates/zeroclaw-channels/src/orchestrator/mod.rs (97×181=17557) Repeated repair below the complexity floor: crates/zeroclaw-runtime/src/i18n.rs (17 of 25 changes were fixes); crates/zeroclaw-providers/src/lib.rs (16 of 29 changes were fixes); crates/zeroclaw-runtime/src/agent/turn/vision_route.rs (8 of 11 changes were fixes)
Resolve the 91 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (11), lib.rs (4), main.rs (2). — One of this dimension's main actionable groups (91 warning-level).
Resolve the 61 Repeated repair finding(s) in Churn × Complexity Hotspots — start with REDACTED (7), i18n.rs (3), lib.rs (2). — One of this dimension's main actionable groups (61 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.1 / 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.
76 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 869 of the 1081 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 1313838 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).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality9.8 / 10Exemplary✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
1 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, a date that is no calendar day). How well each record argues its case is not measured.
ADR still proposed, but the code already adopted itdocs/book/src/architecture/decisions/ADR-006-runtime-channel-plugins.md:5detected by adr-integrity
✓ On the Gold path — maintain.
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
9 of 36 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 10 file(s) — `REDACTED` (line 93, line 99, line 107, …), `apps/tauri/src/daemon.rs` (line 28, line 30), `apps/zerocode/src/login.rs` (line 268), `apps/zerocode/src/logs.rs` (line 106, line 107, line 108, …), `apps/zerocode/src/oidc_enroll.rs` (line 603, line 1123, line 1141, …), … (+5 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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
+ 4 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
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 2 Medium vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 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.
68 of 869 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/zeroclaw-tools/src/git_forge.rs. Counted over 869 of the 1081 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 13 Orphaned knowledge finding(s) in Knowledge Freshness — start with git_forge.rs, cloud_ops.rs, trigger_registry.rs. — One of this dimension's main actionable groups (13 issue-level).
Resolve the 55 Orphaned file finding(s) in Knowledge Freshness — start with lib.rs (2), REDACTED (2), playbook.rs. — One of this dimension's main actionable groups (55 recommendation-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
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 7 Change coupling finding(s) in Change Coupling — start with loop_.rs (2), safety_net.rs, chat.rs. — One of this dimension's main actionable groups (7 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.
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. Reported 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. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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/components/AliasPromptDialog.tsx:77, web/src/components/ToolPicker.tsx:283, web/src/components/auth/SignInScreen.tsx:200, …
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:2600
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:2826, 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:2856, web/src/components/sections/FieldForm.tsx:2869, web/src/components/sections/FieldForm.tsx:2926, …
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:167
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. (×3) — web/src/components/UpgradeDialog.tsx:298, web/src/components/auth/ReauthPrompt.tsx:101, 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.
`.btn-add` sets color: white on background-color: #6a9bcc — 2.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/assets/eval_review.html:17
`.btn-export` sets color: white on background-color: #d97757 — 3.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/assets/eval_review.html:19
`.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
`.section-header` sets color: #b0aea5 on background-color: #faf9f5 — 2.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/eval-viewer/viewer.html:83
`.output-file-header` sets color: #b0aea5 on background-color: #faf9f5 — 2.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/eval-viewer/viewer.html:136
`.output-file-content .download-link` sets color: #d97757 on background-color: #faf9f5 — 3.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/eval-viewer/viewer.html:197
`.prev-feedback` sets color: #b0aea5 on background-color: #faf9f5 — 2.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/eval-viewer/viewer.html:221
`.grade-pass` sets color: #788c5d on background-color: #eef2e8 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/eval-viewer/viewer.html:302
`.grade-fail` sets color: #c44 on background-color: #fceaea — 4.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/eval-viewer/viewer.html:303
`.done-btn.ready` sets color: white on background-color: #d97757 — 3.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — .claude/skills/skill-creator/eval-viewer/viewer.html:467
`.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:229
<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:357, web/src/pages/Logs.tsx:540
`.btn-electric` sets color: white on background-color: #22d3ee — 1.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/src/index.css:363
`.btn-primary` sets color: white on background-color: #22d3ee — 1.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/src/index.css:413
`.table-electric thead th` sets color: #71717a on background-color: #232329 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/src/index.css:610
`.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.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether 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.
Other · Domain Modelling — Whether an aggregate references another aggregate by identity rather than embedding it by object reference.
Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.
Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.
Other · Domain Modelling — Whether domain identifiers are strongly typed (a newtype wrapper) rather than raw primitives — consistency once an idiom exists.
Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. An id wrapper is recognised by VALUE SEMANTICS, not by being a struct — a record struct, a record class (`record ApartmentId(Guid Value)`) or a class declared by a typed-id base (`class MemberId : TypedIdValueBase`) all count, while a plain mutable class (reference equality) and a verb-phrase query record (`GetCustomerById`) do not. Deterministic, adoption percentage.
Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.
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 repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
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's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
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.
`.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, `gitsubmodule`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list. — .github/dependabot.yml:3
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.
`AgentBuilder::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. — crates/zeroclaw-runtime/src/agent/agent.rs:1500
`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 each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Other · 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:459, 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:459` (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.
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?
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?
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 — 40 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 — 50 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
AX6 Interface segregation — AX6 reached only 0% of this repository's production lines — rust (1,313,837 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 -1 — compose exited without a cause this engine recognises) — Tool stalled (no output) after 00:19:30.0354328. zeroclaw Pulling zeroclaw Warning pull access denied for zeroclaw, repository does not exist or may require 'docker login': denied: requested access to the resource is denied; 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 does not read html yet; 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+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (zerocode), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript 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) — 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.
D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
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 scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
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
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X17 Uncapped recursion over a caller-supplied document — not 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.
X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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 — 98 finding(s)
AC2 · Forms & labels· <input> without a programmatic label · ×18
<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/auth/SignInScreen.tsx:200— 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:2440— 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:2610— 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:2869— 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:2926— 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:3071— 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:3079— 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.
Orphaned knowledge crates/zeroclaw-tools/src/git_forge.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-tools/src/cloud_ops.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-runtime/src/sop/trigger_registry.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-tools/src/project_intel.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-runtime/src/browse.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-hardware/src/device.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-hardware/src/pico_code.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-hardware/src/rpi.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge crates/zeroclaw-tools/src/browser_delegate.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-runtime/src/platform/wasm.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-runtime/src/sop/condition.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-hardware/src/gpio.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
Orphaned knowledge crates/zeroclaw-runtime/src/trust/tests.rs:1— No living knowledge remains for this large file — its last meaningful change has decayed away, so if it breaks, no one currently understands it. It does carry its own tests, so the behaviour is pinned even though the understanding is gone: schedule a read-through, using those tests as the specification, before the next change lands here.
AC2 · Forms & labels· <label> that labels no control · ×11
<label> that labels no control web/src/components/sections/FieldForm.tsx:2826— 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:2639— 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:2723— 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:3026— 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:459— 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:167— 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:2856— 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 53% of the time (10 of the 19 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 10 shared commits counted here, the most recent 3 are `5a28cda0` feat(telegram): make unauthorized notices configurable and authorizat…; `441df131` feat(channels/telegram): add multi_message streaming mode (#8561); `b954de22` feat(channels): add passive Telegram group context (#10640) — run `git show` on any of them.
FileTooLong: src/schema.rs crates/zeroclaw-config/src/schema.rs— FileTooLong — 15722 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 482 free functions. The bar is 500 significant lines; this is 15222 over it, 31.44× 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 — 11689 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 304 free functions. The bar is 500 significant lines; this is 11189 over it, 23.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/main.rs src/main.rs— FileTooLong — 10697 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 180 free functions. The bar is 500 significant lines; this is 10197 over it, 21.39× 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 — 9479 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 87% of them inside a single declaration: RpcDispatcher (4 blocks, 903-13823), declaring 58 free functions. The bar is 500 significant lines; this is 8979 over it, 18.96× 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 — 8294 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 101 free functions. The bar is 500 significant lines; this is 7794 over it, 16.59× 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 — 5789 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 36 free functions. The bar is 500 significant lines; this is 5289 over it, 11.58× 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 — 4684 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-6930), declaring 37 free functions. The bar is 500 significant lines; this is 4184 over it, 9.37× 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 — 4562 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 91% of them inside a single declaration: App (5 blocks, 456-6430), declaring 37 free functions. The bar is 500 significant lines; this is 4062 over it, 9.12× 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: tools/delegate.rs crates/zeroclaw-runtime/src/tools/delegate.rs— FileTooLong — 3781 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 92% of them inside a single declaration: DelegateTool (5 blocks, 425-5883). The bar is 500 significant lines; this is 3281 over it, 7.56× 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 — 3745 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 3245 over it, 7.49× 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 — 3703 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 3203 over it, 7.41× 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/policy.rs crates/zeroclaw-config/src/policy.rs— FileTooLong — 3396 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 101 free functions. The bar is 500 significant lines; this is 2896 over it, 6.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/compatible.rs crates/zeroclaw-providers/src/compatible.rs— FileTooLong — 3314 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 64% of them inside a single declaration: OpenAiCompatibleModelProvider (5 blocks, 48-5384), declaring 33 free functions. The bar is 500 significant lines; this is 2814 over it, 6.63× 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: turn/mod.rs crates/zeroclaw-runtime/src/agent/turn/mod.rs— FileTooLong — 3235 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 38 free functions. The bar is 500 significant lines; this is 2735 over it, 6.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: agent/loop_.rs crates/zeroclaw-runtime/src/agent/loop_.rs— FileTooLong — 3165 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 70 free functions. The bar is 500 significant lines; this is 2665 over it, 6.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/whatsapp_web.rs crates/zeroclaw-channels/src/whatsapp_web.rs— FileTooLong — 2990 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 41 free functions. The bar is 500 significant lines; this is 2490 over it, 5.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 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/client.rs apps/zerocode/src/client.rs— FileTooLong — 2906 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 2406 over it, 5.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: tools/mod.rs crates/zeroclaw-runtime/src/tools/mod.rs— FileTooLong — 2786 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 35 free functions. The bar is 500 significant lines; this is 2286 over it, 5.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: discord/mod.rs crates/zeroclaw-channels/src/discord/mod.rs— FileTooLong — 2763 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-4229). The bar is 500 significant lines; this is 2263 over it, 5.53× 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 — 2613 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 2113 over it, 5.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 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: REDACTED REDACTED— FileTooLong — 2517 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 85% of them inside a single declaration: AcpSessionStore (2 blocks, 70-3224). The bar is 500 significant lines; this is 2017 over it, 5.03× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
MethodTooLong: Config.validate crates/zeroclaw-config/src/schema.rs:24639— MethodTooLong — validate runs 1220 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 1120 over it, 12.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DiscordChannel.listen crates/zeroclaw-channels/src/discord/mod.rs:1999— MethodTooLong — listen runs 976 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 876 over it, 9.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: RpcDispatcher.run_session_prompt crates/zeroclaw-runtime/src/rpc/dispatch.rs:6590— MethodTooLong — run_session_prompt runs 736 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 636 over it, 7.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: RpcDispatcher.session_new_with_mode crates/zeroclaw-runtime/src/rpc/dispatch.rs:4484— MethodTooLong — session_new_with_mode runs 681 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 581 over it, 6.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: ScopedToolRegistry.assemble_prepared crates/zeroclaw-runtime/src/tools/scoped.rs:699— MethodTooLong — assemble_prepared runs 543 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 443 over it, 5.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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:5225— MethodTooLong — execute_agentic_with_approval_registry runs 410 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 310 over it, 4.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.
MethodTooLong: DelegateTool.execute_background crates/zeroclaw-runtime/src/tools/delegate.rs:3525— MethodTooLong — execute_background runs 366 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 266 over it, 3.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: 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: RpcDispatcher.rehydrate_reaped_session_under_guard crates/zeroclaw-runtime/src/rpc/dispatch.rs:5989— MethodTooLong — rehydrate_reaped_session_under_guard runs 320 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 220 over it, 3.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: 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: AcpServer.handle_session_prompt crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1881— MethodTooLong — handle_session_prompt runs 316 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 216 over it, 3.16× 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: ModelRoutingConfigTool.handle_upsert_agent crates/zeroclaw-tools/src/model_routing_config.rs:1157— 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:2485— 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:561— 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:3255— 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:4082— MethodTooLong — execute_parallel runs 239 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 139 over it, 2.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: 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: App.zeroclaw_help_context apps/zerocode/src/config_manager.rs:6073— MethodTooLong — zeroclaw_help_context runs 228 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 128 over it, 2.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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:16515— 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: AcpServer.handle_session_load crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1153— MethodTooLong — handle_session_load runs 215 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 115 over it, 2.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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 (8 lines × 2) apps/zerocode/src/chat.rs:1657— apps/zerocode/src/chat.rs:1657-1664 | apps/zerocode/src/chat.rs:5272-5279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/chat.rs:1657` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) apps/zerocode/src/doctor.rs:368— apps/zerocode/src/doctor.rs:368-375 | apps/zerocode/src/logs.rs:1896-1903 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/doctor.rs:368` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) apps/zerocode/src/quickstart_pane.rs:318— apps/zerocode/src/quickstart_pane.rs:318-325 | apps/zerocode/src/quickstart_pane.rs:2936-2943 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:318` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:2001` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/zerocode/src/quickstart_pane.rs:2009` calls `advance_agent_modal_after_file` and `apps/zerocode/src/quickstart_pane.rs:2046` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:413` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:858` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/discord/slash.rs:590— crates/zeroclaw-channels/src/discord/slash.rs:590-597 | crates/zeroclaw-channels/src/discord/slash.rs:665-672 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/slash.rs:590` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/imessage.rs:268— crates/zeroclaw-channels/src/imessage.rs:268-275 | crates/zeroclaw-channels/src/matrix.rs:3761-3768 — before extracting anything, compare `crates/zeroclaw-channels/src/imessage.rs` and `crates/zeroclaw-channels/src/matrix.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/imessage.rs:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/linq.rs:407` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) 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 78 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:997` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:1905` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/nextcloud_talk.rs:750— crates/zeroclaw-channels/src/nextcloud_talk.rs:750-758 | crates/zeroclaw-channels/src/telegram.rs:8432-8439 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/nextcloud_talk.rs:750` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/notion.rs:65— crates/zeroclaw-channels/src/notion.rs:65-72 | crates/zeroclaw-tools/src/notion_tool.rs:34-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/notion.rs:65` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1124— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1124-1131 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1741-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 (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:6770— crates/zeroclaw-channels/src/orchestrator/mod.rs:6770-6777 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10843-10853 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:6770` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:12211— crates/zeroclaw-channels/src/orchestrator/mod.rs:12211-12218 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:12211` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:15557— crates/zeroclaw-channels/src/orchestrator/mod.rs:15557-15564 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15856-15863 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:15557` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/signal.rs:1385— crates/zeroclaw-channels/src/signal.rs:1385-1394 | crates/zeroclaw-channels/src/signal.rs:1432-1439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/signal.rs:1385` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:676` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2362— crates/zeroclaw-channels/src/telegram.rs:2362-2369 | crates/zeroclaw-channels/src/telegram.rs:2431-2438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:2362` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wechat.rs:2836` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) crates/zeroclaw-config/src/policy.rs:3844— crates/zeroclaw-config/src/policy.rs:3844-3851 | crates/zeroclaw-config/src/policy.rs:3856-3863 — both copies are in the same file, so extract the block into 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:23484— crates/zeroclaw-config/src/schema.rs:23484-23491 | crates/zeroclaw-config/src/schema.rs:23498-23505 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:23484` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema/v2.rs:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-config/src/schema/v2.rs:176` calls `insert`, `to_string` and `crates/zeroclaw-config/src/schema/v2.rs:136` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) apps/zerocode/src/chat.rs:5434— apps/zerocode/src/chat.rs:5434-5440 | apps/zerocode/src/chat.rs:5471-5477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/chat.rs:5434` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) apps/zerocode/src/chat.rs:6365— apps/zerocode/src/chat.rs:6365-6371 | apps/zerocode/src/chat.rs:6449-6455 — both copies are in the same file, so extract the block into 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:1748— apps/zerocode/src/client.rs:1748-1754 | apps/zerocode/src/client.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) apps/zerocode/src/config_manager.rs:1616— apps/zerocode/src/config_manager.rs:1616-1622 | apps/zerocode/src/config_manager.rs:1628-1634 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:1616` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) apps/zerocode/src/config_manager.rs:6233— apps/zerocode/src/config_manager.rs:6233-6239 | apps/zerocode/src/config_manager.rs:6262-6268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:6233` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:1574` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) apps/zerocode/src/secure_file.rs:147— apps/zerocode/src/secure_file.rs:147-153 | REDACTED:2315-2321 — 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-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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/dingtalk.rs:265` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:401` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2067— crates/zeroclaw-channels/src/discord/mod.rs:2067-2073 | 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 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2067` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:3579— crates/zeroclaw-channels/src/discord/mod.rs:3579-3586 | crates/zeroclaw-channels/src/nextcloud_talk.rs:700-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:3579` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/git/events.rs:270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:1860` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:1883` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2020` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2295` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/line.rs:494— crates/zeroclaw-channels/src/line.rs:494-505 | crates/zeroclaw-channels/src/signal.rs:1285-1291 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:494` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/matrix.rs:3287— crates/zeroclaw-channels/src/matrix.rs:3287-3293 | crates/zeroclaw-channels/src/matrix.rs:3428-3434 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:4616` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:4838` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:1907` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:5927— crates/zeroclaw-channels/src/orchestrator/mod.rs:5927-5933 | crates/zeroclaw-channels/src/orchestrator/mod.rs:5946-5952 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:5927` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:11290— crates/zeroclaw-channels/src/orchestrator/mod.rs:11290-11296 | crates/zeroclaw-runtime/src/sop/dispatch.rs:729-735 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:11290` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:11351— crates/zeroclaw-channels/src/orchestrator/mod.rs:11351-11357 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11435-11441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:11351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) apps/zerocode/src/config/mod.rs:1330— apps/zerocode/src/config/mod.rs:1330-1335 | apps/zerocode/src/enroll.rs:725-730 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config/mod.rs:1330` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:3108` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) REDACTED:661— REDACTED:661-666 | REDACTED:732-737 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:661` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:1810` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/lark.rs:2206— crates/zeroclaw-channels/src/lark.rs:2206-2211 | crates/zeroclaw-channels/src/telegram.rs:8435-8440 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2206` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/telegram.rs:8443` calls `Ok` and `crates/zeroclaw-channels/src/lark.rs:2214` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/lark.rs:2648` calls `is_empty` and `crates/zeroclaw-channels/src/lark.rs:2366` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/lark.rs:3101— crates/zeroclaw-channels/src/lark.rs:3101-3106 | crates/zeroclaw-channels/src/nextcloud_talk.rs:560-565 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3101` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/matrix.rs:4567— crates/zeroclaw-channels/src/matrix.rs:4567-4573 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1355-1360 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:4567` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:4858— crates/zeroclaw-channels/src/orchestrator/mod.rs:4858-4863 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17156-17161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:4858` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:6891— crates/zeroclaw-channels/src/orchestrator/mod.rs:6891-6896 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6908-6913 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:6891` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13429— crates/zeroclaw-channels/src/orchestrator/mod.rs:13429-13434 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14683-14688 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:13429` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:13428` calls `one_shot_channel_workspace_dir` and `crates/zeroclaw-channels/src/orchestrator/mod.rs:14682` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2148— crates/zeroclaw-channels/src/telegram.rs:2148-2153 | crates/zeroclaw-channels/src/telegram.rs:7894-7899 — both copies are in the same file, so extract the block into 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:5306— crates/zeroclaw-channels/src/telegram.rs:5306-5311 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:5306` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wechat.rs:1219` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-config/src/schema.rs:8790— crates/zeroclaw-config/src/schema.rs:8790-8795 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:8790` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-config/src/schema.rs:25097— crates/zeroclaw-config/src/schema.rs:25097-25105 | crates/zeroclaw-runtime/src/sop/engine.rs:1826-1831 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:25097` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) crates/zeroclaw-config/src/schema/v2.rs:3642— crates/zeroclaw-config/src/schema/v2.rs:3642-3647 | crates/zeroclaw-config/src/schema/v2.rs:3681-3686 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema/v2.rs:3642` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-gateway/src/api_config.rs:495— crates/zeroclaw-gateway/src/api_config.rs:495-500 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:3135-3141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_config.rs:495` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-gateway/src/lib.rs:2042— crates/zeroclaw-gateway/src/lib.rs:2042-2047 | crates/zeroclaw-runtime/src/daemon/mod.rs:1279-1284 — 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:2307— crates/zeroclaw-gateway/src/lib.rs:2307-2312 | crates/zeroclaw-runtime/src/tools/file_read.rs:269-274 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:2307` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-gateway/src/lib.rs:4073— crates/zeroclaw-gateway/src/lib.rs:4073-4078 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:4073` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-gateway/src/plugin_webhook.rs:159— crates/zeroclaw-gateway/src/plugin_webhook.rs:159-164 | crates/zeroclaw-gateway/src/plugin_webhook.rs:172-177 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/plugin_webhook.rs:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) crates/zeroclaw-hardware/src/subprocess.rs:146— crates/zeroclaw-hardware/src/subprocess.rs:146-151 | crates/zeroclaw-hardware/src/subprocess.rs:160-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/subprocess.rs:146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-hardware/src/subprocess.rs:166` calls `display`, `to_string` and `crates/zeroclaw-hardware/src/subprocess.rs:152` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) crates/zeroclaw-hardware/src/subprocess.rs:146— crates/zeroclaw-hardware/src/subprocess.rs:146-151 | crates/zeroclaw-hardware/src/subprocess.rs:243-248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/subprocess.rs:146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) apps/zerocode/src/app.rs:3353— apps/zerocode/src/app.rs:3353-3362 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/diff.rs:160` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) apps/zerocode/src/input_bar.rs:1737— apps/zerocode/src/input_bar.rs:1737-1746 | apps/zerocode/src/input_bar.rs:1970-1979 — both copies are in the same file, so extract the block into 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:1691— apps/zerocode/src/logs.rs:1691-1700 | apps/zerocode/src/logs.rs:1773-1782 — both copies are in the same file, so extract the block into 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/zerorelay/src/enroll_proxy.rs:177— apps/zerorelay/src/enroll_proxy.rs:177-186 | apps/zerorelay/src/enroll_proxy.rs:250-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerorelay/src/enroll_proxy.rs:177` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/clawdtalk.rs:120` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:791` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/gmail_push.rs:187— crates/zeroclaw-channels/src/gmail_push.rs:187-196 | crates/zeroclaw-channels/src/gmail_push.rs:261-270 — both copies are in the same file, so extract the block into 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/gmail_push.rs:206— crates/zeroclaw-channels/src/gmail_push.rs:206-215 | crates/zeroclaw-channels/src/gmail_push.rs:592-601 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/gmail_push.rs:206` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:468` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:5179` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:2157` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) 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:1645-1654 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1882— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1882-1891 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3155-3164 — both copies are in the same file, so extract the block into 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/telegram.rs:8027— crates/zeroclaw-channels/src/telegram.rs:8027-8036 | crates/zeroclaw-channels/src/telegram.rs:9149-9159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:8027` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/transcription.rs:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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 — before extracting anything, compare `crates/zeroclaw-channels/src/wechat.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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wechat.rs:870` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/whatsapp_storage.rs:494` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/zeroclaw-config/src/schema.rs:26169— crates/zeroclaw-config/src/schema.rs:26169-26178 | crates/zeroclaw-config/src/schema.rs:26194-26203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:26169` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-config/src/schema.rs:26168` calls `iter`, `enumerate` and `crates/zeroclaw-config/src/schema.rs:26193` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) crates/zeroclaw-gateway/src/api.rs:713— crates/zeroclaw-gateway/src/api.rs:713-722 | crates/zeroclaw-gateway/src/api.rs:776-785 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_sop_author.rs:323` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) crates/zeroclaw-gateway/src/lib.rs:4954— crates/zeroclaw-gateway/src/lib.rs:4954-4963 | crates/zeroclaw-gateway/src/lib.rs:5084-5093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:4954` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
FunctionTooLong: zeroclaw::async_main_inner src/main.rs:9633— FunctionTooLong — zeroclaw::async_main_inner runs 3235 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 3135 over it, 32.35× 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:1657— FunctionTooLong — zeroclaw_runtime::agent::turn::run_tool_call_loop_impl runs 1476 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 1376 over it, 14.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.
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_inner crates/zeroclaw-runtime/src/agent/loop_.rs:1620— FunctionTooLong — zeroclaw_runtime::agent::loop_::run_inner runs 1384 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 1284 over it, 13.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::run_quickstart_cli src/main.rs:1847— 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 813 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 713 over it, 8.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::agent::loop_::process_message_inner crates/zeroclaw-runtime/src/agent/loop_.rs:3753— 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 504 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 404 over it, 5.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: zeroclaw_gateway::ws::process_chat_message crates/zeroclaw-gateway/src/ws.rs:2038— FunctionTooLong — zeroclaw_gateway::ws::process_chat_message runs 489 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 389 over it, 4.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_gateway::ws::handle_socket crates/zeroclaw-gateway/src/ws.rs:592— FunctionTooLong — zeroclaw_gateway::ws::handle_socket runs 466 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 366 over it, 4.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.
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_runtime::sop::dispatch::dispatch_sop_event_filtered crates/zeroclaw-runtime/src/sop/dispatch.rs:688— FunctionTooLong — zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered runs 431 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 331 over it, 4.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.
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::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 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::daemon::run_heartbeat_worker crates/zeroclaw-runtime/src/daemon/mod.rs:2473— FunctionTooLong — zeroclaw_runtime::daemon::run_heartbeat_worker runs 335 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 235 over it, 3.35× 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:932— FunctionTooLong — zeroclaw_runtime::sop::executor::drive_headless_run runs 317 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 217 over it, 3.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: zerocode::run apps/zerocode/src/main.rs:891— FunctionTooLong — zerocode::run runs 309 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 209 over it, 3.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_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::handle_auth_command src/main.rs:15571— 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_runtime::agent::turn::call_prep::prepare_tool_calls crates/zeroclaw-runtime/src/agent/turn/call_prep.rs:168— FunctionTooLong — zeroclaw_runtime::agent::turn::call_prep::prepare_tool_calls runs 229 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 129 over it, 2.29× 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_with_provenance crates/zeroclaw-runtime/src/agent/tool_execution.rs:365— FunctionTooLong — zeroclaw_runtime::agent::tool_execution::execute_one_tool_with_provenance runs 224 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 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
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.
Duplicated block (9 lines × 2) apps/zerocode/src/chat.rs:1272— apps/zerocode/src/chat.rs:1272-1280 | apps/zerocode/src/chat.rs:1306-1314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) async fn focus_session(&mut` in one and `&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 2) apps/zerocode/src/chat.rs:11834— apps/zerocode/src/chat.rs:11834-11842 | 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:3754— apps/zerocode/src/config_manager.rs:3754-3762 | apps/zerocode/src/config_manager.rs:3950-3958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:3754` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) apps/zerorelay/src/dashboard.rs:338— apps/zerorelay/src/dashboard.rs:338-346 | apps/zerorelay/src/dashboard.rs:347-355 — both copies are in the same file, so extract the block into 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-api/src/model_provider.rs:850— crates/zeroclaw-api/src/model_provider.rs:850-858 | crates/zeroclaw-api/src/model_provider.rs:991-999 — both copies are in the same file, so extract the block into 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/markers.rs:837— crates/zeroclaw-channels/src/discord/markers.rs:837-845 | crates/zeroclaw-channels/src/matrix.rs:3336-3344 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:837` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:431` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:69` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `release` to `&GiteaRelease` in one and `&GhRelease` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3588` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:1354` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) 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 78 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:7304— crates/zeroclaw-channels/src/orchestrator/mod.rs:7304-7312 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:7304` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:9344— crates/zeroclaw-channels/src/orchestrator/mod.rs:9344-9352 | crates/zeroclaw-channels/src/orchestrator/mod.rs:12240-12248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:9976— crates/zeroclaw-channels/src/orchestrator/mod.rs:9976-9984 | crates/zeroclaw-channels/src/orchestrator/mod.rs:9993-10001 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:9976` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10737— crates/zeroclaw-channels/src/orchestrator/mod.rs:10737-10745 | crates/zeroclaw-runtime/src/agent/loop_.rs:3454-3462 — 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:17077— crates/zeroclaw-channels/src/orchestrator/mod.rs:17077-17085 | crates/zeroclaw-gateway/src/lib.rs:2065-2073 — 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 10 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:17077` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2344— crates/zeroclaw-channels/src/telegram.rs:2344-2352 | crates/zeroclaw-channels/src/telegram.rs:2407-2415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:2344` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2397— crates/zeroclaw-channels/src/telegram.rs:2397-2405 | crates/zeroclaw-channels/src/telegram.rs:2475-2483 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:2397` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-channels/src/telegram.rs:5382— crates/zeroclaw-channels/src/telegram.rs:5382-5390 | crates/zeroclaw-channels/src/telegram.rs:6163-6171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:5382` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/tts.rs:135` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/policy.rs:423` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) crates/zeroclaw-config/src/schema.rs:22317— crates/zeroclaw-config/src/schema.rs:22317-22325 | crates/zeroclaw-config/src/schema.rs:22340-22348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:22317` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-config/src/schema.rs:25374— crates/zeroclaw-config/src/schema.rs:25374-25384 | crates/zeroclaw-config/src/schema.rs:25425-25433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:25374` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-config/src/schema/v2.rs:3245— crates/zeroclaw-config/src/schema/v2.rs:3245-3253 | crates/zeroclaw-config/src/schema/v2.rs:3290-3298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema/v2.rs:3245` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) crates/zeroclaw-gateway/src/lib.rs:5080— crates/zeroclaw-gateway/src/lib.rs:5080-5088 | crates/zeroclaw-gateway/src/lib.rs:5220-5228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:5080` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Hotspot: crates/zeroclaw-config/src/schema.rs crates/zeroclaw-config/src/schema.rs:24639— crates/zeroclaw-config/src/schema.rs changed 136 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 277 in Config::validate at line 24639. 60 of those changes were fix/bug commits, and the other 76 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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:9633— src/main.rs changed 63 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 378 in zeroclaw::async_main_inner at line 9633. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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:9281— crates/zeroclaw-channels/src/orchestrator/mod.rs changed 97 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 181 in zeroclaw_channels::orchestrator::process_channel_message_body at line 9281. 47 of those changes were fix/bug commits, and the other 50 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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:3391— crates/zeroclaw-runtime/src/rpc/dispatch.rs changed 95 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in RpcDispatcher::dispatch_method at line 3391. 46 of those changes were fix/bug commits, and the other 49 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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:4024— apps/zerocode/src/chat.rs changed 61 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 160 in Chat::handle_key at line 4024. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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:1657— 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 158 in zeroclaw_runtime::agent::turn::run_tool_call_loop_impl at line 1657. 35 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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 26 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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/agent/loop_.rs crates/zeroclaw-runtime/src/agent/loop_.rs:1620— crates/zeroclaw-runtime/src/agent/loop_.rs changed 60 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in zeroclaw_runtime::agent::loop_::run_inner at line 1620. 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-runtime/src/tools/mod.rs crates/zeroclaw-runtime/src/tools/mod.rs:2306— crates/zeroclaw-runtime/src/tools/mod.rs changed 63 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 111 in zeroclaw_runtime::tools::all_tools_with_runtime_on_thread at line 2306. 30 of those changes were fix/bug commits, and the other 33 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-gateway/src/lib.rs crates/zeroclaw-gateway/src/lib.rs:1386— crates/zeroclaw-gateway/src/lib.rs changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 88 in zeroclaw_gateway::run_gateway_with_plugin_webhooks at line 1386. 18 of those changes were fix/bug commits, and the other 26 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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:4912— 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 52 in Agent::turn_streamed_with_steering_body at line 4912. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-channels/src/discord/mod.rs crates/zeroclaw-channels/src/discord/mod.rs:1999— crates/zeroclaw-channels/src/discord/mod.rs changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 174 in DiscordChannel::listen at line 1999. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-channels/src/discord/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/tools/delegate.rs crates/zeroclaw-runtime/src/tools/delegate.rs:5225— 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 39 in DelegateTool::execute_agentic_with_approval_registry at line 5225. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-gateway/src/ws.rs crates/zeroclaw-gateway/src/ws.rs:592— crates/zeroclaw-gateway/src/ws.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in zeroclaw_gateway::ws::handle_socket at line 592. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-config/src/policy.rs crates/zeroclaw-config/src/policy.rs:1614— crates/zeroclaw-config/src/policy.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in zeroclaw_config::policy::scan_unquoted_segments at line 1614. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-providers/src/anthropic.rs crates/zeroclaw-providers/src/anthropic.rs:2485— crates/zeroclaw-providers/src/anthropic.rs changed 23 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 2485. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-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 11 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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-runtime/src/tools/scoped.rs crates/zeroclaw-runtime/src/tools/scoped.rs:699— crates/zeroclaw-runtime/src/tools/scoped.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 72 in ScopedToolRegistry::assemble_prepared at line 699. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/tools/scoped.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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-tools/src/model_routing_config.rs crates/zeroclaw-tools/src/model_routing_config.rs:1157— crates/zeroclaw-tools/src/model_routing_config.rs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 87 in ModelRoutingConfigTool::handle_upsert_agent at line 1157. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-tools/src/model_routing_config.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:3927— crates/zeroclaw-channels/src/whatsapp_web.rs changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in WhatsAppWebChannel::listen at line 3927. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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: crates/zeroclaw-channels/src/telegram.rs crates/zeroclaw-channels/src/telegram.rs:2087— crates/zeroclaw-channels/src/telegram.rs changed 37 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 2087. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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: apps/zerocode/src/input_bar.rs apps/zerocode/src/input_bar.rs:1555— apps/zerocode/src/input_bar.rs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in InputBarState::handle_key at line 1555. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-gateway/src/api_config.rs crates/zeroclaw-gateway/src/api_config.rs:2575— crates/zeroclaw-gateway/src/api_config.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in zeroclaw_gateway::api_config::handle_patch at line 2575. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-gateway/src/api_config.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.
zeroclaw_runtime::agent::turn::run_tool_call_loop_impl (cognitive 350) crates/zeroclaw-runtime/src/agent/turn/mod.rs:1657— zeroclaw_runtime::agent::turn::run_tool_call_loop_impl has cognitive complexity 350 (threshold 15). Drivers by points: if/else 113 (262 pts), boolean chains 36, match/switch 14 (33 pts), loops 7 (19 pts) (nesting depth added 180). 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_inner (cognitive 293) crates/zeroclaw-runtime/src/agent/loop_.rs:1620— zeroclaw_runtime::agent::loop_::run_inner has cognitive complexity 293 (threshold 15). Drivers by points: if/else 95 (221 pts), match/switch 15 (37 pts), loops 6 (19 pts), boolean chains 16 (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::agent::turn::drive_live_sop_actions (cognitive 157) crates/zeroclaw-runtime/src/agent/turn/mod.rs:4330— zeroclaw_runtime::agent::turn::drive_live_sop_actions has cognitive complexity 157 (threshold 15). Drivers by points: if/else 26 (96 pts), match/switch 13 (53 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 111). To reduce it, split the body into named stages: move each independent 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::tools::all_tools_with_runtime_on_thread (cognitive 156) crates/zeroclaw-runtime/src/tools/mod.rs:2306— zeroclaw_runtime::tools::all_tools_with_runtime_on_thread has cognitive complexity 156 (threshold 15). Drivers by points: if/else 74 (92 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::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::sop::dispatch::dispatch_sop_event_filtered (cognitive 113) crates/zeroclaw-runtime/src/sop/dispatch.rs:688— zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered has cognitive complexity 113 (threshold 15). Drivers by points: loops 17 (40 pts), if/else 21 (36 pts), match/switch 15 (35 pts), boolean chains 2 (nesting depth added 58). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:2473— 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::daemon::run_with_authority (cognitive 76) crates/zeroclaw-runtime/src/daemon/mod.rs:715— zeroclaw_runtime::daemon::run_with_authority has cognitive complexity 76 (threshold 15). Drivers by points: if/else 37 (50 pts), match/switch 9 (16 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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::agent::turn::call_prep::prepare_tool_calls (cognitive 59) crates/zeroclaw-runtime/src/agent/turn/call_prep.rs:168— zeroclaw_runtime::agent::turn::call_prep::prepare_tool_calls has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (40 pts), loops 3 (8 pts), boolean chains 6, match/switch 2 (5 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent 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_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::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::sop::executor::drive_headless_run (cognitive 47) crates/zeroclaw-runtime/src/sop/executor.rs:932— zeroclaw_runtime::sop::executor::drive_headless_run has cognitive complexity 47 (threshold 15). Drivers by points: match/switch 14 (39 pts), if/else 3 (7 pts), loops 1 (nesting depth added 29). 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::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::agent::loop_::process_message_inner (cognitive 41) crates/zeroclaw-runtime/src/agent/loop_.rs:3753— zeroclaw_runtime::agent::loop_::process_message_inner has cognitive complexity 41 (threshold 15). Drivers by points: if/else 29 (31 pts), boolean chains 5, match/switch 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_runtime::rpc::dispatch::deliver_subscription (cognitive 41) crates/zeroclaw-runtime/src/rpc/dispatch.rs:13847— 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::relay::serve_established (cognitive 39) crates/zeroclaw-runtime/src/relay.rs:773— zeroclaw_runtime::relay::serve_established has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 5 (20 pts), if/else 5 (18 pts), loops 1 (nesting depth added 28). 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/tauri/src/macos/permissions.rs:203` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) apps/zerocode/src/app.rs:2197— apps/zerocode/src/app.rs:2197-2204 | apps/zerocode/src/app.rs:2281-2285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/app.rs:2197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:807` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1649— crates/zeroclaw-channels/src/discord/mod.rs:1649-1653 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:1649` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2085— crates/zeroclaw-channels/src/discord/mod.rs:2085-2089 | crates/zeroclaw-channels/src/discord/mod.rs:2120-2126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2085` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/gmail_push.rs:642` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/line.rs:1210— crates/zeroclaw-channels/src/line.rs:1210-1214 | crates/zeroclaw-channels/src/matrix.rs:2223-2227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:1210` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:5982— crates/zeroclaw-channels/src/orchestrator/mod.rs:5982-5986 | crates/zeroclaw-tools/src/model_routing_config.rs:807-812 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:5982` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10179— crates/zeroclaw-channels/src/orchestrator/mod.rs:10179-10183 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10393— crates/zeroclaw-channels/src/orchestrator/mod.rs:10393-10397 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10779-10783 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10393` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:14552— crates/zeroclaw-channels/src/orchestrator/mod.rs:14552-14557 | crates/zeroclaw-runtime/src/tools/mod.rs:3399-3403 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:14552` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:17157— crates/zeroclaw-channels/src/orchestrator/mod.rs:17157-17161 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:17157` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/qq.rs:476` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) crates/zeroclaw-gateway/src/api_config.rs:497— crates/zeroclaw-gateway/src/api_config.rs:497-501 | crates/zeroclaw-runtime/src/control_plane/reaper.rs:242-246 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_config.rs:497` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-gateway/src/lib.rs:1713— crates/zeroclaw-gateway/src/lib.rs:1713-1717 | crates/zeroclaw-gateway/src/lib.rs:1810-1815 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:1713` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) crates/zeroclaw-gateway/src/lib.rs:3351— crates/zeroclaw-gateway/src/lib.rs:3351-3355 | crates/zeroclaw-gateway/src/lib.rs:3888-3892 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:3351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-gateway/src/ws.rs:1142— crates/zeroclaw-gateway/src/ws.rs:1142-1146 | crates/zeroclaw-gateway/src/ws.rs:2309-2313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/ws.rs:1142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-hardware/src/device.rs:471— crates/zeroclaw-hardware/src/device.rs:471-475 | crates/zeroclaw-hardware/src/device.rs:491-495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/device.rs:471` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) REDACTED:1000— REDACTED:1000-1004 | REDACTED:1102-1106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1000` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) REDACTED:1438— REDACTED:1438-1442 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:685-689 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1438` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) REDACTED:1465— REDACTED:1465-1469 | crates/zeroclaw-memory/src/sqlite.rs:1216-1220 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1465` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-infra/src/net_guard.rs:583— crates/zeroclaw-infra/src/net_guard.rs:583-587 | crates/zeroclaw-infra/src/net_guard.rs:608-615 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-infra/src/net_guard.rs:583` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-memory/src/sqlite.rs:1684— crates/zeroclaw-memory/src/sqlite.rs:1684-1688 | crates/zeroclaw-memory/src/sqlite.rs:1730-1734 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1684` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:2527— crates/zeroclaw-providers/src/anthropic.rs:2527-2532 | crates/zeroclaw-runtime/src/agent/turn/stream_consume.rs:242-246 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/anthropic.rs:2527` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:177— crates/zeroclaw-runtime/src/cron/store.rs:177-181 | crates/zeroclaw-runtime/src/cron/store.rs:240-244 — both copies are in the same file, so extract the block into 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/tauri/src/daemon.rs:427` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) apps/zerocode/src/chat.rs:7805— apps/zerocode/src/chat.rs:7805-7815 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/chat.rs:7805` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) apps/zerocode/src/client.rs:1781— apps/zerocode/src/client.rs:1781-1791 | apps/zerocode/src/client.rs:2084-2094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/client.rs:1781` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/zerocode/src/client.rs:1780` calls `lines` and `apps/zerocode/src/client.rs:2083` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) apps/zerocode/src/config_manager.rs:5548— apps/zerocode/src/config_manager.rs:5548-5558 | apps/zerocode/src/config_manager.rs:5641-5651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:5548` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 2) apps/zerocode/src/config_manager.rs:5610— apps/zerocode/src/config_manager.rs:5610-5620 | apps/zerocode/src/config_manager.rs:5699-5709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:5610` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) apps/zerocode/src/main.rs:989— apps/zerocode/src/main.rs:989-999 | apps/zerocode/src/main.rs:1042-1052 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:1366` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:3117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2473— crates/zeroclaw-channels/src/discord/mod.rs:2473-2483 | crates/zeroclaw-channels/src/discord/mod.rs:2665-2675 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2473` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:3812— crates/zeroclaw-channels/src/discord/mod.rs:3812-3822 | crates/zeroclaw-channels/src/discord/mod.rs:3850-3860 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:3812` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/login_probe.rs:45` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/matrix.rs:764— crates/zeroclaw-channels/src/matrix.rs:764-774 | crates/zeroclaw-channels/src/orchestrator/mod.rs:8461-8471 — 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 7 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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:1532-1542 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:5479` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:4472— crates/zeroclaw-channels/src/orchestrator/mod.rs:4472-4482 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4508-4518 — both copies are in the same file, so extract the block into 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:11233— crates/zeroclaw-channels/src/orchestrator/mod.rs:11233-11243 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11251-11261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:11233` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:15114— crates/zeroclaw-channels/src/orchestrator/mod.rs:15114-15124 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16250-16260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:15114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:1592` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:2813` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:3080` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/util.rs:139` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wecom_ws.rs:947` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) crates/zeroclaw-config/src/policy.rs:4387— crates/zeroclaw-config/src/policy.rs:4387-4397 | crates/zeroclaw-config/src/policy.rs:4587-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/policy.rs:4387` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) crates/zeroclaw-config/src/schema.rs:27684— crates/zeroclaw-config/src/schema.rs:27684-27698 | crates/zeroclaw-config/src/schema.rs:27944-27954 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-config/src/schema.rs:27677` calls `Some` and `crates/zeroclaw-config/src/schema.rs:27943` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) crates/zeroclaw-config/src/schema/v2.rs:3293— crates/zeroclaw-config/src/schema/v2.rs:3293-3303 | crates/zeroclaw-config/src/schema/v2.rs:3341-3351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema/v2.rs:3293` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/tauri/src/macos/permissions.rs:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) apps/zerocode/src/chat.rs:4106— apps/zerocode/src/chat.rs:4106-4117 | apps/zerocode/src/chat.rs:4363-4374 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/chat.rs:4106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:1582` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) apps/zerocode/src/enroll.rs:465— apps/zerocode/src/enroll.rs:465-476 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/enroll.rs:465` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:1871` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:3158` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/acp_channel.rs:193` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/bluesky.rs:498— crates/zeroclaw-channels/src/bluesky.rs:498-509 | crates/zeroclaw-channels/src/mattermost.rs:1046-1057 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/mattermost.rs` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:498` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1528— crates/zeroclaw-channels/src/discord/mod.rs:1528-1539 | crates/zeroclaw-channels/src/telegram.rs:701-712 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2052— crates/zeroclaw-channels/src/discord/mod.rs:2052-2063 | crates/zeroclaw-channels/src/qq.rs:1424-1435 — 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 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2052` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3000` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3020` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) 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 8 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3355` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:1576` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/nostr.rs:239` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:17094— crates/zeroclaw-channels/src/orchestrator/mod.rs:17094-17105 | crates/zeroclaw-gateway/src/lib.rs:2093-2104 — 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 10 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:17094` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:17358— crates/zeroclaw-channels/src/orchestrator/mod.rs:17358-17369 | crates/zeroclaw-runtime/src/tools/delegate.rs:5646-5657 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:1578` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:4761` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) crates/zeroclaw-channels/src/slack.rs:6249— crates/zeroclaw-channels/src/slack.rs:6249-6260 | crates/zeroclaw-channels/src/telegram.rs:9100-9111 — before extracting anything, compare `crates/zeroclaw-channels/src/slack.rs` and `crates/zeroclaw-channels/src/telegram.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. Note first that the copies are not typed on the same thing: the declarations holding them bind `request` to `&ChannelApprovalRequest` in one and `&zeroclaw_api::channel::ChannelApprovalRequest` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Repeated repair: crates/zeroclaw-runtime/src/i18n.rs crates/zeroclaw-runtime/src/i18n.rs:209— crates/zeroclaw-runtime/src/i18n.rs changed 25 times in last 90 days and 17 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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-providers/src/lib.rs crates/zeroclaw-providers/src/lib.rs:1568— crates/zeroclaw-providers/src/lib.rs changed 29 times in last 90 days and 16 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is zeroclaw_providers::create_model_provider_inner at line 1568), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mcp): relocate tool-result images to a user message (OpenAI-compatible 400) (#10502)”; “fix(tools): declare tool attachments explicitly instead of scanning tool text for image markers (#10938)”; “fix(multimodal): add pixel-level image validation to prevent corrupt images from failing provider requests (#9819)”; “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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-providers/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: crates/zeroclaw-runtime/src/agent/turn/vision_route.rs crates/zeroclaw-runtime/src/agent/turn/vision_route.rs:104— crates/zeroclaw-runtime/src/agent/turn/vision_route.rs changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is zeroclaw_runtime::agent::turn::vision_route::resolve_vision_provider_with_allowed_refs at line 104), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(config): migrate retired keys at schema version 4 and warn on a missing schema_version (#11218)”; “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)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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: apps/zerocode/src/i18n.rs apps/zerocode/src/i18n.rs:132— apps/zerocode/src/i18n.rs changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is zerocode::i18n::format_ftl_messages at line 132), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): honour keep_tool_context_turns when building provider requests (#11297)”; “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)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-channels/src/tts.rs crates/zeroclaw-channels/src/tts.rs:1097— crates/zeroclaw-channels/src/tts.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 10 (its worst body is TtsManager::from_config_for_agent at line 1097), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-config/src/pairing.rs crates/zeroclaw-config/src/pairing.rs:747— crates/zeroclaw-config/src/pairing.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 PairingGuard::reserve_pair_blocking at line 747), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(security): enforce cron approval and authority at the write across RPC, tools and token revocation (#11149)”; “fix(gateway): enforce the [gateway.pairing_dashboard] pairing limits (#12213)”; “fix(config): migrate retired keys at schema version 4 and warn on a missing schema_version (#11218)”; “fix(enroll): redeem enrollment codes on the daemon's canonical pairing guard (#11940)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-config/src/pairing.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/cron/mod.rs crates/zeroclaw-runtime/src/cron/mod.rs:511— crates/zeroclaw-runtime/src/cron/mod.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 7 (its worst body is zeroclaw_runtime::cron::parse_delay at line 511), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(security): enforce cron approval and authority at the write across RPC, tools and token revocation (#11149)”; “fix(security): withhold principal-unaware tools and SOP execution from non-admin principals (#12232)”; “fix(cron): guard agent manual trigger and history (#10414)”; “fix(cron): make agent-scoped cron mutations atomic (#10177)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/cron/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-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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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/service/mod.rs crates/zeroclaw-runtime/src/service/mod.rs:475— crates/zeroclaw-runtime/src/service/mod.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 10 (its worst body is zeroclaw_runtime::service::enforce_windows_private_acl at line 475), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-infra/src/session_store.rs crates/zeroclaw-infra/src/session_store.rs:117— crates/zeroclaw-infra/src/session_store.rs changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is SessionStore::load at line 117), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rpc): hold current authority through session effects (#12239)”; “fix(rpc): judge queued session ownership by current authority (#11234)”; “fix(infra): replace JSONL session files that a reader holds open on Windows (#11398)”; “fix(infra): align JSONL session file validation (#9873)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-runtime/src/agent/history_trim.rs crates/zeroclaw-runtime/src/agent/history_trim.rs:518— crates/zeroclaw-runtime/src/agent/history_trim.rs changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is zeroclaw_runtime::agent::history_trim::collapse_tool_context_older_than at line 518), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): honour keep_tool_context_turns when building provider requests (#11297)”; “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(runtime): trim history to a low-water target instead of the cap (#10696)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/agent/history_trim.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 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is zeroclaw_runtime::security::detect::create_selected_sandbox at line 576), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-runtime/src/tools/cron_update.rs crates/zeroclaw-runtime/src/tools/cron_update.rs:223— crates/zeroclaw-runtime/src/tools/cron_update.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 8 (its worst body is CronUpdateTool::execute at line 223), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(security): enforce cron approval and authority at the write across RPC, tools and token revocation (#11149)”; “fix(security): withhold principal-unaware tools and SOP execution from non-admin principals (#12232)”; “fix(cron): make agent-scoped cron mutations atomic (#10177)”; “fix(cron): scope the cron tools to the calling agent (#9948)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/tools/cron_update.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: REDACTED REDACTED:630— REDACTED changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is zeroclaw_config::migration::unversioned_shape at line 630), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(gateway): enforce the [gateway.pairing_dashboard] pairing limits (#12213)”; “fix(config): migrate retired keys at schema version 4 and warn on a missing schema_version (#11218)”; “fix(config): bind degraded remediation to running executable (#10630)”; “fix(config): migrate bare vision_model_provider to dotted alias ref (#9707)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: crates/zeroclaw-config/src/validation_warnings.rs crates/zeroclaw-config/src/validation_warnings.rs:141— crates/zeroclaw-config/src/validation_warnings.rs changed 9 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 5 (its worst body is zeroclaw_config::validation_warnings::levenshtein_distance at line 141), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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/sop/store/sqlite.rs crates/zeroclaw-runtime/src/sop/store/sqlite.rs:206— crates/zeroclaw-runtime/src/sop/store/sqlite.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 6 (its worst body is SqliteRunStore::save_run_with_pending_capacity at line 206), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(security): withhold principal-unaware tools and SOP execution from non-admin principals (#12232)”; “fix(memory): keep owned-session subagent and pipeline memory private (#11266)”; “fix(sop): keep a stale run copy from reviving or overwriting a run (#11861)”; “fix(sop): drive headless SOP runs, and close the five defects found reviewing #9494 (#9841)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/sop/store/sqlite.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/sop/store/mod.rs crates/zeroclaw-runtime/src/sop/store/mod.rs:195— crates/zeroclaw-runtime/src/sop/store/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 7 (its worst body is StoreError::fmt at line 195), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(security): withhold principal-unaware tools and SOP execution from non-admin principals (#12232)”; “fix(memory): keep owned-session subagent and pipeline memory private (#11266)”; “fix(sop): keep a stale run copy from reviving or overwriting a run (#11861)”; “fix(sop): drive headless SOP runs, and close the five defects found reviewing #9494 (#9841)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/sop/store/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-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), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-tools/src/image_gen.rs crates/zeroclaw-tools/src/image_gen.rs:25— crates/zeroclaw-tools/src/image_gen.rs changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is zeroclaw_tools::image_gen::parse_public_https_url at line 25), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-runtime/src/live_config_authority.rs crates/zeroclaw-runtime/src/live_config_authority.rs:830— crates/zeroclaw-runtime/src/live_config_authority.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is ConfigOwnershipGuard::acquire at line 830), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(config): prefix dash-leading lifecycle remedy paths with ./ (#12172)”; “fix(security): withhold principal-unaware tools and SOP execution from non-admin principals (#12232)”; “fix(runtime): settle session turns a killed process left marked running (#11523)”; “fix(config): move the lifecycle lock into an owner-only data/.lifecycle directory (#11803)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/live_config_authority.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 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is RouterModelProvider::resolve_cost_optimized at line 224), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(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-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +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-runtime/src/rpc/attachments.rs crates/zeroclaw-runtime/src/rpc/attachments.rs:299— crates/zeroclaw-runtime/src/rpc/attachments.rs changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is zeroclaw_runtime::rpc::attachments::load_file_entry at line 299), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(rpc): refuse a directory attachment by type on Windows (#11361)”; “fix(multimodal): add pixel-level image validation to prevent corrupt images from failing provider requests (#9819)”; “fix(runtime): decide attachment image markers by the provider-loadable contract (#10582)”; “fix(multimodal): preserve attached images after source removal (#10088)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 20:48:37 +00:00' --until='2026-11-13 20:48:37 +00:00' --full-history --no-merges -- crates/zeroclaw-runtime/src/rpc/attachments.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:903— ClassTooLong — 8235 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 241 methods, 4 blocks, lines 903-13823. The bar is 400 significant lines; this is 7835 over it, 20.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: SopEngine crates/zeroclaw-runtime/src/sop/engine.rs:31— ClassTooLong — 4150 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 203 methods, 2 blocks, lines 31-6930. The bar is 400 significant lines; this is 3750 over it, 10.38× 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:456— ClassTooLong — 4143 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 140 methods, 5 blocks, lines 456-6430. The bar is 400 significant lines; this is 3743 over it, 10.36× 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:150— ClassTooLong — 3492 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 101 methods, 5 blocks, lines 150-27171. The bar is 400 significant lines; this is 3092 over it, 8.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.
ClassTooLong: DelegateTool crates/zeroclaw-runtime/src/tools/delegate.rs:425— ClassTooLong — 3480 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 115 methods, 5 blocks, lines 425-5883. The bar is 400 significant lines; this is 3080 over it, 8.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.
ClassTooLong: DiscordChannel crates/zeroclaw-channels/src/discord/mod.rs:69— ClassTooLong — 2163 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-4229. The bar is 400 significant lines; this is 1763 over it, 5.41× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: AcpSessionStore REDACTED:70— ClassTooLong — 2139 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 82 methods, 2 blocks, lines 70-3224. The bar is 400 significant lines; this is 1739 over it, 5.35× 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 — 2106 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 54 methods, 5 blocks, lines 48-5384. The bar is 400 significant lines; this is 1706 over it, 5.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
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: AcpServer crates/zeroclaw-channels/src/orchestrator/acp_server.rs:128— ClassTooLong — 1956 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-3263. The bar is 400 significant lines; this is 1556 over it, 4.89× 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-3607. 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: SqliteSessionBackend crates/zeroclaw-infra/src/session_sqlite.rs:20— ClassTooLong — 1323 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 18 methods, 3 blocks, lines 20-1902. The bar is 400 significant lines; this is 923 over it, 3.31× 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:721— ClassTooLong — 1212 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 721-2634. The bar is 400 significant lines; this is 812 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: ModelRoutingConfigTool crates/zeroclaw-tools/src/model_routing_config.rs:83— ClassTooLong — 1174 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 33 methods, 3 blocks, lines 83-1800. The bar is 400 significant lines; this is 774 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: 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 — 1097 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 63 methods, 2 blocks, lines 137-1937. The bar is 400 significant lines; this is 697 over it, 2.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: Logs apps/zerocode/src/logs.rs:534— ClassTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 53 methods, 3 blocks, lines 534-2059. The bar is 400 significant lines; this is 651 over it, 2.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.
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.
Duplicated block (13 lines × 2) apps/zerocode/src/client.rs:1867— apps/zerocode/src/client.rs:1867-1879 | apps/zerocode/src/client.rs:2161-2173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/client.rs:1867` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) apps/zerocode/src/jsonrpc.rs:234— apps/zerocode/src/jsonrpc.rs:234-246 | crates/zeroclaw-api/src/jsonrpc.rs:380-392 — before extracting anything, compare `apps/zerocode/src/jsonrpc.rs` and `crates/zeroclaw-api/src/jsonrpc.rs` as WHOLE FILES: this scan already matched 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/jsonrpc.rs:234` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) apps/zerocode/src/logs.rs:1660— apps/zerocode/src/logs.rs:1660-1672 | apps/zerocode/src/logs.rs:1729-1741 — both copies are in the same file, so extract the block into 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-api/src/elicitation.rs:133` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:1874` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/lark.rs:2010` calls `file_download_url` and `crates/zeroclaw-channels/src/lark.rs:1872` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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 9 separate duplicated blocks between them, totalling at least 115 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mochat.rs:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13493— crates/zeroclaw-channels/src/orchestrator/mod.rs:13493-13505 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15256-15268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:15255` calls `channel_workspace_dir` and `crates/zeroclaw-channels/src/orchestrator/mod.rs:13492` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) crates/zeroclaw-channels/src/telegram.rs:8362— crates/zeroclaw-channels/src/telegram.rs:8362-8374 | crates/zeroclaw-channels/src/telegram.rs:8388-8400 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:8362` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/zeroclaw-config/src/schema.rs:22260— crates/zeroclaw-config/src/schema.rs:22260-22272 | crates/zeroclaw-config/src/schema.rs:22275-22287 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_sop_author.rs:441` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/zeroclaw-gateway/src/lib.rs:498— crates/zeroclaw-gateway/src/lib.rs:498-510 | crates/zeroclaw-gateway/src/lib.rs:532-544 — both copies are in the same file, so extract the block into 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/azure_openai.rs:589— crates/zeroclaw-providers/src/azure_openai.rs:589-601 | crates/zeroclaw-providers/src/openai.rs:542-554 — 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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:589` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) 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 17 separate duplicated blocks between them, totalling at least 164 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) 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 4 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. 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:4537— crates/zeroclaw-runtime/src/agent/agent.rs:4537-4549 | crates/zeroclaw-runtime/src/agent/agent.rs:5100-5112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:4537` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:4669— crates/zeroclaw-runtime/src/agent/agent.rs:4669-4681 | crates/zeroclaw-runtime/src/agent/agent.rs:5328-5340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:4669` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-runtime/src/agent/agent.rs:5342` calls `take` and `crates/zeroclaw-runtime/src/agent/agent.rs:4682` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:396— crates/zeroclaw-runtime/src/agent/loop_.rs:396-408 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:3098— crates/zeroclaw-runtime/src/agent/turn/mod.rs:3098-3110 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3130-3142 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/turn/mod.rs:3098` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:183` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/hooks/runner.rs:199— crates/zeroclaw-runtime/src/hooks/runner.rs:199-211 | crates/zeroclaw-runtime/src/hooks/runner.rs:258-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/hooks/runner.rs:199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:6132— crates/zeroclaw-runtime/src/rpc/dispatch.rs:6132-6144 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6146-6158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:6132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) crates/zeroclaw-runtime/src/rpc/session.rs:1819— crates/zeroclaw-runtime/src/rpc/session.rs:1819-1831 | crates/zeroclaw-runtime/src/rpc/session.rs:2602-2614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/session.rs:1819` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
zeroclaw_channels::orchestrator::process_channel_message_body (cognitive 347) crates/zeroclaw-channels/src/orchestrator/mod.rs:9281— zeroclaw_channels::orchestrator::process_channel_message_body has cognitive complexity 347 (threshold 15). Drivers by points: if/else 138 (254 pts), match/switch 18 (43 pts), boolean chains 40, loops 4 (10 pts) (nesting depth added 147). To reduce it, split the body into named stages: move each independent 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:14744— 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:17020— 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:12325— 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:5262— 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:1213— 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:8960— 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:7558— 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:11925— 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::whatsapp_web::markdown_to_whatsapp (cognitive 32) crates/zeroclaw-channels/src/whatsapp_web.rs:3201— zeroclaw_channels::whatsapp_web::markdown_to_whatsapp has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 6, 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_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:3532— 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:6467— 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:13035— 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_config::policy::scan_unquoted_segments (cognitive 201) crates/zeroclaw-config/src/policy.rs:1614— zeroclaw_config::policy::scan_unquoted_segments has cognitive complexity 201 (threshold 15). Drivers by points: if/else 45 (140 pts), boolean chains 31, match/switch 6 (24 pts), loops 3 (6 pts) (nesting depth added 116). To reduce it, split the body into named stages: move each independent 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:2193— 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:1982— 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:3216— 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:3795— 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:3640— 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:1019— 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:992— 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::alias_refs::collect_agent_refs (cognitive 39) crates/zeroclaw-config/src/alias_refs.rs:1227— zeroclaw_config::alias_refs::collect_agent_refs has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 8 (13 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_config::schema::v2::fold_providers_globals_into_models (cognitive 39) crates/zeroclaw-config/src/schema/v2.rs:1285— 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::policy::read_heredoc_delimiter (cognitive 36) crates/zeroclaw-config/src/policy.rs:1359— zeroclaw_config::policy::read_heredoc_delimiter has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 6, 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.
zeroclaw_config::alias_refs::collect_channel_refs (cognitive 34) crates/zeroclaw-config/src/alias_refs.rs:1129— 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:3133— 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:2297— 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::rewrite_agent_refs (cognitive 33) crates/zeroclaw-config/src/alias_refs.rs:712— zeroclaw_config::alias_refs::rewrite_agent_refs has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 7 (11 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.
zeroclaw_config::schema::validate_mcp_config (cognitive 30) crates/zeroclaw-config/src/schema.rs:11633— 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:799— 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:2948— 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:3002— 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:619— 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::migration::lower_capped_keys (cognitive 25) REDACTED:2695— zeroclaw_config::migration::lower_capped_keys has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 3 (6 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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::migration::use_written_spellings (cognitive 24) REDACTED:824— zeroclaw_config::migration::use_written_spellings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zeroclaw_runtime::agent::turn::run_tool_call_loop_impl (cyclomatic 158) crates/zeroclaw-runtime/src/agent/turn/mod.rs:1657— zeroclaw_runtime::agent::turn::run_tool_call_loop_impl has cyclomatic complexity 158 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::loop_::run_inner (cyclomatic 119) crates/zeroclaw-runtime/src/agent/loop_.rs:1620— zeroclaw_runtime::agent::loop_::run_inner has cyclomatic complexity 119 (threshold 15). To reduce it, separate the cases: extract each independent 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 111) crates/zeroclaw-runtime/src/tools/mod.rs:2306— zeroclaw_runtime::tools::all_tools_with_runtime_on_thread has cyclomatic complexity 111 (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 58) crates/zeroclaw-runtime/src/sop/dispatch.rs:688— zeroclaw_runtime::sop::dispatch::dispatch_sop_event_filtered has cyclomatic complexity 58 (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 47) crates/zeroclaw-runtime/src/daemon/mod.rs:715— zeroclaw_runtime::daemon::run_with_authority has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
zeroclaw_runtime::agent::turn::drive_live_sop_actions (cyclomatic 46) crates/zeroclaw-runtime/src/agent/turn/mod.rs:4330— zeroclaw_runtime::agent::turn::drive_live_sop_actions has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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::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:2473— 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 34) crates/zeroclaw-runtime/src/agent/loop_.rs:3753— zeroclaw_runtime::agent::loop_::process_message_inner has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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::agent::turn::call_prep::prepare_tool_calls (cyclomatic 27) crates/zeroclaw-runtime/src/agent/turn/call_prep.rs:168— zeroclaw_runtime::agent::turn::call_prep::prepare_tool_calls 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::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::sop::executor::drive_headless_run (cyclomatic 25) crates/zeroclaw-runtime/src/sop/executor.rs:932— zeroclaw_runtime::sop::executor::drive_headless_run has cyclomatic complexity 25 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
zeroclaw_runtime::skills::parse_simple_frontmatter (cyclomatic 22) crates/zeroclaw-runtime/src/skills/mod.rs:1558— 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::cron::store::update_job_authorized (cyclomatic 21) crates/zeroclaw-runtime/src/cron/store.rs:786— zeroclaw_runtime::cron::store::update_job_authorized 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.
TooManyMethods: RpcDispatcher crates/zeroclaw-runtime/src/rpc/dispatch.rs:903— TooManyMethods — 241 methods. The bar is 30 methods; this is 211 over it, 8.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.
TooManyMethods: SopEngine crates/zeroclaw-runtime/src/sop/engine.rs:31— TooManyMethods — 203 methods. The bar is 30 methods; this is 173 over it, 6.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: TelegramChannel crates/zeroclaw-channels/src/telegram.rs:1101— TooManyMethods — 177 methods. The bar is 30 methods; this is 147 over it, 5.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: 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:10054— TooManyMethods — 140 methods. The bar is 30 methods; this is 110 over it, 4.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: App apps/zerocode/src/config_manager.rs:456— TooManyMethods — 140 methods. The bar is 30 methods; this is 110 over it, 4.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: Chat apps/zerocode/src/chat.rs:519— TooManyMethods — 123 methods. The bar is 30 methods; this is 93 over it, 4.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.
TooManyMethods: DelegateTool crates/zeroclaw-runtime/src/tools/delegate.rs:425— TooManyMethods — 115 methods. The bar is 30 methods; this is 85 over it, 3.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Agent crates/zeroclaw-runtime/src/agent/agent.rs:541— TooManyMethods — 106 methods. The bar is 30 methods; this is 76 over it, 3.53× 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:358— TooManyMethods — 105 methods. The bar is 30 methods; this is 75 over it, 3.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: Config crates/zeroclaw-config/src/schema.rs:150— TooManyMethods — 101 methods. The bar is 30 methods; this is 71 over it, 3.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: RpcClient apps/zerocode/src/client.rs:897— 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: AcpSessionStore REDACTED:70— TooManyMethods — 82 methods. The bar is 30 methods; this is 52 over it, 2.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: InputBarState apps/zerocode/src/input_bar.rs:721— 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 — 63 methods. The bar is 30 methods; this is 33 over it, 2.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.
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: OpenAiCompatibleModelProvider crates/zeroclaw-providers/src/compatible.rs:48— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× 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: 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.
Duplicated block (14 lines × 2) apps/zerocode/src/config_manager.rs:2903— apps/zerocode/src/config_manager.rs:2903-2916 | apps/zerocode/src/config_manager.rs:3025-3038 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:2903` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) apps/zerocode/src/jsonrpc.rs:248— apps/zerocode/src/jsonrpc.rs:248-261 | crates/zeroclaw-api/src/jsonrpc.rs:404-417 — before extracting anything, compare `apps/zerocode/src/jsonrpc.rs` and `crates/zeroclaw-api/src/jsonrpc.rs` as WHOLE FILES: this scan already matched 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/jsonrpc.rs:248` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/acp_channel.rs:98` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2647— crates/zeroclaw-channels/src/discord/mod.rs:2647-2660 | crates/zeroclaw-channels/src/discord/mod.rs:3059-3072 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2647` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1124— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1124-1137 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1473-1486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-channels/src/telegram.rs:978— crates/zeroclaw-channels/src/telegram.rs:978-991 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:978` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wecom_ws.rs:1207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) 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:688— crates/zeroclaw-infra/src/session_sqlite.rs:688-701 | crates/zeroclaw-infra/src/session_sqlite.rs:872-885 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-infra/src/session_sqlite.rs:688` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/knowledge_graph.rs:489` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:772` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-memory/src/sqlite.rs:771` calls `IN` and `crates/zeroclaw-memory/src/sqlite.rs:926` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1271` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/auth/mod.rs:1847` calls `clear_pending_oauth_login` and `crates/zeroclaw-providers/src/auth/mod.rs:1783` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1783` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/auth/mod.rs:1847` calls `clear_pending_oauth_login` and `crates/zeroclaw-providers/src/auth/mod.rs:1782` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) crates/zeroclaw-providers/src/lib.rs:410— crates/zeroclaw-providers/src/lib.rs:410-423 | crates/zeroclaw-providers/src/lib.rs:555-568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/lib.rs:410` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:1973— crates/zeroclaw-runtime/src/agent/agent.rs:1973-1986 | crates/zeroclaw-runtime/src/agent/agent.rs:4441-4454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:1973` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:3105— crates/zeroclaw-runtime/src/skills/mod.rs:3105-3118 | crates/zeroclaw-runtime/src/skills/mod.rs:3320-3333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:3105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:3282— crates/zeroclaw-runtime/src/skills/mod.rs:3282-3295 | crates/zeroclaw-runtime/src/skills/mod.rs:3404-3417 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:3282` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:5498— crates/zeroclaw-runtime/src/sop/engine.rs:5498-5511 | crates/zeroclaw-runtime/src/sop/engine.rs:5590-5603 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:5498` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:3219— crates/zeroclaw-runtime/src/tools/delegate.rs:3219-3232 | crates/zeroclaw-runtime/src/tools/delegate.rs:3555-3568 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:3219` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:1169— crates/zeroclaw-tool-call-parser/src/lib.rs:1169-1182 | crates/zeroclaw-tool-call-parser/src/lib.rs:1328-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tool-call-parser/src/lib.rs:1169` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:2349— crates/zeroclaw-tool-call-parser/src/lib.rs:2349-2362 | crates/zeroclaw-tool-call-parser/src/lib.rs:2397-2410 — both copies are in the same file, so extract the block into 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-tools/src/backup_tool.rs:1032— crates/zeroclaw-tools/src/backup_tool.rs:1032-1045 | crates/zeroclaw-tools/src/backup_tool.rs:1072-1085 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/backup_tool.rs:1032` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-tools/src/backup_tool.rs:1069` calls `join` and `crates/zeroclaw-tools/src/backup_tool.rs:1029` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:856` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:2266` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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:1550-1555 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2430-2435 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1210` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:6534— crates/zeroclaw-channels/src/orchestrator/mod.rs:6534-6539 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6553-6561 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6584-6589 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:6534` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:16796— crates/zeroclaw-channels/src/orchestrator/mod.rs:16796-16801 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16822-16827 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:16796` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-gateway/src/api_plugins.rs:168— crates/zeroclaw-gateway/src/api_plugins.rs:168-173 | crates/zeroclaw-gateway/src/api_plugins.rs:237-242 | crates/zeroclaw-gateway/src/api_plugins.rs:258-263 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_plugins.rs:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-gateway/src/lib.rs:1453— crates/zeroclaw-gateway/src/lib.rs:1453-1458 | crates/zeroclaw-runtime/src/cron/scheduler.rs:670-675 | crates/zeroclaw-runtime/src/cron/scheduler.rs:719-724 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:1453` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) REDACTED:1381— REDACTED:1381-1386 | REDACTED:1463-1468 | REDACTED:3017-3022 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1381` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-memory/src/sqlite.rs:1034— crates/zeroclaw-memory/src/sqlite.rs:1034-1039 | crates/zeroclaw-memory/src/sqlite.rs:1697-1702 | crates/zeroclaw-memory/src/sqlite.rs:2523-2528 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1034` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:1361— crates/zeroclaw-providers/src/auth/mod.rs:1361-1366 | crates/zeroclaw-providers/src/auth/mod.rs:1382-1387 | crates/zeroclaw-providers/src/gemini.rs:415-420 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1361` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3420— crates/zeroclaw-runtime/src/rpc/dispatch.rs:3420-3425 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:3456-3461 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:3478-3483 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:3420` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/sop/dispatch.rs:708— crates/zeroclaw-runtime/src/sop/dispatch.rs:708-713 | crates/zeroclaw-runtime/src/sop/dispatch.rs:770-775 | crates/zeroclaw-runtime/src/sop/dispatch.rs:820-825 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/dispatch.rs:708` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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:6488-6495 | crates/zeroclaw-runtime/src/sop/engine.rs:6544-6550 — 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/tunnel/cloudflare.rs:70— crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:70-75 | crates/zeroclaw-runtime/src/tunnel/openvpn.rs:71-76 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:81-86 — before extracting anything, compare `crates/zeroclaw-runtime/src/tunnel/cloudflare.rs` and `crates/zeroclaw-runtime/src/tunnel/openvpn.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-runtime/src/tunnel/ngrok.rs:57— crates/zeroclaw-runtime/src/tunnel/ngrok.rs:57-62 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:69-74 | crates/zeroclaw-tools/src/mcp_transport.rs:642-647 — before extracting anything, compare `crates/zeroclaw-runtime/src/tunnel/ngrok.rs` and `crates/zeroclaw-runtime/src/tunnel/pinggy.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tunnel/ngrok.rs:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/backup_tool.rs:1148` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/cloud_ops.rs:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-tools/src/knowledge_tool.rs:163— crates/zeroclaw-tools/src/knowledge_tool.rs:163-169 | crates/zeroclaw-tools/src/knowledge_tool.rs:177-182 | crates/zeroclaw-tools/src/knowledge_tool.rs:192-198 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/knowledge_tool.rs:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) crates/zeroclaw-tools/src/knowledge_tool.rs:334— crates/zeroclaw-tools/src/knowledge_tool.rs:334-340 | crates/zeroclaw-tools/src/knowledge_tool.rs:348-353 | crates/zeroclaw-tools/src/knowledge_tool.rs:363-369 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/knowledge_tool.rs:334` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) 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 47 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) src/main.rs:14590— src/main.rs:14590-14595 | src/main.rs:14657-14662 | src/main.rs:14789-14794 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/main.rs:14590` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/main.rs:14656` calls `query`, `as_str`, `to_string` and `src/main.rs:14589` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) apps/zerocode/src/enroll.rs:220— apps/zerocode/src/enroll.rs:220-225 | crates/zeroclaw-runtime/src/enroll/mod.rs:631-636 | 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:178— xtask/src/generate/mod.rs:178-183 | 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:398— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:398-403 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:413-418 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:448-457 — 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.
+ 9 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×32
Edited copy of a member (10 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:4835— crates/zeroclaw-channels/src/matrix.rs:4835-4844 | crates/zeroclaw-channels/src/matrix.rs:4846-4855 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-runtime/src/plugin_state.rs:281— crates/zeroclaw-runtime/src/plugin_state.rs:281-292 | crates/zeroclaw-runtime/src/plugin_state.rs:581-590 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-config/src/schema.rs:22479— crates/zeroclaw-config/src/schema.rs:22479-22488 | crates/zeroclaw-config/src/schema.rs:22490-22504 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-runtime/src/tools/sop_workshop.rs:232— crates/zeroclaw-runtime/src/tools/sop_workshop.rs:232-241 | crates/zeroclaw-runtime/src/tools/sop_workshop.rs:300-309 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-tls/src/certgen.rs:50— crates/zeroclaw-tls/src/certgen.rs:50-61 | crates/zeroclaw-tls/src/certgen.rs:74-83 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-channels/src/discord/markers.rs:961— crates/zeroclaw-channels/src/discord/markers.rs:961-976 | crates/zeroclaw-channels/src/matrix.rs:3221-3230 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-config/src/schema/v2.rs:4— crates/zeroclaw-config/src/schema/v2.rs:4-15 | crates/zeroclaw-providers/src/lib.rs:1533-1542 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) apps/zerocode/src/oidc_enroll.rs:70— apps/zerocode/src/oidc_enroll.rs:70-79 | crates/zeroclaw-runtime/src/security/auth_provider/enrollment.rs:57-72 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) REDACTED:1202— REDACTED:1202-1212 | crates/zeroclaw-runtime/src/security/cert_ledger.rs:1409-1418 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-config/src/typed_value.rs:181— crates/zeroclaw-config/src/typed_value.rs:181-190 | crates/zeroclaw-tools/src/llm_task.rs:316-325 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) apps/zerocode/src/config_manager.rs:1363— apps/zerocode/src/config_manager.rs:1363-1372 | apps/zerocode/src/zerocode_pane.rs:1260-1269 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-runtime/src/i18n.rs:124— crates/zeroclaw-runtime/src/i18n.rs:124-133 | crates/zeroclaw-tools/src/i18n.rs:151-160 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-runtime/src/sop/dispatch.rs:1525— crates/zeroclaw-runtime/src/sop/dispatch.rs:1525-1535 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1552-1561 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-tools/src/channel_room.rs:295— crates/zeroclaw-tools/src/channel_room.rs:295-307 | crates/zeroclaw-tools/src/channel_room.rs:309-318 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) REDACTED:876— REDACTED:876-885 | REDACTED:887-896 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-channels/src/discord/markers.rs:978— crates/zeroclaw-channels/src/discord/markers.rs:978-987 | crates/zeroclaw-channels/src/slack.rs:1779-1795 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-tools/src/coding_cli.rs:189— crates/zeroclaw-tools/src/coding_cli.rs:189-198 | crates/zeroclaw-tools/src/coding_cli.rs:208-217 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs:128— crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs:128-137 | crates/zeroclaw-tools/src/http_request.rs:818-829 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-runtime/src/service/mod.rs:3342— crates/zeroclaw-runtime/src/service/mod.rs:3342-3354 | crates/zeroclaw-runtime/src/service/mod.rs:3356-3365 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-config/src/schema/v2.rs:2251— crates/zeroclaw-config/src/schema/v2.rs:2251-2260 | crates/zeroclaw-config/src/schema/v2.rs:2434-2443 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-providers/src/dispatch/accounting.rs:246— crates/zeroclaw-providers/src/dispatch/accounting.rs:246-255 | crates/zeroclaw-providers/src/dispatch/accounting.rs:257-266 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-providers/src/compatible.rs:3934— crates/zeroclaw-providers/src/compatible.rs:3934-3943 | crates/zeroclaw-providers/src/compatible.rs:3945-3954 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) src/plugins/channel_instance.rs:776— src/plugins/channel_instance.rs:776-786 | crates/zeroclaw-memory/src/sqlite.rs:841-850 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-api/src/media.rs:322— crates/zeroclaw-api/src/media.rs:322-331 | crates/zeroclaw-channels/src/slack.rs:3242-3251 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) crates/zeroclaw-tools/src/git_forge.rs:728— crates/zeroclaw-tools/src/git_forge.rs:728-737 | xtask/src/cmd/mdbook/keymap.rs:30-39 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
zeroclaw::async_main_inner (cognitive 907) src/main.rs:9633— zeroclaw::async_main_inner has cognitive complexity 907 (threshold 15). Drivers by points: if/else 246 (584 pts), match/switch 60 (185 pts), loops 36 (111 pts), boolean chains 27 (nesting depth added 538). To reduce it, split the body into named stages: move each independent 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:1847— 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:6481— 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:9224— 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:15571— 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:4769— 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:8225— 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:6880— 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:1124— 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:14580— 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:3354— 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:14224— 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:15409— 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:4228— 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 (7 lines × 3) crates/zeroclaw-channels/src/gmail_push.rs:207— crates/zeroclaw-channels/src/gmail_push.rs:207-215 | crates/zeroclaw-channels/src/gmail_push.rs:593-601 | crates/zeroclaw-channels/src/linq.rs:344-350 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/gmail_push.rs:207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/line.rs:568— crates/zeroclaw-channels/src/line.rs:568-577 | crates/zeroclaw-channels/src/telegram.rs:4882-4888 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:568` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/nextcloud_talk.rs:751— crates/zeroclaw-channels/src/nextcloud_talk.rs:751-758 | crates/zeroclaw-channels/src/telegram.rs:8433-8439 | src/commands/update.rs:394-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/nextcloud_talk.rs:751` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 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:1481-1487 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1763-1769 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:2185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/telegram.rs:2335— crates/zeroclaw-channels/src/telegram.rs:2335-2341 | crates/zeroclaw-channels/src/telegram.rs:2397-2403 | crates/zeroclaw-channels/src/telegram.rs:2475-2481 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:2335` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/telegram.rs:2347— crates/zeroclaw-channels/src/telegram.rs:2347-2353 | crates/zeroclaw-channels/src/telegram.rs:2410-2416 | crates/zeroclaw-channels/src/telegram.rs:2489-2495 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:2347` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) 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:541— crates/zeroclaw-gateway/src/api_oidc.rs:541-547 | crates/zeroclaw-gateway/src/api_oidc.rs:624-630 | crates/zeroclaw-gateway/src/api_oidc.rs:1128-1134 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/datasheet.rs:514` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:1788` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-providers/src/gemini.rs:370— crates/zeroclaw-providers/src/gemini.rs:370-376 | crates/zeroclaw-providers/src/lib.rs:417-423 | crates/zeroclaw-providers/src/lib.rs:562-568 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/gemini.rs:370` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-providers/src/gemini_cli.rs:134— crates/zeroclaw-providers/src/gemini_cli.rs:134-140 | crates/zeroclaw-providers/src/grok_cli.rs:885-891 | crates/zeroclaw-providers/src/kilocli.rs:131-137 — 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 17 separate duplicated blocks between them, totalling at least 164 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/gemini_cli.rs:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/agent/turn/mod.rs:5015— crates/zeroclaw-runtime/src/agent/turn/mod.rs:5015-5021 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:5055-5061 | crates/zeroclaw-runtime/src/sop/executor.rs:1318-1324 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/turn/mod.rs:5015` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/observability/log.rs:117` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/skills/mod.rs:1272— crates/zeroclaw-runtime/src/skills/mod.rs:1272-1278 | crates/zeroclaw-runtime/src/skills/mod.rs:1310-1316 | crates/zeroclaw-runtime/src/skills/mod.rs:3058-3064 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:1272` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:4184— crates/zeroclaw-runtime/src/sop/engine.rs:4184-4190 | crates/zeroclaw-runtime/src/sop/engine.rs:4773-4779 | crates/zeroclaw-runtime/src/sop/engine.rs:5219-5225 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn fail_headless_step_budget(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/tools/delegate.rs:3015— crates/zeroclaw-runtime/src/tools/delegate.rs:3015-3021 | crates/zeroclaw-runtime/src/tools/delegate.rs:3039-3045 | crates/zeroclaw-runtime/src/tools/delegate.rs:4089-4095 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:3015` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:315` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/microsoft365/auth.rs:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-runtime/src/tools/skill_manage.rs:713— crates/zeroclaw-runtime/src/tools/skill_manage.rs:713-719 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:730-736 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:741-747 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/skill_manage.rs:713` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) crates/zeroclaw-channels/src/mattermost.rs:1215— crates/zeroclaw-channels/src/mattermost.rs:1215-1221 | crates/zeroclaw-channels/src/telegram.rs:8899-8905 | 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 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 (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 17 separate duplicated blocks between them, totalling at least 164 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-runtime/src/sop/engine.rs:2692— crates/zeroclaw-runtime/src/sop/engine.rs:2692-2698 | crates/zeroclaw-runtime/src/sop/executor.rs:1079-1089 | crates/zeroclaw-runtime/src/sop/executor.rs:1196-1205 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:2692` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3589` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
+ 6 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/app.rs:3483— apps/zerocode/src/app.rs:3483-3627 | apps/zerocode/src/app.rs:3629-3713 | apps/zerocode/src/app.rs:3715-3769 | apps/zerocode/src/quickstart_pane.rs:2919-3502 — 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:1885— apps/zerocode/src/config_manager.rs:1885-1897 | apps/zerocode/src/config_manager.rs:1967-1977 | apps/zerocode/src/config_manager.rs:3491-3627 | apps/zerocode/src/config_manager.rs:5361-5524 — 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:2753— apps/zerocode/src/config_manager.rs:2753-2795 | apps/zerocode/src/config_manager.rs:2833-2957 | apps/zerocode/src/config_manager.rs:3491-3627 | apps/zerocode/src/config_manager.rs:4675-4742 — 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:3567— crates/zeroclaw-channels/src/discord/mod.rs:3567-3738 | crates/zeroclaw-channels/src/signal.rs:1248-1453 | 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/lark.rs:3269— crates/zeroclaw-channels/src/lark.rs:3269-3319 | crates/zeroclaw-channels/src/telegram.rs:2314-2359 | crates/zeroclaw-channels/src/telegram.rs:2376-2423 | crates/zeroclaw-channels/src/telegram.rs:2451-2503 — 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:1881-2418 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2798-2828 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2858-2887 — 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:7558-7623 | 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:9288— crates/zeroclaw-channels/src/orchestrator/mod.rs:9288-11551 | crates/zeroclaw-hardware/src/discover.rs:66-97 | crates/zeroclaw-tools/src/weather_tool.rs:145-189 | src/main.rs:14871-14968 — 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/signal.rs:662— crates/zeroclaw-channels/src/signal.rs:662-710 | crates/zeroclaw-channels/src/telegram.rs:2314-2359 | crates/zeroclaw-channels/src/telegram.rs:2376-2423 | crates/zeroclaw-channels/src/telegram.rs:2451-2503 — 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:5208— crates/zeroclaw-channels/src/telegram.rs:5208-5338 | crates/zeroclaw-gateway/src/api_upload.rs:91-184 | crates/zeroclaw-runtime/src/agent/agent.rs:3297-3703 | 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:8448— crates/zeroclaw-channels/src/telegram.rs:8448-8496 | 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:259— crates/zeroclaw-config/src/pairing.rs:259-295 | 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-config/src/schema.rs:12116— crates/zeroclaw-config/src/schema.rs:12116-12138 | crates/zeroclaw-config/src/schema.rs:12144-12170 | crates/zeroclaw-config/src/schema.rs:12176-12206 | crates/zeroclaw-config/src/schema.rs:12261-12292 — 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:62— crates/zeroclaw-gateway/src/acp.rs:62-186 | crates/zeroclaw-runtime/src/sop/mod.rs:175-233 | crates/zeroclaw-tools/src/file_download.rs:273-292 | src/main.rs:9633-14221 — 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:2094— REDACTED:2094-2116 | REDACTED:2271-2292 | REDACTED:2298-2312 | REDACTED:2451-2480 — 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:3340— crates/zeroclaw-providers/src/compatible.rs:3340-3368 | crates/zeroclaw-providers/src/compatible.rs:3370-3392 | crates/zeroclaw-providers/src/compatible.rs:3403-3442 | 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-providers/src/gemini.rs:356— crates/zeroclaw-providers/src/gemini.rs:356-441 | crates/zeroclaw-providers/src/gemini.rs:492-518 | crates/zeroclaw-providers/src/lib.rs:401-519 | crates/zeroclaw-providers/src/lib.rs:545-615 — 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/loop_.rs:1516— crates/zeroclaw-runtime/src/agent/loop_.rs:1516-1533 | crates/zeroclaw-runtime/src/agent/loop_.rs:1635-3477 | crates/zeroclaw-runtime/src/agent/turn/context_recovery.rs:92-243 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6600-7662 — 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:1662-3814 | crates/zeroclaw-runtime/src/live_config_authority.rs:241-269 | crates/zeroclaw-runtime/src/live_config_authority.rs:275-304 — 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.
Members sharing a duplicated core (4 members, 50+ identical tokens) crates/zeroclaw-runtime/src/rpc/dispatch.rs:4488— crates/zeroclaw-runtime/src/rpc/dispatch.rs:4488-5569 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5994-6453 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6485-6578 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:8557-8666 — 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/sop/metrics.rs:116— crates/zeroclaw-runtime/src/sop/metrics.rs:116-151 | crates/zeroclaw-runtime/src/sop/metrics.rs:156-179 | crates/zeroclaw-runtime/src/sop/metrics.rs:182-199 | crates/zeroclaw-runtime/src/sop/metrics.rs:204-227 — 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/tools/file_read.rs:101— crates/zeroclaw-runtime/src/tools/file_read.rs:101-323 | crates/zeroclaw-tools/src/file_edit.rs:76-257 | crates/zeroclaw-tools/src/file_write.rs:73-334 | crates/zeroclaw-tools/src/image_info.rs:151-254 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (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:873-881 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 3) 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 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3550` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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:1524-1532 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:950` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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:1689-1697 — 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:1712-1720 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1101` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1413` calls `disarm` and `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1098` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:13709— crates/zeroclaw-channels/src/orchestrator/mod.rs:13709-13717 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15373-15381 | crates/zeroclaw-gateway/src/lib.rs:1975-1983 — 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 10 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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 × 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/slack.rs:4603` calls `resolve_sender_identity` and `crates/zeroclaw-channels/src/slack.rs:6048` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_config.rs:1484` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-gateway/src/api_config.rs:2132` calls `with` and `crates/zeroclaw-gateway/src/api_config.rs:1789` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 3) crates/zeroclaw-hardware/src/peripherals/rpi.rs:95— crates/zeroclaw-hardware/src/peripherals/rpi.rs:95-103 | crates/zeroclaw-hardware/src/peripherals/serial.rs:265-273 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:95-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 3 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/peripherals/rpi.rs:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-log/src/reader.rs:810` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:562` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:1454` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-macros/src/lib.rs:1449` calls `Some`, `clone` and `crates/zeroclaw-macros/src/lib.rs:1477` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:1887` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/agent/agent.rs:1980— crates/zeroclaw-runtime/src/agent/agent.rs:1980-1988 | crates/zeroclaw-runtime/src/agent/agent.rs:2325-2333 | crates/zeroclaw-runtime/src/agent/agent.rs:4448-4456 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:1980` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:2650— crates/zeroclaw-runtime/src/sop/engine.rs:2650-2658 | crates/zeroclaw-runtime/src/sop/engine.rs:4941-4949 | crates/zeroclaw-runtime/src/sop/engine.rs:5811-5819 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:2650` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/sop/engine.rs:2647` calls `clone` and `crates/zeroclaw-runtime/src/sop/engine.rs:5809` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/tools/mod.rs:2755— crates/zeroclaw-runtime/src/tools/mod.rs:2755-2763 | crates/zeroclaw-runtime/src/tools/mod.rs:2803-2811 | crates/zeroclaw-runtime/src/tools/mod.rs:2908-2916 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/mod.rs:2755` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/tools/mod.rs:2801` calls `clone` and `crates/zeroclaw-runtime/src/tools/mod.rs:2907` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 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 9 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/file_download.rs:579` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:2779— crates/zeroclaw-channels/src/discord/mod.rs:2779-2791 | crates/zeroclaw-channels/src/discord/mod.rs:2826-2836 | crates/zeroclaw-channels/src/discord/mod.rs:2880-2888 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2779` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 3) crates/zeroclaw-runtime/src/tools/cron_add.rs:479— crates/zeroclaw-runtime/src/tools/cron_add.rs:479-487 | crates/zeroclaw-runtime/src/tools/cron_update.rs:233-243 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/cron_update.rs:233` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/jira_tool.rs:1122` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 3) 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:132— crates/zeroclaw-channels/src/tts.rs:132-140 | crates/zeroclaw-channels/src/tts.rs:262-270 | crates/zeroclaw-channels/src/tts.rs:973-981 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/tts.rs:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/tts.rs:273` calls `or_else`, `as_str` and `crates/zeroclaw-channels/src/tts.rs:143` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) apps/zerocode/src/app.rs:3328— apps/zerocode/src/app.rs:3328-3335 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/app.rs:3328` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) apps/zerocode/src/config_manager.rs:5022— apps/zerocode/src/config_manager.rs:5022-5029 | apps/zerocode/src/config_manager.rs:5176-5183 | apps/zerocode/src/config_manager.rs:5502-5509 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:5022` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:2445— crates/zeroclaw-channels/src/discord/mod.rs:2445-2452 | crates/zeroclaw-channels/src/discord/mod.rs:2644-2651 | crates/zeroclaw-channels/src/discord/mod.rs:3056-3063 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/discord/mod.rs:2456` calls `interaction_string_option`, `extract_submitted_options` and `crates/zeroclaw-channels/src/discord/mod.rs:2652` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2460` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2649` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1882— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1882-1890 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3123-3130 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3155-3163 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:10738— crates/zeroclaw-channels/src/orchestrator/mod.rs:10738-10745 | crates/zeroclaw-runtime/src/agent/loop_.rs:1303-1311 | crates/zeroclaw-runtime/src/agent/loop_.rs:3455-3462 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10738` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:10746` calls `set_model_route`, `clone` and `crates/zeroclaw-runtime/src/agent/loop_.rs:1312` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 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:234-241 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/voice_wake.rs:405` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-infra/src/session_sqlite.rs:1024— crates/zeroclaw-infra/src/session_sqlite.rs:1024-1032 | crates/zeroclaw-infra/src/session_sqlite.rs:1057-1064 | crates/zeroclaw-infra/src/session_sqlite.rs:1427-1434 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-infra/src/session_sqlite.rs:1024` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-infra/src/session_store.rs:409— crates/zeroclaw-infra/src/session_store.rs:409-416 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-log/src/writer.rs:828` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:664` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/knowledge_graph.rs:381` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-providers/src/gemini_cli.rs:229— crates/zeroclaw-providers/src/gemini_cli.rs:229-236 | crates/zeroclaw-providers/src/kilocli.rs:226-233 | crates/zeroclaw-providers/src/openai_codex.rs:1066-1073 — 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 17 separate duplicated blocks between them, totalling at least 164 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/gemini_cli.rs:229` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/agent/agent.rs:4386— crates/zeroclaw-runtime/src/agent/agent.rs:4386-4393 | crates/zeroclaw-runtime/src/agent/agent.rs:4840-4847 | crates/zeroclaw-runtime/src/agent/agent.rs:4922-4929 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:4386` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/observability/broadcast.rs:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/observability/broadcast.rs:124` calls `as_millis` and `crates/zeroclaw-runtime/src/observability/broadcast.rs:144` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/service/mod.rs:3147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-runtime/src/skills/mod.rs:1280— crates/zeroclaw-runtime/src/skills/mod.rs:1280-1287 | crates/zeroclaw-runtime/src/skills/mod.rs:1318-1325 | crates/zeroclaw-runtime/src/skills/mod.rs:3066-3073 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:1280` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-tools/src/ask_user.rs:103— crates/zeroclaw-tools/src/ask_user.rs:103-110 | crates/zeroclaw-tools/src/escalate.rs:189-196 | crates/zeroclaw-tools/src/poll.rs:199-206 — 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 7 separate duplicated blocks between them, totalling at least 96 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/ask_user.rs:103` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) crates/zeroclaw-tools/src/hardware_board_info.rs:163— crates/zeroclaw-tools/src/hardware_board_info.rs:163-170 | crates/zeroclaw-tools/src/hardware_memory_map.rs:148-155 | crates/zeroclaw-tools/src/hardware_memory_read.rs:151-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/hardware_board_info.rs:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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:402— crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:402-409 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:402` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/metrics.rs:158` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 3) crates/zeroclaw-gateway/src/lib.rs:2932— crates/zeroclaw-gateway/src/lib.rs:2932-2939 | crates/zeroclaw-runtime/src/security/detect.rs:732-739 | crates/zeroclaw-runtime/src/tools/mod.rs:3049-3056 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:2932` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:3894— crates/zeroclaw-channels/src/discord/mod.rs:3894-3898 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:3894` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3430` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:1209` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:4799` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:6774— crates/zeroclaw-channels/src/orchestrator/mod.rs:6774-6778 | crates/zeroclaw-channels/src/orchestrator/mod.rs:8240-8244 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10847-10854 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:6774` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-config/src/schema.rs:23771— crates/zeroclaw-config/src/schema.rs:23771-23775 | crates/zeroclaw-config/src/schema.rs:23815-23819 | crates/zeroclaw-runtime/src/daemon/mod.rs:929-933 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:23771` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-memory/src/sqlite.rs:1021— crates/zeroclaw-memory/src/sqlite.rs:1021-1025 | crates/zeroclaw-memory/src/sqlite.rs:2510-2514 | crates/zeroclaw-memory/src/sqlite.rs:2553-2557 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1021` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:1281— crates/zeroclaw-providers/src/auth/mod.rs:1281-1285 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:258-262 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:269-273 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1281` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-providers/src/openai_codex.rs:1094— crates/zeroclaw-providers/src/openai_codex.rs:1094-1098 | crates/zeroclaw-providers/src/openai_codex.rs:1109-1114 | crates/zeroclaw-providers/src/openai_codex.rs:1126-1130 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openai_codex.rs:1094` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) crates/zeroclaw-runtime/src/agent/tool_execution.rs:533— crates/zeroclaw-runtime/src/agent/tool_execution.rs:533-537 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:584-588 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:630-634 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/tool_execution.rs:533` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/plugin_state.rs:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3138— crates/zeroclaw-runtime/src/rpc/dispatch.rs:3138-3142 | crates/zeroclaw-runtime/src/sop/executor.rs:1514-1518 | crates/zeroclaw-runtime/src/sop/executor.rs:1525-1529 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:3138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-runtime/src/security/audit.rs:306— crates/zeroclaw-runtime/src/security/audit.rs:306-310 | crates/zeroclaw-runtime/src/security/audit.rs:414-418 | crates/zeroclaw-runtime/src/security/audit.rs:778-782 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/security/audit.rs:306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-tools/src/model_routing_config.rs:408— crates/zeroclaw-tools/src/model_routing_config.rs:408-412 | crates/zeroclaw-tools/src/model_routing_config.rs:440-444 | crates/zeroclaw-tools/src/model_routing_config.rs:472-476 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/model_routing_config.rs:408` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-gateway/src/dashboard_session.rs:1478— crates/zeroclaw-gateway/src/dashboard_session.rs:1478-1482 | crates/zeroclaw-gateway/src/lib.rs:1285-1289 | crates/zeroclaw-gateway/src/ws.rs:416-420 — before extracting anything, compare `crates/zeroclaw-gateway/src/lib.rs` and `crates/zeroclaw-gateway/src/ws.rs` as WHOLE FILES: this scan already matched 4 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 (5 lines × 3) crates/zeroclaw-runtime/src/cron/scheduler.rs:358— crates/zeroclaw-runtime/src/cron/scheduler.rs:358-367 | crates/zeroclaw-runtime/src/cron/scheduler.rs:444-448 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1126-1130 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/scheduler.rs:358` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:1375— crates/zeroclaw-channels/src/discord/mod.rs:1375-1379 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:1375` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/matrix.rs:2016— crates/zeroclaw-channels/src/matrix.rs:2016-2024 | crates/zeroclaw-channels/src/mochat.rs:270-274 | crates/zeroclaw-channels/src/twitter.rs:407-411 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/mochat.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:2016` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/twitter.rs:110— crates/zeroclaw-channels/src/twitter.rs:110-114 | crates/zeroclaw-tools/src/composio.rs:740-748 | crates/zeroclaw-tools/src/knowledge_tool.rs:409-414 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/twitter.rs:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:1375— crates/zeroclaw-channels/src/discord/mod.rs:1375-1379 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14552-14557 | crates/zeroclaw-memory/src/sqlite.rs:398-404 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:1375` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-plugins/src/registry.rs:69` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:1246` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/telegram.rs:4189— crates/zeroclaw-channels/src/telegram.rs:4189-4193 | crates/zeroclaw-channels/src/telegram.rs:7291-7295 | crates/zeroclaw-channels/src/telegram.rs:7351-7355 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:4189` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/acp_channel.rs:92` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) crates/zeroclaw-channels/src/telegram.rs:6221— crates/zeroclaw-channels/src/telegram.rs:6221-6225 | crates/zeroclaw-channels/src/telegram.rs:6231-6235 | crates/zeroclaw-channels/src/telegram.rs:6283-6287 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:6221` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
zeroclaw_channels::orchestrator::process_channel_message_body (cyclomatic 181) crates/zeroclaw-channels/src/orchestrator/mod.rs:9281— zeroclaw_channels::orchestrator::process_channel_message_body has cyclomatic complexity 181 (threshold 15). To reduce it, separate the cases: extract each independent 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:14744— 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:17020— 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:13185— 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:12325— 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:5262— 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:17898— 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:11925— 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:3532— 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:8960— 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::whatsapp_web::markdown_to_whatsapp (cyclomatic 20) crates/zeroclaw-channels/src/whatsapp_web.rs:3201— zeroclaw_channels::whatsapp_web::markdown_to_whatsapp 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: WhatsAppMediaKind::mime_for_path (cyclomatic 26) 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_channels::discord::process_attachments (cyclomatic 18) crates/zeroclaw-channels/src/discord/mod.rs:1213— 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_titled (cyclomatic 18) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3534— zeroclaw_channels::orchestrator::acp_server::notification_for_turn_event_titled 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:2790— 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:16791— 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.
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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:2002` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/imessage.rs:306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13640— crates/zeroclaw-channels/src/orchestrator/mod.rs:13640-13654 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15963-15977 — both copies are in the same file, so extract the block into 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/slack.rs:3042— crates/zeroclaw-channels/src/slack.rs:3042-3056 | crates/zeroclaw-channels/src/slack.rs:3785-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:3042` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/zeroclaw-config/src/policy.rs:3677— crates/zeroclaw-config/src/policy.rs:3677-3691 | crates/zeroclaw-config/src/policy.rs:3693-3707 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_webauthn.rs:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-infra/src/net_guard.rs:899` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/zeroclaw-memory/src/sqlite.rs:1034— crates/zeroclaw-memory/src/sqlite.rs:1034-1048 | crates/zeroclaw-memory/src/sqlite.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1034` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4808— crates/zeroclaw-providers/src/compatible.rs:4808-4822 | crates/zeroclaw-providers/src/compatible.rs:5233-5247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:4808` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/compatible.rs:4804` calls `exact_request_replay_active` and `crates/zeroclaw-providers/src/compatible.rs:5229` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) crates/zeroclaw-providers/src/dispatch.rs:518— crates/zeroclaw-providers/src/dispatch.rs:518-532 | crates/zeroclaw-providers/src/dispatch.rs:551-565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/dispatch.rs:518` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:3276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2519— crates/zeroclaw-runtime/src/agent/loop_.rs:2519-2533 | crates/zeroclaw-runtime/src/agent/loop_.rs:3183-3197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2519` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/i18n.rs:251` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:4784— crates/zeroclaw-runtime/src/rpc/dispatch.rs:4784-4798 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5217-5231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:869` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tool-call-parser/src/lib.rs:2493` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/backup_tool.rs:1149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) 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-providers/src/gemini_cli.rs:128— crates/zeroclaw-providers/src/gemini_cli.rs:128-142 | crates/zeroclaw-providers/src/kilocli.rs:125-139 — 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 17 separate duplicated blocks between them, totalling at least 164 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/gemini_cli.rs:128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
zeroclaw_gateway::ws::handle_socket (cognitive 189) crates/zeroclaw-gateway/src/ws.rs:592— zeroclaw_gateway::ws::handle_socket has cognitive complexity 189 (threshold 15). Drivers by points: if/else 48 (132 pts), match/switch 20 (51 pts), boolean chains 4, loops 2 (nesting depth added 115). 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 152) crates/zeroclaw-gateway/src/lib.rs:1386— zeroclaw_gateway::run_gateway_with_plugin_webhooks has cognitive complexity 152 (threshold 15). Drivers by points: if/else 53 (72 pts), match/switch 31 (67 pts), loops 4 (8 pts), boolean chains 5 (nesting depth added 59). To reduce it, split the body into named stages: move each independent 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::process_chat_message (cognitive 134) crates/zeroclaw-gateway/src/ws.rs:2038— zeroclaw_gateway::ws::process_chat_message has cognitive complexity 134 (threshold 15). Drivers by points: if/else 32 (84 pts), match/switch 18 (44 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 79). 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 37) crates/zeroclaw-gateway/src/api_config.rs:2985— zeroclaw_gateway::api_config::handle_migrate has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 11 (17 pts), boolean chains 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.
zeroclaw_gateway::principal_gate::config_route_auth (cognitive 30) crates/zeroclaw-gateway/src/principal_gate.rs:701— zeroclaw_gateway::principal_gate::config_route_auth has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 6 (10 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_gateway::run_gateway_chat_streaming_response (cognitive 28) crates/zeroclaw-gateway/src/lib.rs:4432— 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:747— 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_oidc_enroll::handle_certificate (cognitive 23) crates/zeroclaw-gateway/src/api_oidc_enroll.rs:61— zeroclaw_gateway::api_oidc_enroll::handle_certificate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, boolean chains 6, match/switch 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_gateway::api::handle_api_cron_add (cognitive 22) crates/zeroclaw-gateway/src/api.rs:487— 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:4061— 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::api_oidc::finish_pkce_callback (cognitive 19) crates/zeroclaw-gateway/src/api_oidc.rs:1458— zeroclaw_gateway::api_oidc::finish_pkce_callback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 7 (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_gateway::handle_admin_paircode_new (cognitive 18) crates/zeroclaw-gateway/src/lib.rs:5615— zeroclaw_gateway::handle_admin_paircode_new has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 5 (8 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_gateway::ws::handle_ws_chat (cognitive 18) crates/zeroclaw-gateway/src/ws.rs:141— zeroclaw_gateway::ws::handle_ws_chat has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
zeroclaw_gateway::forwarded_client_ip (cognitive 17) crates/zeroclaw-gateway/src/lib.rs:631— zeroclaw_gateway::forwarded_client_ip has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
zeroclaw_gateway::dashboard_session::layer (cognitive 17) crates/zeroclaw-gateway/src/dashboard_session.rs:1707— zeroclaw_gateway::dashboard_session::layer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 5 (8 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
zeroclaw_gateway::ws_sop_runs::handle_socket (cognitive 16) crates/zeroclaw-gateway/src/ws_sop_runs.rs:90— zeroclaw_gateway::ws_sop_runs::handle_socket has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), match/switch 5 (7 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×25
Edited copy of a member (12 corresponding lines) apps/zerocode/src/client_crypto.rs:36— apps/zerocode/src/client_crypto.rs:36-50 | crates/zeroclaw-tls/src/certgen.rs:419-430 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) REDACTED:2658— REDACTED:2658-2673 | REDACTED:2843-2854 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-api/src/model_provider.rs:849— crates/zeroclaw-api/src/model_provider.rs:849-861 | crates/zeroclaw-api/src/model_provider.rs:990-1001 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:739— crates/zeroclaw-runtime/src/rpc/dispatch.rs:739-750 | crates/zeroclaw-runtime/src/sop/executor.rs:668-689 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-channels/src/wechat.rs:1136— crates/zeroclaw-channels/src/wechat.rs:1136-1147 | crates/zeroclaw-channels/src/whatsapp_web.rs:1419-1433 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-config/src/alias_refs.rs:873— crates/zeroclaw-config/src/alias_refs.rs:873-884 | crates/zeroclaw-config/src/alias_refs.rs:894-905 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-providers/src/gemini_cli.rs:100— crates/zeroclaw-providers/src/gemini_cli.rs:100-111 | crates/zeroclaw-providers/src/kilocli.rs:100-111 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-macros/src/lib.rs:2744— crates/zeroclaw-macros/src/lib.rs:2744-2755 | crates/zeroclaw-runtime/src/skills/scaffold.rs:103-114 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) apps/zerocode/src/config_manager.rs:2409— apps/zerocode/src/config_manager.rs:2409-2420 | apps/zerocode/src/file_explorer.rs:246-257 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-runtime/src/sop/dispatch.rs:306— crates/zeroclaw-runtime/src/sop/dispatch.rs:306-317 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:230-241 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:1843— crates/zeroclaw-infra/src/session_sqlite.rs:1843-1854 | crates/zeroclaw-infra/src/session_sqlite.rs:1862-1874 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-channels/src/telegram.rs:3414— crates/zeroclaw-channels/src/telegram.rs:3414-3425 | crates/zeroclaw-channels/src/telegram.rs:3427-3438 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) apps/zerocode/src/dashboard.rs:2608— apps/zerocode/src/dashboard.rs:2608-2619 | apps/zerocode/src/dashboard.rs:2621-2632 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-tools/src/mcp_prompts_tool.rs:55— crates/zeroclaw-tools/src/mcp_prompts_tool.rs:55-67 | crates/zeroclaw-tools/src/mcp_resources_tool.rs:55-66 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) apps/zerocode/src/theme.rs:449— apps/zerocode/src/theme.rs:449-460 | apps/zerocode/src/theme.rs:465-477 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) apps/zerocode/src/config/mod.rs:169— apps/zerocode/src/config/mod.rs:169-183 | apps/zerocode/src/config/mod.rs:189-200 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:1339— crates/zeroclaw-runtime/src/rpc/dispatch.rs:1339-1351 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:1361-1372 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-tools/src/calculator.rs:231— crates/zeroclaw-tools/src/calculator.rs:231-242 | crates/zeroclaw-tools/src/calculator.rs:244-258 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-channels/src/orchestrator/mod.rs:3262— crates/zeroclaw-channels/src/orchestrator/mod.rs:3262-3273 | crates/zeroclaw-channels/src/orchestrator/mod.rs:3337-3349 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-tools/src/web_fetch.rs:106— crates/zeroclaw-tools/src/web_fetch.rs:106-120 | crates/zeroclaw-tools/src/text_browser.rs:112-123 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-channels/src/slack.rs:3483— crates/zeroclaw-channels/src/slack.rs:3483-3494 | crates/zeroclaw-channels/src/slack.rs:3883-3894 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-providers/src/dispatch.rs:452— crates/zeroclaw-providers/src/dispatch.rs:452-463 | crates/zeroclaw-providers/src/reliable.rs:217-228 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-gateway/src/api_oidc.rs:391— crates/zeroclaw-gateway/src/api_oidc.rs:391-402 | crates/zeroclaw-gateway/src/principal_gate.rs:286-299 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-runtime/src/tools/read_skill.rs:35— crates/zeroclaw-runtime/src/tools/read_skill.rs:35-46 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:78-93 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) crates/zeroclaw-tools/src/browser_open.rs:95— crates/zeroclaw-tools/src/browser_open.rs:95-106 | crates/zeroclaw-tools/src/web_fetch.rs:434-445 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
App::handle_mouse_inner (cognitive 109) apps/zerocode/src/config_manager.rs:1385— App::handle_mouse_inner has cognitive complexity 109 (threshold 15). Drivers by points: if/else 38 (96 pts), boolean chains 12, match/switch 1 (nesting depth added 58). 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::zeroclaw_help_context (cognitive 46) apps/zerocode/src/config_manager.rs:6073— 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:3347— 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:3491— 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::draw_field_list (cognitive 35) apps/zerocode/src/config_manager.rs:5355— 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:2833— 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:5711— 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::handle_paste (cognitive 32) apps/zerocode/src/config_manager.rs:5902— App::handle_paste has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::draw_alias_list (cognitive 31) apps/zerocode/src/config_manager.rs:5046— 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_key_inner (cognitive 29) apps/zerocode/src/config_manager.rs:1233— App::handle_key_inner has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 6, match/switch 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::handle_personality_tab (cognitive 29) apps/zerocode/src/config_manager.rs:3747— App::handle_personality_tab has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 3 (7 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.
App::visible_count (cognitive 28) apps/zerocode/src/config_manager.rs:1734— 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:1900— 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:4547— 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 27) apps/zerocode/src/config_manager.rs:4831— App::draw_sections_pane has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (24 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 26) apps/zerocode/src/config_manager.rs:980— App::bottom_hint has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 2 (4 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.
App::visible_cursor (cognitive 21) apps/zerocode/src/config_manager.rs:1828— 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:2968— 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::handle_skills_tab (cognitive 21) apps/zerocode/src/config_manager.rs:3944— App::handle_skills_tab has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 3 (7 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.
App::load_fields (cognitive 19) apps/zerocode/src/config_manager.rs:2305— 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:1994— 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::mouse_replaces_draft (cognitive 17) apps/zerocode/src/config_manager.rs:1667— App::mouse_replaces_draft has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (4 pts), boolean chains 3 (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::handle_alias_create (cognitive 17) apps/zerocode/src/config_manager.rs:3226— 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.
App::handle_select_edit (cognitive 17) apps/zerocode/src/config_manager.rs:4675— App::handle_select_edit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 3 (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.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×24
Edited copy of a member (14 corresponding lines) crates/zeroclaw-channels/src/whatsapp_storage.rs:490— crates/zeroclaw-channels/src/whatsapp_storage.rs:490-503 | crates/zeroclaw-channels/src/whatsapp_storage.rs:538-551 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-channels/src/whatsapp_storage.rs:616— crates/zeroclaw-channels/src/whatsapp_storage.rs:616-629 | crates/zeroclaw-channels/src/whatsapp_storage.rs:672-685 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-gateway/src/api_sop_author.rs:158— crates/zeroclaw-gateway/src/api_sop_author.rs:158-175 | crates/zeroclaw-gateway/src/api_sop_author.rs:905-918 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs:139— crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs:139-152 | crates/zeroclaw-runtime/src/tools/skill_http.rs:138-151 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-memory/src/conflict.rs:64— crates/zeroclaw-memory/src/conflict.rs:64-83 | crates/zeroclaw-memory/src/rerank.rs:265-278 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-rpc-client/src/client.rs:315— crates/zeroclaw-rpc-client/src/client.rs:315-328 | crates/zeroclaw-runtime/src/rpc/inproc.rs:114-130 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-tools/src/mcp_client.rs:1454— crates/zeroclaw-tools/src/mcp_client.rs:1454-1467 | crates/zeroclaw-tools/src/mcp_client.rs:1470-1486 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:1565— crates/zeroclaw-runtime/src/sop/engine.rs:1565-1578 | crates/zeroclaw-runtime/src/sop/engine.rs:1590-1604 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-channels/src/telegram.rs:2361— crates/zeroclaw-channels/src/telegram.rs:2361-2374 | crates/zeroclaw-channels/src/telegram.rs:2430-2443 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) apps/zerocode/src/logs.rs:1493— apps/zerocode/src/logs.rs:1493-1506 | apps/zerocode/src/logs.rs:1508-1526 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-providers/src/multimodal.rs:1221— crates/zeroclaw-providers/src/multimodal.rs:1221-1234 | crates/zeroclaw-providers/src/multimodal.rs:1454-1467 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) xtask/src/cmd/mdbook/seo.rs:403— xtask/src/cmd/mdbook/seo.rs:403-416 | xtask/src/cmd/mdbook/versions.rs:300-317 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) apps/zerocode/src/enroll.rs:463— apps/zerocode/src/enroll.rs:463-476 | apps/zerorelay/src/enroll_proxy.rs:354-367 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-memory/src/sqlite.rs:1833— crates/zeroclaw-memory/src/sqlite.rs:1833-1846 | crates/zeroclaw-memory/src/sqlite.rs:1848-1862 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-config/src/schema.rs:11587— crates/zeroclaw-config/src/schema.rs:11587-11604 | crates/zeroclaw-config/src/schema.rs:18255-18268 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-runtime/src/peers.rs:19— crates/zeroclaw-runtime/src/peers.rs:19-32 | crates/zeroclaw-runtime/src/peers.rs:35-48 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-channels/src/whatsapp_storage.rs:586— crates/zeroclaw-channels/src/whatsapp_storage.rs:586-599 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1038-1051 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-config/src/policy.rs:94— crates/zeroclaw-config/src/policy.rs:94-107 | crates/zeroclaw-config/src/policy.rs:109-124 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-providers/src/reliable.rs:2460— crates/zeroclaw-providers/src/reliable.rs:2460-2473 | crates/zeroclaw-providers/src/reliable.rs:2475-2492 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-channels/src/transcription.rs:486— crates/zeroclaw-channels/src/transcription.rs:486-499 | crates/zeroclaw-channels/src/transcription.rs:660-674 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-api/src/channel.rs:621— crates/zeroclaw-api/src/channel.rs:621-634 | crates/zeroclaw-api/src/channel.rs:653-666 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-plugins/src/wasm_channel.rs:1052— crates/zeroclaw-plugins/src/wasm_channel.rs:1052-1065 | crates/zeroclaw-plugins/src/wasm_memory.rs:313-326 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/api.rs:158— crates/zeroclaw-channels/src/git/providers/gitea/api.rs:158-171 | crates/zeroclaw-channels/src/git/providers/github/api.rs:284-297 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) src/commands/update.rs:50— src/commands/update.rs:50-63 | src/memory/cli.rs:298-313 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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::chat::render_tool_entry (cognitive 146) apps/zerocode/src/chat.rs:7173— zerocode::chat::render_tool_entry has cognitive complexity 146 (threshold 15). Drivers by points: if/else 60 (119 pts), loops 6 (14 pts), match/switch 4 (8 pts), boolean chains 5 (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.
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:9014— 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::config::load_persisted (cognitive 63) apps/zerocode/src/config/mod.rs:919— zerocode::config::load_persisted has cognitive complexity 63 (threshold 15). Drivers by points: if/else 14 (36 pts), match/switch 7 (22 pts), loops 2 (5 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
zerocode::run (cognitive 60) apps/zerocode/src/main.rs:891— zerocode::run has cognitive complexity 60 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 9 (18 pts), boolean chains 7 (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.
zerocode::client::dial_through_relay_unbounded (cognitive 54) apps/zerocode/src/client.rs:1442— 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:9490— 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:9587— 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::input_bar::push_wrapped_physical_line (cognitive 42) apps/zerocode/src/input_bar.rs:379— 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::chat::render_with_plan_placement (cognitive 35) apps/zerocode/src/chat.rs:6523— 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:8194— 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:6854— 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:7896— 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:9315— 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:9381— 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:7581— 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::login::renew_expired (cognitive 18) apps/zerocode/src/login.rs:491— zerocode::login::renew_expired has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4 (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::app::draw_help_modal (cognitive 17) apps/zerocode/src/app.rs:3478— 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.
TooManyFields: Config crates/zeroclaw-config/src/schema.rs:150— TooManyFields — 99 stored fields beside 101 methods. The bar is 30 stored fields; this is 69 over it, 3.30× 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:10054— TooManyFields — 71 stored fields beside 140 methods. The bar is 30 stored fields; this is 41 over it, 2.37× 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:456— TooManyFields — 63 stored fields beside 140 methods. The bar is 30 stored fields; this is 33 over it, 2.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: 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:541— TooManyFields — 55 stored fields beside 106 methods. The bar is 30 stored fields; this is 25 over it, 1.83× 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:12906— 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: AgentBuilder crates/zeroclaw-runtime/src/agent/agent.rs:852— TooManyFields — 46 stored fields beside 47 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: ChannelsConfig crates/zeroclaw-config/src/schema.rs:16310— 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: AppState crates/zeroclaw-gateway/src/lib.rs:716— TooManyFields — 44 stored fields beside 2 methods. The bar is 30 stored fields; this is 14 over it, 1.47× 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 — 37 stored fields beside 53 methods. The bar is 30 stored fields; this is 7 over it, 1.23× 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:1101— TooManyFields — 35 stored fields beside 177 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: Chat apps/zerocode/src/chat.rs:519— TooManyFields — 35 stored fields beside 123 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: 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: ZerocodePane apps/zerocode/src/zerocode_pane.rs:137— TooManyFields — 33 stored fields beside 63 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: DelegateTool crates/zeroclaw-runtime/src/tools/delegate.rs:425— TooManyFields — 32 stored fields beside 115 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: 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 54 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:15122— 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.
zeroclaw_config::policy::scan_unquoted_segments (cyclomatic 96) crates/zeroclaw-config/src/policy.rs:1614— zeroclaw_config::policy::scan_unquoted_segments has cyclomatic complexity 96 (threshold 15). To reduce it, separate the cases: extract each independent 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::normalize_provider_type (cyclomatic 56) crates/zeroclaw-config/src/schema/v2.rs:619— 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:2193— 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::read_heredoc_delimiter (cyclomatic 32) crates/zeroclaw-config/src/policy.rs:1359— zeroclaw_config::policy::read_heredoc_delimiter 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::policy::contains_unmodeled_shell_word_expansion (cyclomatic 32) crates/zeroclaw-config/src/policy.rs:3216— 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:1285— 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:992— 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:1982— 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:2297— 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:3795— 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::alias_refs::collect_agent_refs (cyclomatic 22) crates/zeroclaw-config/src/alias_refs.rs:1227— zeroclaw_config::alias_refs::collect_agent_refs 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::split_powershell_pipeline_syntax (cyclomatic 22) crates/zeroclaw-config/src/policy.rs:3640— 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:2668— 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:1019— 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:1129— 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::rewrite_agent_refs (cyclomatic 18) crates/zeroclaw-config/src/alias_refs.rs:712— zeroclaw_config::alias_refs::rewrite_agent_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::alias_refs::rewrite_model_provider_refs (cyclomatic 18) crates/zeroclaw-config/src/alias_refs.rs:799— 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:3133— 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.
zeroclaw_providers::compatible::sse_bytes_to_events_for_contract (cognitive 134) crates/zeroclaw-providers/src/compatible.rs:2833— 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:2718— 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:2090— 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.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×22
Edited copy of a member (9 corresponding lines) REDACTED:1924— REDACTED:1924-1934 | REDACTED:1989-1997 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-tools/src/calculator.rs:439— crates/zeroclaw-tools/src/calculator.rs:439-447 | crates/zeroclaw-tools/src/calculator.rs:449-457 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/sop/store/mod.rs:444— crates/zeroclaw-runtime/src/sop/store/mod.rs:444-452 | crates/zeroclaw-runtime/src/sop/store/mod.rs:459-467 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) xtask/src/cmd/mdbook/peer_groups.rs:719— xtask/src/cmd/mdbook/peer_groups.rs:719-727 | xtask/src/cmd/mdbook/peer_groups.rs:1008-1016 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) apps/zerocode/src/chat.rs:5083— apps/zerocode/src/chat.rs:5083-5091 | apps/zerocode/src/chat.rs:5096-5104 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-tools/src/mcp_client.rs:1380— crates/zeroclaw-tools/src/mcp_client.rs:1380-1388 | crates/zeroclaw-tools/src/mcp_client.rs:1395-1403 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:226— crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:226-234 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:373-381 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/tools/mod.rs:1424— crates/zeroclaw-runtime/src/tools/mod.rs:1424-1434 | crates/zeroclaw-runtime/src/tools/mod.rs:1436-1444 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:559— crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:559-567 | crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:585-593 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/util.rs:111— crates/zeroclaw-runtime/src/util.rs:111-121 | crates/zeroclaw-tools/src/claude_code_runner.rs:414-422 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:1280— crates/zeroclaw-runtime/src/sop/engine.rs:1280-1288 | crates/zeroclaw-runtime/src/sop/engine.rs:1319-1327 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) apps/zerocode/src/enroll.rs:486— apps/zerocode/src/enroll.rs:486-494 | apps/zerorelay/src/enroll_proxy.rs:389-397 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-channels/src/discord/chunk.rs:220— crates/zeroclaw-channels/src/discord/chunk.rs:220-232 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3520-3528 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/tools/skill_http.rs:39— crates/zeroclaw-runtime/src/tools/skill_http.rs:39-47 | crates/zeroclaw-runtime/src/tools/skill_tool.rs:105-115 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/approval/mod.rs:491— crates/zeroclaw-runtime/src/approval/mod.rs:491-499 | crates/zeroclaw-runtime/src/doctor/mod.rs:2056-2064 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-api/src/tool_carrier.rs:222— crates/zeroclaw-api/src/tool_carrier.rs:222-230 | crates/zeroclaw-log/src/reader.rs:515-528 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-runtime/src/tools/skill_tool.rs:382— crates/zeroclaw-runtime/src/tools/skill_tool.rs:382-390 | crates/zeroclaw-tools/src/mcp_tool.rs:78-86 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/api.rs:143— crates/zeroclaw-channels/src/git/providers/gitea/api.rs:143-151 | crates/zeroclaw-channels/src/git/providers/github/api.rs:304-317 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-channels/src/slack.rs:893— crates/zeroclaw-channels/src/slack.rs:893-901 | crates/zeroclaw-channels/src/whatsapp_web.rs:132-143 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-log/src/config.rs:204— crates/zeroclaw-log/src/config.rs:204-215 | crates/zeroclaw-runtime/src/security/estop.rs:251-259 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-channels/src/slack.rs:3504— crates/zeroclaw-channels/src/slack.rs:3504-3513 | crates/zeroclaw-tools/src/embedded_resource.rs:212-220 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) crates/zeroclaw-hardware/src/peripherals/arduino_upload.rs:184— crates/zeroclaw-hardware/src/peripherals/arduino_upload.rs:184-193 | crates/zeroclaw-hardware/src/pico_code.rs:82-90 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×22
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/bluesky.rs:156— crates/zeroclaw-channels/src/bluesky.rs:156-161 | crates/zeroclaw-channels/src/reddit.rs:118-123 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-runtime/src/tools/sop_workshop.rs:312— crates/zeroclaw-runtime/src/tools/sop_workshop.rs:312-317 | crates/zeroclaw-tools/src/a2a_client.rs:1755-1760 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/whatsapp.rs:423— crates/zeroclaw-channels/src/whatsapp.rs:423-428 | crates/zeroclaw-tools/src/embedded_resource.rs:426-432 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) apps/zerocode/src/i18n.rs:263— apps/zerocode/src/i18n.rs:263-270 | crates/zeroclaw-providers/src/auth/mod.rs:927-932 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-buildinfo/src/lib.rs:62— crates/zeroclaw-buildinfo/src/lib.rs:62-67 | src/main.rs:3344-3351 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) apps/zerocode/src/client.rs:6838— apps/zerocode/src/client.rs:6838-6843 | apps/zerorelay/src/frontdoor.rs:659-664 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-runtime/src/migration.rs:396— crates/zeroclaw-runtime/src/migration.rs:396-401 | crates/zeroclaw-runtime/src/sop/mod.rs:684-689 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) apps/zerocode/src/keymap/overrides.rs:17— apps/zerocode/src/keymap/overrides.rs:17-22 | apps/zerocode/src/theme.rs:99-104 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-gateway/src/api_skills.rs:69— crates/zeroclaw-gateway/src/api_skills.rs:69-77 | crates/zeroclaw-gateway/src/api_sop_author.rs:1083-1088 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-providers/src/bedrock.rs:374— crates/zeroclaw-providers/src/bedrock.rs:374-379 | src/bin/zeroclaw-acp-bridge.rs:185-190 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-hardware/src/peripherals/uno_q_setup.rs:106— crates/zeroclaw-hardware/src/peripherals/uno_q_setup.rs:106-112 | xtask/src/cmd/mdbook/protected.rs:768-773 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:1712— crates/zeroclaw-channels/src/matrix.rs:1712-1717 | crates/zeroclaw-runtime/src/approval/mod.rs:106-113 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/nextcloud_talk.rs:609— crates/zeroclaw-channels/src/nextcloud_talk.rs:609-614 | crates/zeroclaw-runtime/src/util.rs:57-62 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/line.rs:224— crates/zeroclaw-channels/src/line.rs:224-229 | crates/zeroclaw-channels/src/webhook.rs:308-313 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-config/src/schema.rs:10056— crates/zeroclaw-config/src/schema.rs:10056-10062 | crates/zeroclaw-runtime/src/agent/personality.rs:78-83 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-infra/src/session_queue.rs:186— crates/zeroclaw-infra/src/session_queue.rs:186-192 | crates/zeroclaw-runtime/src/rpc/session.rs:1930-1935 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-runtime/src/agent/personality_templates/mod.rs:74— crates/zeroclaw-runtime/src/agent/personality_templates/mod.rs:74-80 | xtask/src/cmd/mdbook/check.rs:71-76 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/qq.rs:792— crates/zeroclaw-channels/src/qq.rs:792-797 | crates/zeroclaw-tls/src/lib.rs:228-233 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/transcription.rs:62— crates/zeroclaw-channels/src/transcription.rs:62-67 | crates/zeroclaw-config/src/policy.rs:3893-3898 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/orchestrator/mod.rs:3557— crates/zeroclaw-channels/src/orchestrator/mod.rs:3557-3562 | crates/zeroclaw-runtime/src/rpc/session.rs:2531-2536 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-channels/src/slack.rs:1464— crates/zeroclaw-channels/src/slack.rs:1464-1470 | crates/zeroclaw-channels/src/transcription.rs:130-135 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) crates/zeroclaw-providers/src/compatible.rs:3066— crates/zeroclaw-providers/src/compatible.rs:3066-3071 | crates/zeroclaw-providers/src/openai.rs:1227-1232 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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:1797— // 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:2021— // 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:465— // 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:945— // 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:533— // 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:865— // ── 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:1463— // ── 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:581— // ── 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:3073— // ── 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.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×21
Edited copy of a member (7 corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:1078— crates/zeroclaw-infra/src/session_sqlite.rs:1078-1084 | crates/zeroclaw-infra/src/session_sqlite.rs:1098-1106 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-runtime/src/sop/store/mod.rs:401— crates/zeroclaw-runtime/src/sop/store/mod.rs:401-407 | crates/zeroclaw-runtime/src/sop/store/mod.rs:436-442 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) apps/zerocode/src/enroll.rs:1070— apps/zerocode/src/enroll.rs:1070-1076 | src/bin/zeroclaw-acp-bridge.rs:240-246 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:2589— crates/zeroclaw-channels/src/matrix.rs:2589-2598 | crates/zeroclaw-channels/src/matrix.rs:2600-2606 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-runtime/src/quickstart/mod.rs:46— crates/zeroclaw-runtime/src/quickstart/mod.rs:46-54 | REDACTED:1136-1142 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:12946— crates/zeroclaw-runtime/src/rpc/dispatch.rs:12946-12952 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:12954-12963 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-tools/src/mcp_transport.rs:2149— crates/zeroclaw-tools/src/mcp_transport.rs:2149-2155 | crates/zeroclaw-tools/src/mcp_transport.rs:2159-2165 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-gateway/src/api_sop_author.rs:29— crates/zeroclaw-gateway/src/api_sop_author.rs:29-36 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:12928-12934 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-gateway/src/dashboard_core.rs:282— crates/zeroclaw-gateway/src/dashboard_core.rs:282-288 | crates/zeroclaw-gateway/src/dashboard_core.rs:306-315 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:2127— crates/zeroclaw-runtime/src/sop/engine.rs:2127-2133 | crates/zeroclaw-runtime/src/sop/engine.rs:2204-2215 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/api.rs:59— crates/zeroclaw-channels/src/git/providers/gitea/api.rs:59-65 | crates/zeroclaw-channels/src/git/providers/github/api.rs:90-97 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-tools/src/microsoft365/graph_client.rs:400— crates/zeroclaw-tools/src/microsoft365/graph_client.rs:400-407 | crates/zeroclaw-runtime/src/agent/history_pruner.rs:118-124 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-channels/src/transcription.rs:705— crates/zeroclaw-channels/src/transcription.rs:705-711 | crates/zeroclaw-channels/src/tts.rs:212-218 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) REDACTED:479— REDACTED:479-485 | crates/zeroclaw-runtime/src/sop/mod.rs:1673-1679 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-runtime/src/identity.rs:679— crates/zeroclaw-runtime/src/identity.rs:679-685 | crates/zeroclaw-runtime/src/sop/condition.rs:319-325 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-runtime/src/quickstart/mod.rs:2328— crates/zeroclaw-runtime/src/quickstart/mod.rs:2328-2335 | crates/zeroclaw-runtime/src/sop/approval/channel_route.rs:74-80 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-api/src/tool.rs:525— crates/zeroclaw-api/src/tool.rs:525-531 | crates/zeroclaw-runtime/src/agent/mod.rs:48-54 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/api.rs:47— crates/zeroclaw-channels/src/git/providers/gitea/api.rs:47-53 | crates/zeroclaw-channels/src/git/providers/github/api.rs:75-82 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-tools/src/backup_tool.rs:28— crates/zeroclaw-tools/src/backup_tool.rs:28-34 | crates/zeroclaw-tools/src/data_management.rs:22-28 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-hardware/src/peripherals/arduino_flash.rs:28— crates/zeroclaw-hardware/src/peripherals/arduino_flash.rs:28-34 | crates/zeroclaw-hardware/src/peripherals/nucleo_flash.rs:13-19 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) crates/zeroclaw-channels/src/wecom_ws.rs:1968— crates/zeroclaw-channels/src/wecom_ws.rs:1968-1974 | crates/zeroclaw-runtime/src/skills/suggestions.rs:347-353 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×20
Edited copy of a member (17 corresponding lines) crates/zeroclaw-config/src/providers.rs:256— crates/zeroclaw-config/src/providers.rs:256-272 | crates/zeroclaw-config/src/providers.rs:278-294 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-runtime/src/agent/loop_.rs:368— crates/zeroclaw-runtime/src/agent/loop_.rs:368-393 | src/main.rs:69-85 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) apps/zerocode/src/zerocode_pane.rs:1985— apps/zerocode/src/zerocode_pane.rs:1985-2002 | apps/zerocode/src/zerocode_pane.rs:2031-2047 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:11702— crates/zeroclaw-runtime/src/rpc/dispatch.rs:11702-11718 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:11720-11737 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-rpc-client/src/client.rs:642— crates/zeroclaw-rpc-client/src/client.rs:642-660 | crates/zeroclaw-runtime/src/rpc/local.rs:196-212 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:9901— crates/zeroclaw-runtime/src/rpc/dispatch.rs:9901-9917 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:9919-9935 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) src/commands/update.rs:804— src/commands/update.rs:804-825 | xtask/src/cmd/mdbook/linkcheck.rs:66-82 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-memory/src/response_cache.rs:238— crates/zeroclaw-memory/src/response_cache.rs:238-258 | crates/zeroclaw-runtime/src/heartbeat/store.rs:113-129 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) apps/zerocode/src/chat.rs:11037— apps/zerocode/src/chat.rs:11037-11053 | apps/zerocode/src/chat.rs:11058-11075 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:50— crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:50-66 | crates/zeroclaw-channels/src/git/providers/github/mapping.rs:60-76 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-runtime/src/sop/approval/broker.rs:238— crates/zeroclaw-runtime/src/sop/approval/broker.rs:238-254 | crates/zeroclaw-runtime/src/sop/approval/broker.rs:300-316 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-providers/src/compatible.rs:3092— crates/zeroclaw-providers/src/compatible.rs:3092-3114 | crates/zeroclaw-providers/src/openai.rs:355-371 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-tools/src/mcp_client.rs:798— crates/zeroclaw-tools/src/mcp_client.rs:798-814 | crates/zeroclaw-tools/src/mcp_client.rs:834-850 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-memory/src/knowledge_graph.rs:298— crates/zeroclaw-memory/src/knowledge_graph.rs:298-314 | crates/zeroclaw-memory/src/knowledge_graph.rs:361-388 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-runtime/src/tools/mod.rs:1382— crates/zeroclaw-runtime/src/tools/mod.rs:1382-1398 | crates/zeroclaw-runtime/src/tools/mod.rs:1400-1422 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-runtime/src/live_config_authority.rs:1311— crates/zeroclaw-runtime/src/live_config_authority.rs:1311-1328 | crates/zeroclaw-runtime/src/live_config_authority.rs:1333-1349 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-providers/src/auth/profiles.rs:90— crates/zeroclaw-providers/src/auth/profiles.rs:90-106 | crates/zeroclaw-providers/src/auth/profiles.rs:108-124 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-tools/src/microsoft365/graph_client.rs:27— crates/zeroclaw-tools/src/microsoft365/graph_client.rs:27-46 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:111-127 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:1424— crates/zeroclaw-runtime/src/rpc/dispatch.rs:1424-1440 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:2056-2072 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) xtask/src/generate/spec.rs:972— xtask/src/generate/spec.rs:972-990 | xtask/src/generate/spec.rs:1176-1192 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×20
Edited copy of a member (18 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:41— crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:41-59 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:102-119 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) xtask/src/cmd/mdbook/peer_groups.rs:51— xtask/src/cmd/mdbook/peer_groups.rs:51-71 | xtask/src/cmd/mdbook/placeholders.rs:13-30 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) REDACTED:1033— REDACTED:1033-1050 | REDACTED:1140-1158 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-channels/src/nextcloud_talk.rs:533— crates/zeroclaw-channels/src/nextcloud_talk.rs:533-550 | crates/zeroclaw-channels/src/nextcloud_talk.rs:557-576 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-tools/src/data_management.rs:62— crates/zeroclaw-tools/src/data_management.rs:62-79 | crates/zeroclaw-tools/src/data_management.rs:81-100 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-channels/src/whatsapp_storage.rs:1416— crates/zeroclaw-channels/src/whatsapp_storage.rs:1416-1443 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1504-1521 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-providers/src/hailo_ollama.rs:533— crates/zeroclaw-providers/src/hailo_ollama.rs:533-550 | crates/zeroclaw-providers/src/ollama.rs:381-404 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-runtime/src/service/mod.rs:1926— crates/zeroclaw-runtime/src/service/mod.rs:1926-1944 | crates/zeroclaw-runtime/src/service/mod.rs:2014-2031 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-runtime/src/live_config_authority.rs:1154— crates/zeroclaw-runtime/src/live_config_authority.rs:1154-1171 | crates/zeroclaw-runtime/src/live_config_authority.rs:1198-1217 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-gateway/src/ws.rs:1411— crates/zeroclaw-gateway/src/ws.rs:1411-1428 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:14660-14681 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-memory/src/chunker.rs:129— crates/zeroclaw-memory/src/chunker.rs:129-149 | crates/zeroclaw-memory/src/chunker.rs:152-169 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) apps/zerocode/src/quickstart_pane.rs:2618— apps/zerocode/src/quickstart_pane.rs:2618-2641 | apps/zerocode/src/quickstart_pane.rs:2647-2664 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-channels/src/slack.rs:2732— crates/zeroclaw-channels/src/slack.rs:2732-2757 | crates/zeroclaw-runtime/src/tools/shell.rs:154-171 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-channels/src/discord/mod.rs:398— crates/zeroclaw-channels/src/discord/mod.rs:398-415 | crates/zeroclaw-channels/src/whatsapp_web.rs:1608-1632 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-macros/src/lib.rs:2684— crates/zeroclaw-macros/src/lib.rs:2684-2701 | crates/zeroclaw-macros/src/lib.rs:2776-2793 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:1496— crates/zeroclaw-runtime/src/cron/store.rs:1496-1513 | crates/zeroclaw-runtime/src/heartbeat/store.rs:176-193 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-gateway/src/api_pairing.rs:328— crates/zeroclaw-gateway/src/api_pairing.rs:328-348 | crates/zeroclaw-gateway/src/canvas.rs:41-58 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-providers/src/ollama.rs:922— crates/zeroclaw-providers/src/ollama.rs:922-942 | crates/zeroclaw-providers/src/ollama.rs:953-970 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-gateway/src/a2a.rs:372— crates/zeroclaw-gateway/src/a2a.rs:372-389 | crates/zeroclaw-gateway/src/a2a.rs:414-431 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) crates/zeroclaw-runtime/src/agent/loop_.rs:1557— crates/zeroclaw-runtime/src/agent/loop_.rs:1557-1574 | crates/zeroclaw-runtime/src/agent/system_prompt.rs:228-246 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
TelegramChannel::markdown_to_telegram_html (cognitive 62) crates/zeroclaw-channels/src/telegram.rs:6189— 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:8553— 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:3143— 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 35) crates/zeroclaw-channels/src/telegram.rs:4790— TelegramChannel::handle_unauthorized_message has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (24 pts), match/switch 2 (8 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.
TelegramChannel::process_model_picker_callback (cognitive 26) crates/zeroclaw-channels/src/telegram.rs:2087— 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:2523— 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:5650— 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:6067— 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:8069— 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:8237— 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:4044— 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:7731— 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:3005— 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:4208— 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:4561— 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:7403— 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:7176— 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:5471— 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:6356— 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.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×19
Edited copy of a member (15 corresponding lines) crates/zeroclaw-config/src/schema/v2.rs:2232— crates/zeroclaw-config/src/schema/v2.rs:2232-2246 | crates/zeroclaw-config/src/schema/v2.rs:2834-2848 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-runtime/src/sop/audit.rs:77— crates/zeroclaw-runtime/src/sop/audit.rs:77-91 | crates/zeroclaw-runtime/src/sop/audit.rs:220-234 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:181— crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:181-195 | crates/zeroclaw-tool-call-parser/src/lib.rs:705-719 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-gateway/src/api.rs:470— crates/zeroclaw-gateway/src/api.rs:470-484 | crates/zeroclaw-gateway/src/api.rs:886-900 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-providers/src/openai.rs:1246— crates/zeroclaw-providers/src/openai.rs:1246-1260 | crates/zeroclaw-providers/src/openai.rs:1276-1290 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-infra/src/net_guard.rs:577— crates/zeroclaw-infra/src/net_guard.rs:577-591 | crates/zeroclaw-infra/src/net_guard.rs:602-619 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-gateway/src/api_browse.rs:38— crates/zeroclaw-gateway/src/api_browse.rs:38-52 | crates/zeroclaw-gateway/src/api_browse.rs:118-132 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:68— crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:68-82 | crates/zeroclaw-channels/src/git/providers/github/mapping.rs:120-134 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-infra/src/net_guard.rs:528— crates/zeroclaw-infra/src/net_guard.rs:528-542 | crates/zeroclaw-infra/src/net_guard.rs:544-560 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-runtime/src/cron/mod.rs:97— crates/zeroclaw-runtime/src/cron/mod.rs:97-111 | src/cron/mod.rs:22-40 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) apps/zerocode/src/secure_file.rs:49— apps/zerocode/src/secure_file.rs:49-63 | REDACTED:2395-2416 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:4458— crates/zeroclaw-runtime/src/sop/engine.rs:4458-4473 | crates/zeroclaw-runtime/src/sop/engine.rs:5718-5732 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-runtime/src/agent/agent.rs:2480— crates/zeroclaw-runtime/src/agent/agent.rs:2480-2494 | crates/zeroclaw-runtime/src/agent/agent.rs:2509-2529 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-providers/src/azure_openai.rs:379— crates/zeroclaw-providers/src/azure_openai.rs:379-393 | crates/zeroclaw-providers/src/openai_codex.rs:251-269 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-tools/src/mcp_client.rs:817— crates/zeroclaw-tools/src/mcp_client.rs:817-831 | crates/zeroclaw-tools/src/mcp_client.rs:857-874 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-providers/src/bedrock.rs:777— crates/zeroclaw-providers/src/bedrock.rs:777-791 | crates/zeroclaw-providers/src/bedrock.rs:796-810 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-rpc-client/src/client.rs:151— crates/zeroclaw-rpc-client/src/client.rs:151-166 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:12709-12723 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-channels/src/discord/mod.rs:1457— crates/zeroclaw-channels/src/discord/mod.rs:1457-1471 | crates/zeroclaw-channels/src/signal.rs:990-1004 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) crates/zeroclaw-runtime/src/agent/loop_.rs:3598— crates/zeroclaw-runtime/src/agent/loop_.rs:3598-3612 | crates/zeroclaw-runtime/src/tools/delegate.rs:3093-3107 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×19
Edited copy of a member (11 corresponding lines) crates/zeroclaw-runtime/src/skills/document.rs:64— crates/zeroclaw-runtime/src/skills/document.rs:64-74 | crates/zeroclaw-runtime/src/skills/mod.rs:1648-1660 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-config/src/schema.rs:8784— crates/zeroclaw-config/src/schema.rs:8784-8795 | crates/zeroclaw-tools/src/microsoft365/types.rs:16-26 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) apps/tauri/src/daemon.rs:551— apps/tauri/src/daemon.rs:551-561 | apps/tauri/src/daemon.rs:564-576 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-tools/src/a2a_client.rs:2070— crates/zeroclaw-tools/src/a2a_client.rs:2070-2080 | crates/zeroclaw-tools/src/a2a_client.rs:2117-2127 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) apps/zerocode/src/doctor.rs:446— apps/zerocode/src/doctor.rs:446-456 | apps/zerocode/src/file_explorer.rs:267-277 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-channels/src/bluesky.rs:232— crates/zeroclaw-channels/src/bluesky.rs:232-242 | crates/zeroclaw-channels/src/reddit.rs:157-167 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-channels/src/lark.rs:682— crates/zeroclaw-channels/src/lark.rs:682-692 | crates/zeroclaw-channels/src/lark.rs:697-708 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-runtime/src/tools/skill_http.rs:73— crates/zeroclaw-runtime/src/tools/skill_http.rs:73-83 | crates/zeroclaw-runtime/src/tools/skill_tool.rs:141-151 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-gateway/src/api_personality.rs:125— crates/zeroclaw-gateway/src/api_personality.rs:125-135 | crates/zeroclaw-runtime/src/agent/personality.rs:167-177 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-gateway/src/api_oidc.rs:788— crates/zeroclaw-gateway/src/api_oidc.rs:788-798 | crates/zeroclaw-infra/src/net_guard.rs:1148-1160 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-channels/src/link_enricher.rs:66— crates/zeroclaw-channels/src/link_enricher.rs:66-77 | crates/zeroclaw-hardware/src/datasheet.rs:89-99 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-config/src/providers.rs:372— crates/zeroclaw-config/src/providers.rs:372-390 | crates/zeroclaw-providers/src/factory.rs:594-604 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-plugins/src/wasm_memory.rs:428— crates/zeroclaw-plugins/src/wasm_memory.rs:428-438 | crates/zeroclaw-plugins/src/wasm_memory.rs:454-467 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-config/src/schema.rs:14196— crates/zeroclaw-config/src/schema.rs:14196-14207 | src/security_status.rs:420-430 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-providers/src/openai.rs:756— crates/zeroclaw-providers/src/openai.rs:756-766 | crates/zeroclaw-providers/src/openrouter.rs:602-614 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) apps/zerocode/src/chat.rs:8546— apps/zerocode/src/chat.rs:8546-8559 | apps/zerocode/src/chat.rs:8617-8627 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) apps/zerocode/src/client.rs:949— apps/zerocode/src/client.rs:949-959 | crates/zeroclaw-gateway/src/lib.rs:1100-1110 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-config/src/schema.rs:8876— crates/zeroclaw-config/src/schema.rs:8876-8886 | crates/zeroclaw-tools/src/browser.rs:44-54 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) crates/zeroclaw-providers/src/model_pin.rs:231— crates/zeroclaw-providers/src/model_pin.rs:231-241 | crates/zeroclaw-providers/src/vision_override.rs:239-249 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×18
Edited copy of a member (8 corresponding lines) apps/zerocode/src/config/mod.rs:1763— apps/zerocode/src/config/mod.rs:1763-1775 | apps/zerocode/src/config/mod.rs:1783-1790 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:4895— crates/zeroclaw-channels/src/matrix.rs:4895-4902 | crates/zeroclaw-channels/src/matrix.rs:4904-4911 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-gateway/src/nodes/mdns.rs:380— crates/zeroclaw-gateway/src/nodes/mdns.rs:380-388 | src/plugin_registry.rs:51-58 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-runtime/src/sop/mod.rs:493— crates/zeroclaw-runtime/src/sop/mod.rs:493-504 | crates/zeroclaw-runtime/src/sop/mod.rs:506-513 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-gateway/src/api_oidc.rs:259— crates/zeroclaw-gateway/src/api_oidc.rs:259-267 | crates/zeroclaw-gateway/src/api_oidc.rs:292-299 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-runtime/src/tools/mod.rs:1619— crates/zeroclaw-runtime/src/tools/mod.rs:1619-1626 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:703-718 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:5412— crates/zeroclaw-channels/src/matrix.rs:5412-5419 | crates/zeroclaw-channels/src/matrix.rs:5421-5428 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-runtime/src/tools/param_options.rs:132— crates/zeroclaw-runtime/src/tools/param_options.rs:132-140 | crates/zeroclaw-runtime/src/tools/param_options.rs:142-149 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-channels/src/telegram.rs:3931— crates/zeroclaw-channels/src/telegram.rs:3931-3939 | crates/zeroclaw-channels/src/wechat.rs:1337-1344 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:774— crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:774-781 | crates/zeroclaw-channels/src/matrix.rs:1869-1876 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-runtime/src/migration.rs:332— crates/zeroclaw-runtime/src/migration.rs:332-339 | src/memory/cli.rs:452-459 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-channels/src/discord/slash_options.rs:230— crates/zeroclaw-channels/src/discord/slash_options.rs:230-237 | crates/zeroclaw-runtime/src/sop/condition.rs:327-334 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-gateway/src/api_config.rs:294— crates/zeroclaw-gateway/src/api_config.rs:294-301 | src/main.rs:829-838 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) apps/zerocode/src/quickstart_pane.rs:751— apps/zerocode/src/quickstart_pane.rs:751-759 | src/main.rs:1814-1821 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-runtime/src/security/bubblewrap.rs:31— crates/zeroclaw-runtime/src/security/bubblewrap.rs:31-38 | crates/zeroclaw-runtime/src/security/firejail.rs:130-137 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) apps/zerocode/src/client_crypto.rs:61— apps/zerocode/src/client_crypto.rs:61-68 | crates/zeroclaw-tls/src/lib.rs:473-480 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-channels/src/mochat.rs:36— crates/zeroclaw-channels/src/mochat.rs:36-45 | crates/zeroclaw-channels/src/twitter.rs:33-40 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:362— crates/zeroclaw-channels/src/matrix.rs:362-369 | crates/zeroclaw-channels/src/orchestrator/mod.rs:2487-2494 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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:237-241 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:401` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:1252— crates/zeroclaw-channels/src/discord/mod.rs:1252-1257 | crates/zeroclaw-channels/src/discord/mod.rs:1298-1303 | crates/zeroclaw-channels/src/discord/mod.rs:1375-1379 | crates/zeroclaw-channels/src/discord/mod.rs:1398-1402 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:1252` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/discord/rest.rs:104— crates/zeroclaw-channels/src/discord/rest.rs:104-108 | crates/zeroclaw-tools/src/image_info.rs:191-195 | crates/zeroclaw-tools/src/image_info.rs:217-221 | crates/zeroclaw-tools/src/pushover.rs:47-51 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/rest.rs:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 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:2392-2396 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2815-2820 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2874-2879 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:632` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:1596` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/slack.rs:1595` calls `from_str`, `unwrap_or_default` and `crates/zeroclaw-channels/src/slack.rs:4831` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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:6317-6321 | crates/zeroclaw-runtime/src/sop/engine.rs:6353-6357 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wechat.rs:2045` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) crates/zeroclaw-gateway/src/acp.rs:75— crates/zeroclaw-gateway/src/acp.rs:75-79 | crates/zeroclaw-runtime/src/sop/mod.rs:189-193 | crates/zeroclaw-tools/src/file_download.rs:281-285 | src/main.rs:10352-10359 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/acp.rs:75` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 4) crates/zeroclaw-runtime/src/agent/loop_.rs:2237— crates/zeroclaw-runtime/src/agent/loop_.rs:2237-2244 | crates/zeroclaw-runtime/src/agent/loop_.rs:2829-2836 | crates/zeroclaw-runtime/src/agent/loop_.rs:4226-4230 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 4) crates/zeroclaw-tools/src/browser_open.rs:110— crates/zeroclaw-tools/src/browser_open.rs:110-114 | crates/zeroclaw-tools/src/http_request.rs:566-570 | crates/zeroclaw-tools/src/text_browser.rs:298-302 | crates/zeroclaw-tools/src/web_fetch.rs:449-453 — 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 9 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/browser_open.rs:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 4) crates/zeroclaw-channels/src/orchestrator/mod.rs:1378— crates/zeroclaw-channels/src/orchestrator/mod.rs:1378-1384 | crates/zeroclaw-runtime/src/sop/approval/timeout.rs:48-54 | crates/zeroclaw-runtime/src/sop/executor.rs:1078-1088 | src/main.rs:813-817 — before extracting anything, compare `crates/zeroclaw-runtime/src/sop/approval/timeout.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 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:1378` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) crates/zeroclaw-config/src/env_overrides.rs:182— crates/zeroclaw-config/src/env_overrides.rs:182-186 | crates/zeroclaw-config/src/schema.rs:25097-25105 | crates/zeroclaw-runtime/src/sop/engine.rs:1350-1354 | crates/zeroclaw-runtime/src/sop/engine.rs:1826-1831 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/env_overrides.rs:182` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) 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:1086-1090 | src/main.rs:16032-16039 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/git/channel.rs:555` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) crates/zeroclaw-config/src/pairing.rs:267— crates/zeroclaw-config/src/pairing.rs:267-274 | 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 9 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/pairing.rs:267` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) crates/zeroclaw-config/src/env_overrides.rs:182— crates/zeroclaw-config/src/env_overrides.rs:182-186 | crates/zeroclaw-gateway/src/ws.rs:1338-1342 | crates/zeroclaw-runtime/src/sop/engine.rs:1800-1804 | crates/zeroclaw-runtime/src/sop/engine.rs:1826-1831 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/env_overrides.rs:182` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 4) crates/zeroclaw-runtime/src/agent/loop_.rs:1521— crates/zeroclaw-runtime/src/agent/loop_.rs:1521-1526 | crates/zeroclaw-runtime/src/agent/loop_.rs:1919-1923 | crates/zeroclaw-runtime/src/agent/turn/context_recovery.rs:216-221 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:7625-7630 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:1521` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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:1423-1428 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1444-1449 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1463-1468 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1465` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/cron/scheduler.rs:1442` calls `Some` and `crates/zeroclaw-runtime/src/cron/scheduler.rs:1422` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 4) crates/zeroclaw-config/src/secrets.rs:868— crates/zeroclaw-config/src/secrets.rs:868-873 | crates/zeroclaw-hardware/src/subprocess.rs:160-164 | crates/zeroclaw-providers/src/gemini_cli.rs:134-138 | crates/zeroclaw-providers/src/kilocli.rs:131-135 — 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 17 separate duplicated blocks between them, totalling at least 164 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/secrets.rs:868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/gemini_oauth.rs:459` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
App::handle_mouse_inner (cyclomatic 52) apps/zerocode/src/config_manager.rs:1385— App::handle_mouse_inner has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App::handle_field_list (cyclomatic 31) apps/zerocode/src/config_manager.rs:3491— 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_key_inner (cyclomatic 30) apps/zerocode/src/config_manager.rs:1233— App::handle_key_inner 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.
App::handle_alias_list (cyclomatic 27) apps/zerocode/src/config_manager.rs:2833— 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:4547— 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:6073— 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_alias_rename (cyclomatic 22) apps/zerocode/src/config_manager.rs:3347— 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:5046— 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:5355— 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::bottom_hint (cyclomatic 20) apps/zerocode/src/config_manager.rs:980— App::bottom_hint 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::set_visible_cursor (cyclomatic 20) apps/zerocode/src/config_manager.rs:1900— 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_paste (cyclomatic 19) apps/zerocode/src/config_manager.rs:5902— App::handle_paste 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.
App::handle_personality_tab (cyclomatic 18) apps/zerocode/src/config_manager.rs:3747— App::handle_personality_tab 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_skills_tab (cyclomatic 17) apps/zerocode/src/config_manager.rs:3944— App::handle_skills_tab 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::handle_filter_key (cyclomatic 17) apps/zerocode/src/config_manager.rs:4409— 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_select_edit (cyclomatic 16) apps/zerocode/src/config_manager.rs:4675— App::handle_select_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.
App::draw_field_edit (cyclomatic 16) apps/zerocode/src/config_manager.rs:5711— 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.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×17
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:896-1039 — 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-api/src/model_provider.rs:870— crates/zeroclaw-api/src/model_provider.rs:870-921 | crates/zeroclaw-providers/src/compatible.rs:3900-3922 | crates/zeroclaw-providers/src/hailo_ollama.rs:939-962 | crates/zeroclaw-providers/src/ollama.rs:501-523 | crates/zeroclaw-runtime/src/agent/history.rs:301-317 — 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/matrix.rs:3801— crates/zeroclaw-channels/src/matrix.rs:3801-3845 | crates/zeroclaw-channels/src/matrix.rs:3852-3867 | crates/zeroclaw-channels/src/matrix.rs:3913-3929 | crates/zeroclaw-config/src/policy.rs:5742-5810 | crates/zeroclaw-tls/src/lib.rs:568-585 — 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-1496 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1498-1777 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2424-2446 — 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_oidc.rs:540— crates/zeroclaw-gateway/src/api_oidc.rs:540-560 | crates/zeroclaw-gateway/src/api_oidc.rs:623-686 | crates/zeroclaw-gateway/src/api_oidc.rs:843-918 | crates/zeroclaw-gateway/src/api_oidc.rs:1008-1116 | crates/zeroclaw-gateway/src/api_oidc.rs:1127-1156 — 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:671— crates/zeroclaw-gateway/src/api_pairing.rs:671-716 | 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) REDACTED:1295— REDACTED:1295-1353 | REDACTED:1359-1420 | REDACTED:1422-1545 | REDACTED:2998-3056 | crates/zeroclaw-memory/src/sqlite.rs:1058-1450 — 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-infra/src/session_sqlite.rs:1228— crates/zeroclaw-infra/src/session_sqlite.rs:1228-1276 | crates/zeroclaw-infra/src/session_sqlite.rs:1542-1583 | crates/zeroclaw-infra/src/session_sqlite.rs:1635-1681 | crates/zeroclaw-infra/src/session_sqlite.rs:1683-1733 | crates/zeroclaw-infra/src/session_sqlite.rs:1735-1805 — 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-memory/src/sqlite.rs:979— crates/zeroclaw-memory/src/sqlite.rs:979-1048 | crates/zeroclaw-memory/src/sqlite.rs:1593-1615 | crates/zeroclaw-memory/src/sqlite.rs:1671-1710 | crates/zeroclaw-memory/src/sqlite.rs:1762-1831 | crates/zeroclaw-memory/src/sqlite.rs:2463-2537 — 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:99-553 | crates/zeroclaw-runtime/src/agent/turn/parse_response.rs:201-333 | 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:174— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:174-204 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:210-262 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:268-306 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:308-344 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:351-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-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/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) 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:699-724 | 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.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×17
Edited copy of a member (16 corresponding lines) crates/zeroclaw-channels/src/telegram.rs:3388— crates/zeroclaw-channels/src/telegram.rs:3388-3403 | crates/zeroclaw-channels/src/whatsapp_web.rs:666-681 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) REDACTED:2597— REDACTED:2597-2612 | REDACTED:2780-2798 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:424— crates/zeroclaw-infra/src/session_sqlite.rs:424-449 | crates/zeroclaw-log/src/migrate.rs:210-225 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-runtime/src/quickstart/mod.rs:1518— crates/zeroclaw-runtime/src/quickstart/mod.rs:1518-1534 | crates/zeroclaw-runtime/src/quickstart/mod.rs:1536-1551 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) xtask/src/cmd/mdbook/seo.rs:431— xtask/src/cmd/mdbook/seo.rs:431-454 | xtask/src/cmd/mdbook/versions.rs:173-188 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:937— crates/zeroclaw-infra/src/session_sqlite.rs:937-957 | crates/zeroclaw-infra/src/session_sqlite.rs:1211-1226 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-tools/src/mcp_client.rs:1412— crates/zeroclaw-tools/src/mcp_client.rs:1412-1427 | crates/zeroclaw-tools/src/mcp_client.rs:1435-1450 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-gateway/src/api_browse.rs:54— crates/zeroclaw-gateway/src/api_browse.rs:54-69 | crates/zeroclaw-gateway/src/api_skills.rs:337-354 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-plugins/src/wasi_http.rs:209— crates/zeroclaw-plugins/src/wasi_http.rs:209-225 | crates/zeroclaw-plugins/src/wasi_http.rs:233-248 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-infra/src/net_guard.rs:319— crates/zeroclaw-infra/src/net_guard.rs:319-334 | crates/zeroclaw-infra/src/net_guard.rs:767-790 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-runtime/src/service/mod.rs:2824— crates/zeroclaw-runtime/src/service/mod.rs:2824-2839 | crates/zeroclaw-runtime/src/service/mod.rs:2847-2863 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) apps/zerocode/src/oidc_enroll.rs:210— apps/zerocode/src/oidc_enroll.rs:210-226 | apps/zerocode/src/oidc_enroll.rs:241-256 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) apps/zerocode/src/chat.rs:10412— apps/zerocode/src/chat.rs:10412-10433 | apps/zerocode/src/chat.rs:10553-10568 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:5045— crates/zeroclaw-channels/src/matrix.rs:5045-5060 | crates/zeroclaw-channels/src/matrix.rs:5067-5082 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-runtime/src/security/bubblewrap.rs:97— crates/zeroclaw-runtime/src/security/bubblewrap.rs:97-112 | crates/zeroclaw-runtime/src/security/firejail.rs:195-212 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-runtime/src/sop/binding.rs:86— crates/zeroclaw-runtime/src/sop/binding.rs:86-101 | crates/zeroclaw-runtime/src/sop/binding.rs:243-262 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) crates/zeroclaw-tools/src/web_search_tool.rs:257— crates/zeroclaw-tools/src/web_search_tool.rs:257-272 | crates/zeroclaw-tools/src/web_search_tool.rs:311-326 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×17
Edited copy of a member (13 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:13402— crates/zeroclaw-runtime/src/rpc/dispatch.rs:13402-13415 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:13417-13429 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-providers/src/factory.rs:1855— crates/zeroclaw-providers/src/factory.rs:1855-1867 | crates/zeroclaw-providers/src/factory.rs:1927-1939 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) apps/zerorelay/src/lib.rs:1953— apps/zerorelay/src/lib.rs:1953-1965 | crates/zeroclaw-runtime/src/relay.rs:1504-1518 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-runtime/src/skills/mod.rs:1334— crates/zeroclaw-runtime/src/skills/mod.rs:1334-1347 | crates/zeroclaw-runtime/src/skills/mod.rs:3082-3094 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-tools/src/text_browser.rs:98— crates/zeroclaw-tools/src/text_browser.rs:98-110 | crates/zeroclaw-tools/src/web_fetch.rs:85-104 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:2807— crates/zeroclaw-runtime/src/sop/engine.rs:2807-2819 | crates/zeroclaw-runtime/src/sop/engine.rs:2821-2833 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) apps/zerocode/src/input_bar.rs:1372— apps/zerocode/src/input_bar.rs:1372-1384 | apps/zerocode/src/input_bar.rs:1387-1400 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-gateway/src/api_sections.rs:22— crates/zeroclaw-gateway/src/api_sections.rs:22-35 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:12134-12146 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) src/plugins/channel_instance.rs:235— src/plugins/channel_instance.rs:235-250 | src/plugins/channel_instance.rs:260-272 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-plugins/src/component_state.rs:35— crates/zeroclaw-plugins/src/component_state.rs:35-47 | crates/zeroclaw-plugins/src/component_state.rs:78-90 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-gateway/src/lib.rs:132— crates/zeroclaw-gateway/src/lib.rs:132-145 | crates/zeroclaw-runtime/src/rpc/local.rs:153-165 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-runtime/src/security/estop.rs:261— crates/zeroclaw-runtime/src/security/estop.rs:261-273 | crates/zeroclaw-tools/src/http_request.rs:263-279 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-tools/src/email_read.rs:172— crates/zeroclaw-tools/src/email_read.rs:172-184 | xtask/src/cmd/mdbook/seo.rs:352-364 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) xtask/src/cmd/mdbook/linkcheck.rs:121— xtask/src/cmd/mdbook/linkcheck.rs:121-133 | crates/zeroclaw-config/src/paths.rs:21-33 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-runtime/src/tools/cron_add.rs:109— crates/zeroclaw-runtime/src/tools/cron_add.rs:109-123 | crates/zeroclaw-runtime/src/tools/cron_common.rs:111-123 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) crates/zeroclaw-tools/src/backup_tool.rs:54— crates/zeroclaw-tools/src/backup_tool.rs:54-67 | crates/zeroclaw-tools/src/data_management.rs:42-54 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) REDACTED:683— REDACTED:683-701 | crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:781-793 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (10 lines × 3) apps/zerocode/src/config_manager.rs:3124— apps/zerocode/src/config_manager.rs:3124-3133 | apps/zerocode/src/config_manager.rs:3783-3792 | apps/zerocode/src/config_manager.rs:3980-3989 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:3124` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/telegram.rs:4270— crates/zeroclaw-channels/src/telegram.rs:4270-4279 | crates/zeroclaw-channels/src/telegram.rs:4339-4348 | crates/zeroclaw-channels/src/whatsapp_web.rs:3789-3798 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:4270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) crates/zeroclaw-channels/src/telegram.rs:6597— crates/zeroclaw-channels/src/telegram.rs:6597-6606 | crates/zeroclaw-channels/src/telegram.rs:7065-7074 | crates/zeroclaw-channels/src/telegram.rs:7107-7116 — 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:256— crates/zeroclaw-gateway/src/api_skills.rs:256-265 | crates/zeroclaw-gateway/src/api_skills.rs:286-295 | crates/zeroclaw-gateway/src/api_skills.rs:314-323 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_skills.rs:256` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-gateway/src/api_skills.rs:283` calls `Json` and `crates/zeroclaw-gateway/src/api_skills.rs:253` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:4005` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) crates/zeroclaw-runtime/src/tools/deliver_file.rs:244— crates/zeroclaw-runtime/src/tools/deliver_file.rs:244-253 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/notion_tool.rs:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) crates/zeroclaw-hardware/src/pico_code.rs:167— crates/zeroclaw-hardware/src/pico_code.rs:167-176 | crates/zeroclaw-hardware/src/pico_code.rs:288-297 | crates/zeroclaw-hardware/src/pico_code.rs:473-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/pico_code.rs:167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) apps/zerocode/src/chat.rs:6987— apps/zerocode/src/chat.rs:6987-6996 | 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:189-198 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3551` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:5130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/dingtalk.rs:267` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:2263` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:4247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-plugins/src/wasm_memory.rs:228` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 3) crates/zeroclaw-runtime/src/sop/engine.rs:3800— crates/zeroclaw-runtime/src/sop/engine.rs:3800-3809 | crates/zeroclaw-runtime/src/sop/engine.rs:3854-3863 | crates/zeroclaw-runtime/src/sop/engine.rs:3895-3904 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:3800` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
RpcDispatcher::session_new_with_mode (cognitive 157) crates/zeroclaw-runtime/src/rpc/dispatch.rs:4484— RpcDispatcher::session_new_with_mode has cognitive complexity 157 (threshold 15). Drivers by points: if/else 60 (114 pts), match/switch 12 (26 pts), boolean chains 13, 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 118) crates/zeroclaw-runtime/src/rpc/dispatch.rs:6590— RpcDispatcher::run_session_prompt has cognitive complexity 118 (threshold 15). Drivers by points: if/else 48 (69 pts), match/switch 23 (34 pts), boolean chains 13, loops 1 (2 pts) (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.
RpcDispatcher::handle_session_messages_record (cognitive 58) crates/zeroclaw-runtime/src/rpc/dispatch.rs:8941— RpcDispatcher::handle_session_messages_record 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:10373— 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 27) crates/zeroclaw-runtime/src/rpc/dispatch.rs:12965— RpcDispatcher::handle_sops_run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 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 24) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5989— RpcDispatcher::rehydrate_reaped_session_under_guard has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (16 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:11161— 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:3281— 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:5760— 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:2323— 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::dispatch_method (cognitive 20) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3391— RpcDispatcher::dispatch_method has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 6 (11 pts), if/else 5 (8 pts), boolean chains 1 (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:3215— 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:5579— 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_session_delete (cognitive 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:9250— RpcDispatcher::handle_session_delete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, match/switch 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RpcDispatcher::handle_config_map_key_delete (cognitive 16) crates/zeroclaw-runtime/src/rpc/dispatch.rs:10885— 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:11028— 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· Edited copy of a member (21 corresponding lines) · ×16
Edited copy of a member (21 corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:1056— crates/zeroclaw-infra/src/session_sqlite.rs:1056-1076 | crates/zeroclaw-infra/src/session_sqlite.rs:1426-1446 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:9612— crates/zeroclaw-runtime/src/rpc/dispatch.rs:9612-9635 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:9670-9690 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-tools/src/a2a_client.rs:2081— crates/zeroclaw-tools/src/a2a_client.rs:2081-2101 | crates/zeroclaw-tools/src/a2a_client.rs:2128-2148 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) src/bin/zeroclaw-acp-bridge.rs:192— src/bin/zeroclaw-acp-bridge.rs:192-212 | src/bin/zeroclaw-acp-bridge.rs:214-234 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) apps/zerocode/src/chat.rs:7789— apps/zerocode/src/chat.rs:7789-7815 | apps/zerocode/src/logs.rs:72-92 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-channels/src/bluesky.rs:405— crates/zeroclaw-channels/src/bluesky.rs:405-425 | crates/zeroclaw-channels/src/reddit.rs:203-228 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-gateway/src/ws.rs:1333— crates/zeroclaw-gateway/src/ws.rs:1333-1353 | crates/zeroclaw-gateway/src/ws.rs:1359-1381 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-plugins/src/runtime.rs:105— crates/zeroclaw-plugins/src/runtime.rs:105-125 | crates/zeroclaw-plugins/src/wasm_channel.rs:611-631 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-runtime/src/rpc/session.rs:1811— crates/zeroclaw-runtime/src/rpc/session.rs:1811-1831 | crates/zeroclaw-runtime/src/rpc/session.rs:2594-2614 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:66— crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:66-86 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:126-146 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) apps/zerocode/src/app.rs:3399— apps/zerocode/src/app.rs:3399-3419 | crates/zeroclaw-tools/src/linkedin_client.rs:1250-1274 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-channels/src/qq.rs:955— crates/zeroclaw-channels/src/qq.rs:955-975 | crates/zeroclaw-channels/src/qq.rs:1304-1324 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs:106— crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs:106-126 | crates/zeroclaw-tools/src/http_request.rs:206-228 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-runtime/src/rpc/inproc.rs:65— crates/zeroclaw-runtime/src/rpc/inproc.rs:65-85 | crates/zeroclaw-runtime/src/rpc/local.rs:446-479 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-memory/src/agent_scoped.rs:374— crates/zeroclaw-memory/src/agent_scoped.rs:374-404 | crates/zeroclaw-memory/src/agent_scoped.rs:525-545 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:526— crates/zeroclaw-runtime/src/cron/store.rs:526-546 | crates/zeroclaw-runtime/src/cron/store.rs:552-574 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (18 lines × 2) apps/zerocode/src/chat.rs:4150— apps/zerocode/src/chat.rs:4150-4167 | apps/zerocode/src/chat.rs:4178-4195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/chat.rs:4150` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2609— crates/zeroclaw-channels/src/discord/mod.rs:2609-2626 | crates/zeroclaw-channels/src/discord/mod.rs:3031-3048 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2609` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:67` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2323— crates/zeroclaw-channels/src/telegram.rs:2323-2340 | crates/zeroclaw-channels/src/telegram.rs:2385-2402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:2323` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-log/src/reader.rs:283` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/consolidation.rs:249` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/multimodal.rs:2975` calls `Some`, `get`, `Ok` and `crates/zeroclaw-providers/src/multimodal.rs:2903` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 2) crates/zeroclaw-providers/src/multimodal.rs:4331— crates/zeroclaw-providers/src/multimodal.rs:4331-4348 | crates/zeroclaw-providers/src/multimodal.rs:4378-4395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/multimodal.rs:4331` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) crates/zeroclaw-runtime/src/daemon/mod.rs:2626— crates/zeroclaw-runtime/src/daemon/mod.rs:2626-2643 | crates/zeroclaw-runtime/src/daemon/mod.rs:2752-2769 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/daemon/mod.rs:2626` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:10848— crates/zeroclaw-runtime/src/rpc/dispatch.rs:10848-10865 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:10957-10974 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:10848` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:2647— crates/zeroclaw-runtime/src/sop/engine.rs:2647-2664 | crates/zeroclaw-runtime/src/sop/engine.rs:4938-4955 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:2647` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-runtime/src/sop/engine.rs:4961` calls `resolve_sop_step` and `crates/zeroclaw-runtime/src/sop/engine.rs:2666` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 2) crates/zeroclaw-runtime/src/tools/schedule.rs:457— crates/zeroclaw-runtime/src/tools/schedule.rs:457-474 | crates/zeroclaw-runtime/src/tools/schedule.rs:514-531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/schedule.rs:457` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:137— crates/zeroclaw-tools/src/model_routing_config.rs:137-154 | 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 12 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13986— crates/zeroclaw-channels/src/orchestrator/mod.rs:13986-14003 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15676-15693 — both copies are in the same file, so extract the block into 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/a2a_client.rs:1158` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) apps/zerocode/src/config_manager.rs:2761— apps/zerocode/src/config_manager.rs:2761-2766 | apps/zerocode/src/config_manager.rs:2873-2878 | apps/zerocode/src/config_manager.rs:3510-3515 | apps/zerocode/src/config_manager.rs:4702-4707 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:2761` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:431` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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:7577-7584 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:1964` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) crates/zeroclaw-channels/src/orchestrator/mod.rs:15556— crates/zeroclaw-channels/src/orchestrator/mod.rs:15556-15562 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15855-15861 | crates/zeroclaw-gateway/src/api_oidc.rs:1595-1601 | crates/zeroclaw-runtime/src/sop/decision.rs:421-426 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:15556` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 4) crates/zeroclaw-channels/src/signal.rs:692— crates/zeroclaw-channels/src/signal.rs:692-697 | crates/zeroclaw-channels/src/telegram.rs:2347-2352 | crates/zeroclaw-channels/src/telegram.rs:2410-2415 | crates/zeroclaw-channels/src/telegram.rs:2489-2494 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/signal.rs:692` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) crates/zeroclaw-channels/src/telegram.rs:8484— crates/zeroclaw-channels/src/telegram.rs:8484-8489 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:8484` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2603` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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:2397-2402 | crates/zeroclaw-runtime/src/live_config_authority.rs:256-261 | crates/zeroclaw-runtime/src/live_config_authority.rs:291-296 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/system_prompt.rs:717` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) crates/zeroclaw-runtime/src/rpc/dispatch.rs:6071— crates/zeroclaw-runtime/src/rpc/dispatch.rs:6071-6076 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6132-6137 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6146-6151 | crates/zeroclaw-runtime/src/rpc/orphans.rs:227-232 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:6071` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:185— crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:185-190 | crates/zeroclaw-tools/src/git_operations.rs:1561-1566 | crates/zeroclaw-tools/src/pushover.rs:163-168 | crates/zeroclaw-tools/src/sessions.rs:670-675 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:185` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:184` calls `filter`, `is_empty` and `crates/zeroclaw-tools/src/git_operations.rs:1560` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 4) 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 47 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:437` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) crates/zeroclaw-runtime/src/tools/file_read.rs:102— crates/zeroclaw-runtime/src/tools/file_read.rs:102-107 | crates/zeroclaw-tools/src/file_edit.rs:78-83 | crates/zeroclaw-tools/src/file_write.rs:74-79 | crates/zeroclaw-tools/src/image_info.rs:152-157 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/file_read.rs:102` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) crates/zeroclaw-channels/src/lark.rs:3010— crates/zeroclaw-channels/src/lark.rs:3010-3017 | crates/zeroclaw-channels/src/wechat.rs:1726-1731 | crates/zeroclaw-memory/src/embeddings.rs:149-154 | crates/zeroclaw-memory/src/qdrant.rs:1029-1034 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3010` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/lark.rs:3018` calls `get`, `and_then`, `as_i64` and `crates/zeroclaw-memory/src/qdrant.rs:1036` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 4) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:1769` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/datasheet.rs:499` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
zeroclaw_gateway::run_gateway_with_plugin_webhooks (cyclomatic 88) crates/zeroclaw-gateway/src/lib.rs:1386— zeroclaw_gateway::run_gateway_with_plugin_webhooks has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent 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::handle_socket (cyclomatic 84) crates/zeroclaw-gateway/src/ws.rs:592— zeroclaw_gateway::ws::handle_socket has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent 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 78) crates/zeroclaw-gateway/src/ws.rs:2038— zeroclaw_gateway::ws::process_chat_message has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent 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_oidc_enroll::handle_certificate (cyclomatic 24) crates/zeroclaw-gateway/src/api_oidc_enroll.rs:61— zeroclaw_gateway::api_oidc_enroll::handle_certificate 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_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_config::handle_migrate (cyclomatic 22) crates/zeroclaw-gateway/src/api_config.rs:2985— zeroclaw_gateway::api_config::handle_migrate 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.
zeroclaw_gateway::api::handle_api_cron_patch (cyclomatic 21) crates/zeroclaw-gateway/src/api.rs:747— 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::principal_gate::config_route_auth (cyclomatic 21) crates/zeroclaw-gateway/src/principal_gate.rs:701— zeroclaw_gateway::principal_gate::config_route_auth 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_gateway::handle_webhook (cyclomatic 18) crates/zeroclaw-gateway/src/lib.rs:4061— 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_oidc::finish_pkce_callback (cyclomatic 17) crates/zeroclaw-gateway/src/api_oidc.rs:1458— zeroclaw_gateway::api_oidc::finish_pkce_callback 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_gateway::api::handle_api_cron_add (cyclomatic 16) crates/zeroclaw-gateway/src/api.rs:487— 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.
zeroclaw_gateway::api_oidc::handle_dashboard_sign_in (cyclomatic 16) crates/zeroclaw-gateway/src/api_oidc.rs:999— zeroclaw_gateway::api_oidc::handle_dashboard_sign_in 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.
Chat::handle_mouse (cognitive 208) apps/zerocode/src/chat.rs:5387— 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 194) apps/zerocode/src/chat.rs:4024— Chat::handle_key has cognitive complexity 194 (threshold 15). Drivers by points: if/else 74 (147 pts), match/switch 15 (29 pts), boolean chains 18 (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.
Chat::relay_turn (cognitive 88) crates/zeroclaw-gateway/src/chat_core.rs:564— Chat::relay_turn has cognitive complexity 88 (threshold 15). Drivers by points: if/else 16 (55 pts), match/switch 9 (28 pts), loops 2 (4 pts), boolean chains 1 (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.
Chat::after_session_start (cognitive 54) apps/zerocode/src/chat.rs:2448— 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:3448— 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::serve (cognitive 41) crates/zeroclaw-gateway/src/chat_core.rs:292— Chat::serve has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 5 (11 pts), loops 2, 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.
Chat::start_session_with_cancel (cognitive 37) apps/zerocode/src/chat.rs:2251— 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:2851— 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:3132— 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:1346— 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:6087— 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:2752— 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:2161— 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:5348— 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:1649— 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 (19 lines × 2) crates/zeroclaw-api/src/memory_traits.rs:702— crates/zeroclaw-api/src/memory_traits.rs:702-720 | crates/zeroclaw-memory/src/agent_scoped.rs:640-658 — before extracting anything, compare `crates/zeroclaw-api/src/memory_traits.rs` and `crates/zeroclaw-memory/src/agent_scoped.rs` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-api/src/memory_traits.rs:702` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:552` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (19 lines × 2) crates/zeroclaw-channels/src/matrix.rs:4637— crates/zeroclaw-channels/src/matrix.rs:4637-4655 | crates/zeroclaw-channels/src/matrix.rs:4705-4723 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:4637` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 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 9 separate duplicated blocks between them, totalling at least 115 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mochat.rs:239` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:824` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) crates/zeroclaw-providers/src/dispatch/accounting.rs:402— crates/zeroclaw-providers/src/dispatch/accounting.rs:402-420 | crates/zeroclaw-providers/src/dispatch/accounting.rs:429-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/dispatch/accounting.rs:402` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) crates/zeroclaw-providers/src/hailo_ollama.rs:622— crates/zeroclaw-providers/src/hailo_ollama.rs:622-640 | crates/zeroclaw-providers/src/ollama.rs:477-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 6 separate duplicated blocks between them, totalling at least 108 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/hailo_ollama.rs:622` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2247— crates/zeroclaw-runtime/src/agent/loop_.rs:2247-2265 | crates/zeroclaw-runtime/src/agent/loop_.rs:2839-2857 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:1323— crates/zeroclaw-runtime/src/cron/store.rs:1323-1341 | crates/zeroclaw-runtime/src/cron/store.rs:1371-1389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/store.rs:1323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) crates/zeroclaw-runtime/src/quickstart/mod.rs:1849— crates/zeroclaw-runtime/src/quickstart/mod.rs:1849-1867 | crates/zeroclaw-runtime/src/quickstart/mod.rs:1871-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 (19 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:2653— crates/zeroclaw-runtime/src/tools/delegate.rs:2653-2671 | crates/zeroclaw-runtime/src/tools/delegate.rs:2709-2727 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:2653` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) crates/zeroclaw-tools/src/ask_user.rs:93— crates/zeroclaw-tools/src/ask_user.rs:93-111 | crates/zeroclaw-tools/src/poll.rs:189-207 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/ask_user.rs:93` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (19 lines × 2) crates/zeroclaw-runtime/src/tools/cron_add.rs:287— crates/zeroclaw-runtime/src/tools/cron_add.rs:287-305 | crates/zeroclaw-runtime/src/tools/cron_update.rs:191-210 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/cron_add.rs:287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) crates/zeroclaw-memory/src/knowledge_graph.rs:396— crates/zeroclaw-memory/src/knowledge_graph.rs:396-414 | crates/zeroclaw-memory/src/knowledge_graph.rs:426-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/knowledge_graph.rs:396` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) crates/zeroclaw-gateway/src/api.rs:2044— crates/zeroclaw-gateway/src/api.rs:2044-2054 | crates/zeroclaw-gateway/src/api.rs:2128-2138 | crates/zeroclaw-gateway/src/api.rs:2210-2220 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-gateway/src/api.rs:2126` calls `Json` and `crates/zeroclaw-gateway/src/api.rs:2042` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:2687` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1686` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/auth/mod.rs:1847` calls `clear_pending_oauth_login` and `crates/zeroclaw-providers/src/auth/mod.rs:1697` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 3) crates/zeroclaw-providers/src/azure_openai.rs:544— crates/zeroclaw-providers/src/azure_openai.rs:544-554 | crates/zeroclaw-providers/src/azure_openai.rs:615-625 | crates/zeroclaw-providers/src/azure_openai.rs:680-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:544` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) crates/zeroclaw-providers/src/dispatch/accounting.rs:195— crates/zeroclaw-providers/src/dispatch/accounting.rs:195-205 | crates/zeroclaw-providers/src/dispatch/accounting.rs:403-413 | crates/zeroclaw-providers/src/dispatch/accounting.rs:430-440 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2895` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/data_management.rs:297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-tools/src/data_management.rs:354` calls `to_string_lossy`, `to_string` and `crates/zeroclaw-tools/src/data_management.rs:397` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 3) REDACTED:1316— REDACTED:1316-1326 | REDACTED:1383-1393 | REDACTED:3019-3029 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1316` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:1007` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) crates/zeroclaw-runtime/src/tools/cron_run.rs:175— crates/zeroclaw-runtime/src/tools/cron_run.rs:175-185 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/cron_run.rs:175` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 3) crates/zeroclaw-channels/src/telegram.rs:6608— crates/zeroclaw-channels/src/telegram.rs:6608-6618 | crates/zeroclaw-channels/src/telegram.rs:7076-7086 | crates/zeroclaw-channels/src/telegram.rs:7118-7128 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:6608` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/rest.rs:49` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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:9014— 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::chat::render_tool_entry (cyclomatic 61) apps/zerocode/src/chat.rs:7173— zerocode::chat::render_tool_entry has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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::run (cyclomatic 38) apps/zerocode/src/main.rs:891— zerocode::run 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.
zerocode::client::dial_through_relay_unbounded (cyclomatic 31) apps/zerocode/src/client.rs:1442— 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::chat::render_table (cyclomatic 26) apps/zerocode/src/chat.rs:9587— 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:6523— 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:8194— 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:9490— 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 24) apps/zerocode/src/config/mod.rs:919— zerocode::config::load_persisted 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::recognized_url_ranges (cyclomatic 19) apps/zerocode/src/chat.rs:9315— 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:379— 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. This is NOT this file's highest cyclomatic complexity: SlashCommandRegistry::parse (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.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×13
Edited copy of a member (29 corresponding lines) crates/zeroclaw-channels/src/lark.rs:2521— crates/zeroclaw-channels/src/lark.rs:2521-2549 | crates/zeroclaw-channels/src/lark.rs:2556-2584 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-channels/src/line.rs:115— crates/zeroclaw-channels/src/line.rs:115-143 | crates/zeroclaw-channels/src/line.rs:152-187 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-tools/src/data_management.rs:337— crates/zeroclaw-tools/src/data_management.rs:337-376 | crates/zeroclaw-tools/src/data_management.rs:382-410 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-tools/src/web_search_tool.rs:566— crates/zeroclaw-tools/src/web_search_tool.rs:566-594 | crates/zeroclaw-tools/src/web_search_tool.rs:1817-1847 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-channels/src/discord/rest.rs:192— crates/zeroclaw-channels/src/discord/rest.rs:192-222 | crates/zeroclaw-channels/src/discord/rest.rs:232-260 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-providers/src/auth/email_oauth2.rs:175— crates/zeroclaw-providers/src/auth/email_oauth2.rs:175-203 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:421-449 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-channels/src/bluesky.rs:164— crates/zeroclaw-channels/src/bluesky.rs:164-192 | crates/zeroclaw-channels/src/reddit.rs:126-154 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:18— crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:18-46 | crates/zeroclaw-runtime/src/agent/turn/protocol_detect.rs:48-79 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-channels/src/clawdtalk.rs:107— crates/zeroclaw-channels/src/clawdtalk.rs:107-135 | crates/zeroclaw-channels/src/clawdtalk.rs:169-198 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-runtime/src/daemon/mod.rs:315— crates/zeroclaw-runtime/src/daemon/mod.rs:315-343 | crates/zeroclaw-runtime/src/daemon/mod.rs:347-375 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:674— crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:674-702 | crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:712-753 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) src/alias_cli/mod.rs:440— src/alias_cli/mod.rs:440-468 | src/alias_cli/mod.rs:527-562 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) crates/zeroclaw-memory/src/audit.rs:57— crates/zeroclaw-memory/src/audit.rs:57-85 | crates/zeroclaw-memory/src/response_cache.rs:40-76 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×13
Edited copy of a member (20 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:978— crates/zeroclaw-runtime/src/rpc/dispatch.rs:978-997 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:1005-1028 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-providers/src/dispatch/accounting.rs:458— crates/zeroclaw-providers/src/dispatch/accounting.rs:458-483 | crates/zeroclaw-providers/src/dispatch/accounting.rs:489-508 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-channels/src/util.rs:138— crates/zeroclaw-channels/src/util.rs:138-161 | crates/zeroclaw-providers/src/compatible.rs:396-415 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:202— crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:202-221 | crates/zeroclaw-channels/src/git/providers/github/provider.rs:349-368 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) apps/zerocode/src/file_explorer.rs:84— apps/zerocode/src/file_explorer.rs:84-103 | apps/zerocode/src/file_explorer.rs:137-156 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-channels/src/linq.rs:401— crates/zeroclaw-channels/src/linq.rs:401-420 | crates/zeroclaw-channels/src/linq.rs:422-441 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) xtask/src/cmd/mdbook/protected.rs:401— xtask/src/cmd/mdbook/protected.rs:401-422 | xtask/src/cmd/mdbook/protected.rs:424-443 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-gateway/src/openapi.rs:610— crates/zeroclaw-gateway/src/openapi.rs:610-629 | crates/zeroclaw-gateway/src/openapi.rs:632-651 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-config/src/schema.rs:14173— crates/zeroclaw-config/src/schema.rs:14173-14193 | src/security_status.rs:399-418 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-providers/src/auth/xai_oauth.rs:86— crates/zeroclaw-providers/src/auth/xai_oauth.rs:86-105 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:107-129 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:788— crates/zeroclaw-channels/src/matrix.rs:788-807 | crates/zeroclaw-channels/src/orchestrator/mod.rs:8488-8507 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) apps/zerocode/src/main.rs:736— apps/zerocode/src/main.rs:736-755 | apps/zerocode/src/main.rs:782-802 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) crates/zeroclaw-plugins/src/component_websocket.rs:376— crates/zeroclaw-plugins/src/component_websocket.rs:376-395 | xtask/src/cmd/mdbook/protected.rs:566-593 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
zeroclaw::async_main_inner (cyclomatic 378) src/main.rs:9633— zeroclaw::async_main_inner has cyclomatic complexity 378 (threshold 15). To reduce it, separate the cases: extract each independent 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:1847— 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:6481— 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:15571— 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:8225— 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:893— 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:6880— 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:4769— 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:435— 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::cmd::mdbook::seo::run_in (cognitive 29) xtask/src/cmd/mdbook/seo.rs:60— xtask::cmd::mdbook::seo::run_in has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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::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:208— 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:3682— apps/zerocode/src/app.rs:3682-3701 | apps/zerocode/src/app.rs:3736-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 (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 9 separate duplicated blocks between them, totalling at least 115 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/qq.rs:1669` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20 lines × 2) crates/zeroclaw-channels/src/whatsapp_web.rs:4420— crates/zeroclaw-channels/src/whatsapp_web.rs:4420-4439 | crates/zeroclaw-channels/src/whatsapp_web.rs:4460-4479 — both copies are in the same file, so extract the block into 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-config/src/schema.rs:12470— crates/zeroclaw-config/src/schema.rs:12470-12489 | crates/zeroclaw-config/src/schema.rs:12557-12576 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/agent_scoped_markdown.rs:182` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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/cron/store.rs:670— crates/zeroclaw-runtime/src/cron/store.rs:670-689 | crates/zeroclaw-runtime/src/cron/store.rs:734-753 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/store.rs:670` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/file_upload.rs:238` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/file_upload.rs:336` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `firmware/nucleo/src/main.rs:76` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-config/src/presets.rs:275` calls `Some` and `crates/zeroclaw-config/src/presets.rs:251` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_config.rs:1081` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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-runtime/src/rpc/dispatch.rs:11051— crates/zeroclaw-runtime/src/rpc/dispatch.rs:11051-11067 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:11186-11202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:3260— crates/zeroclaw-runtime/src/tools/delegate.rs:3260-3276 | crates/zeroclaw-runtime/src/tools/delegate.rs:3589-3605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:3260` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:192— crates/zeroclaw-tools/src/model_routing_config.rs:192-208 | 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 12 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/model_routing_config.rs:192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:1296— crates/zeroclaw-tools/src/model_routing_config.rs:1296-1312 | crates/zeroclaw-tools/src/model_routing_config.rs:1329-1345 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cron/mod.rs:233` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) crates/zeroclaw-runtime/src/daemon/mod.rs:488— crates/zeroclaw-runtime/src/daemon/mod.rs:488-504 | crates/zeroclaw-runtime/src/daemon/mod.rs:523-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/daemon/mod.rs:488` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/alias_cli/mod.rs:452` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) crates/zeroclaw-runtime/src/tools/sop_advance.rs:290— crates/zeroclaw-runtime/src/tools/sop_advance.rs:290-306 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:205-221 — 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 6 separate duplicated blocks between them, totalling at least 73 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/sop_advance.rs:290` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) apps/zerocode/src/editor.rs:2— apps/zerocode/src/editor.rs:2-17 | src/skills/mod.rs:1271-1286 — before extracting anything, compare `apps/zerocode/src/editor.rs` and `src/skills/mod.rs` as WHOLE FILES: 95% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 3 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) apps/zerorelay/src/dashboard.rs:99— apps/zerorelay/src/dashboard.rs:99-114 | crates/zeroclaw-config/src/schema.rs:8578-8593 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:874` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) 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:1539-1554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10802— crates/zeroclaw-channels/src/orchestrator/mod.rs:10802-10817 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11307-11322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10802` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_sop_author.rs:425` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/multimodal.rs:1398` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2308— crates/zeroclaw-runtime/src/agent/loop_.rs:2308-2323 | crates/zeroclaw-runtime/src/agent/loop_.rs:2914-2929 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) crates/zeroclaw-runtime/src/tools/schedule.rs:428— crates/zeroclaw-runtime/src/tools/schedule.rs:428-443 | crates/zeroclaw-runtime/src/tools/schedule.rs:462-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/schedule.rs:428` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/composio.rs:654` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) apps/zerocode/src/quickstart_pane.rs:3141— apps/zerocode/src/quickstart_pane.rs:3141-3156 | apps/zerocode/src/quickstart_pane.rs:3202-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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/quickstart_pane.rs:3141` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) 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 3 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. 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) 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/todo_tracker.rs:190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) apps/zerocode/src/zerocode_pane.rs:1276— apps/zerocode/src/zerocode_pane.rs:1276-1284 | apps/zerocode/src/zerocode_pane.rs:1906-1915 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/zerocode_pane.rs:1906` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2139— crates/zeroclaw-channels/src/discord/mod.rs:2139-2147 | 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 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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/lark.rs:2421— crates/zeroclaw-channels/src/lark.rs:2421-2429 | crates/zeroclaw-channels/src/lark.rs:2835-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2421` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:4816` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) crates/zeroclaw-channels/src/telegram.rs:5348— crates/zeroclaw-channels/src/telegram.rs:5348-5356 | crates/zeroclaw-channels/src/telegram.rs:6104-6113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/telegram.rs:5357` calls `extract_sender_info` and `crates/zeroclaw-channels/src/telegram.rs:6116` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–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:534-542 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_sop.rs:282` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/email_oauth2.rs:152` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) crates/zeroclaw-providers/src/bedrock.rs:169— crates/zeroclaw-providers/src/bedrock.rs:169-177 | crates/zeroclaw-providers/src/bedrock.rs:264-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/bedrock.rs:169` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tool-call-parser/src/lib.rs:1678` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) src/main.rs:2268— src/main.rs:2268-2276 | src/main.rs:2521-2530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/main.rs:2268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–10 lines × 2) xtask/src/generate/spec.rs:800— xtask/src/generate/spec.rs:800-808 | xtask/src/generate/spec.rs:919-928 — both copies are in the same file, so extract the block into 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/matrix.rs:2404— crates/zeroclaw-channels/src/matrix.rs:2404-2410 | crates/zeroclaw-channels/src/wechat.rs:1227-1233 | crates/zeroclaw-channels/src/wechat.rs:1266-1272 | crates/zeroclaw-runtime/src/cron/scheduler.rs:529-535 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:2404` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/nextcloud_talk.rs:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/nextcloud_talk.rs:334` calls `or_else`, `get`, `and_then` and `crates/zeroclaw-channels/src/nextcloud_talk.rs:193` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 4) crates/zeroclaw-gateway/src/api_oidc.rs:624— crates/zeroclaw-gateway/src/api_oidc.rs:624-630 | crates/zeroclaw-gateway/src/api_oidc.rs:845-854 | crates/zeroclaw-gateway/src/api_oidc.rs:1010-1016 | crates/zeroclaw-gateway/src/api_oidc.rs:1128-1134 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-gateway/src/api_oidc.rs:844` calls `as_deref` and `crates/zeroclaw-gateway/src/api_oidc.rs:1127` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 4) crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:495— crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:495-501 | crates/zeroclaw-runtime/src/agent/turn/parse_response.rs:284-290 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/turn/max_iter.rs:495` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/plugin_runtime.rs:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 4) 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:416-422 | crates/zeroclaw-tools/src/linkedin_client.rs:724-730 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 4) crates/zeroclaw-tools/src/claude_code_runner.rs:132— crates/zeroclaw-tools/src/claude_code_runner.rs:132-138 | 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/claude_code_runner.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 78 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/claude_code_runner.rs:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 4) crates/zeroclaw-tools/src/linkedin_client.rs:966— crates/zeroclaw-tools/src/linkedin_client.rs:966-972 | crates/zeroclaw-tools/src/linkedin_client.rs:1029-1035 | crates/zeroclaw-tools/src/linkedin_client.rs:1087-1093 | crates/zeroclaw-tools/src/linkedin_client.rs:1143-1149 — 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: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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:319` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:1864` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/lark.rs:2010` calls `file_download_url` and `crates/zeroclaw-channels/src/lark.rs:1874` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 4) crates/zeroclaw-channels/src/gmail_push.rs:216— crates/zeroclaw-channels/src/gmail_push.rs:216-222 | crates/zeroclaw-channels/src/gmail_push.rs:291-297 | crates/zeroclaw-channels/src/gmail_push.rs:345-351 | crates/zeroclaw-channels/src/gmail_push.rs:602-608 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/gmail_push.rs:216` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:837` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 5) crates/zeroclaw-channels/src/notion.rs:115— crates/zeroclaw-channels/src/notion.rs:115-122 | crates/zeroclaw-providers/src/gemini_cli.rs:167-171 | crates/zeroclaw-providers/src/kilocli.rs:164-168 | crates/zeroclaw-tools/src/web_fetch.rs:271-277 | crates/zeroclaw-tools/src/web_fetch.rs:301-305 — 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 17 separate duplicated blocks between them, totalling at least 164 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/notion.rs:115` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 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:1527-1532 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1550-1554 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2430-2434 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 5) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2353— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2353-2357 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3252-3256 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3272-3276 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3283-3287 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3294-3298 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2353` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 5) crates/zeroclaw-gateway/src/api_plugins.rs:167— crates/zeroclaw-gateway/src/api_plugins.rs:167-172 | crates/zeroclaw-gateway/src/api_plugins.rs:236-241 | crates/zeroclaw-gateway/src/api_plugins.rs:257-262 | crates/zeroclaw-runtime/src/daemon/mod.rs:844-848 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_plugins.rs:167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 5) 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-memory/src/lib.rs:919-923 | crates/zeroclaw-runtime/src/enroll/mod.rs:533-538 | crates/zeroclaw-runtime/src/enroll/mod.rs:578-583 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/lib.rs:829` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 5) crates/zeroclaw-memory/src/sqlite.rs:1034— crates/zeroclaw-memory/src/sqlite.rs:1034-1038 | crates/zeroclaw-memory/src/sqlite.rs:1610-1615 | crates/zeroclaw-memory/src/sqlite.rs:1697-1701 | crates/zeroclaw-memory/src/sqlite.rs:1788-1792 | crates/zeroclaw-memory/src/sqlite.rs:2523-2527 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1034` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 5) crates/zeroclaw-tools/src/model_routing_config.rs:204— crates/zeroclaw-tools/src/model_routing_config.rs:204-208 | crates/zeroclaw-tools/src/model_routing_config.rs:343-349 | 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 12 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/model_routing_config.rs:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 5) crates/zeroclaw-channels/src/orchestrator/mod.rs:11170— crates/zeroclaw-channels/src/orchestrator/mod.rs:11170-11177 | crates/zeroclaw-hardware/src/discover.rs:70-74 | crates/zeroclaw-tools/src/weather_tool.rs:178-182 | src/main.rs:14913-14917 | src/main.rs:14925-14929 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:11170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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:868-872 — 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-channels/src/matrix.rs:3804— crates/zeroclaw-channels/src/matrix.rs:3804-3809 | crates/zeroclaw-channels/src/matrix.rs:3855-3860 | crates/zeroclaw-channels/src/matrix.rs:3916-3920 | crates/zeroclaw-config/src/policy.rs:5744-5748 | crates/zeroclaw-tls/src/lib.rs:574-579 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3804` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/gemini_oauth.rs:459` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×11
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:4067-4258 | crates/zeroclaw-hardware/src/loader.rs:20-144 | crates/zeroclaw-runtime/src/cron/scheduler.rs:485-619 — 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/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 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:239-291 — 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/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 | crates/zeroclaw-channels/src/linq.rs:296-370 | crates/zeroclaw-channels/src/whatsapp.rs:801-817 — 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:1673-1740 — 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:9288— crates/zeroclaw-channels/src/orchestrator/mod.rs:9288-11551 | crates/zeroclaw-channels/src/signal.rs:1248-1453 | 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/openai_codex.rs:170— crates/zeroclaw-providers/src/openai_codex.rs:170-206 | crates/zeroclaw-tools/src/browser.rs:311-363 | crates/zeroclaw-tools/src/git_operations.rs:1719-1801 | crates/zeroclaw-tools/src/model_routing_config.rs:388-418 | crates/zeroclaw-tools/src/model_routing_config.rs:420-450 | crates/zeroclaw-tools/src/model_routing_config.rs:452-482 — 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/tools/schedule.rs:111— crates/zeroclaw-runtime/src/tools/schedule.rs:111-233 | crates/zeroclaw-runtime/src/tools/security_ops.rs:468-497 | crates/zeroclaw-tools/src/composio.rs:614-854 | crates/zeroclaw-tools/src/knowledge_tool.rs:126-155 | crates/zeroclaw-tools/src/linkedin.rs:161-460 | crates/zeroclaw-tools/src/project_intel.rs:542-568 — 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.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×11
Edited copy of a member (24 corresponding lines) crates/zeroclaw-runtime/src/rpc/session.rs:1852— crates/zeroclaw-runtime/src/rpc/session.rs:1852-1875 | crates/zeroclaw-runtime/src/rpc/session.rs:2635-2658 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-channels/src/telegram.rs:977— crates/zeroclaw-channels/src/telegram.rs:977-1000 | crates/zeroclaw-channels/src/wechat.rs:304-327 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-memory/src/agent_scoped.rs:137— crates/zeroclaw-memory/src/agent_scoped.rs:137-167 | crates/zeroclaw-memory/src/agent_scoped_markdown.rs:87-110 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-providers/src/dispatch/accounting.rs:401— crates/zeroclaw-providers/src/dispatch/accounting.rs:401-424 | crates/zeroclaw-providers/src/dispatch/accounting.rs:428-453 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) xtask/src/generate/review_docs.rs:109— xtask/src/generate/review_docs.rs:109-132 | xtask/src/generate/sop_syntax.rs:31-55 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-channels/src/git/channel.rs:693— crates/zeroclaw-channels/src/git/channel.rs:693-716 | crates/zeroclaw-channels/src/twitter.rs:437-460 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-memory/src/knowledge_graph.rs:395— crates/zeroclaw-memory/src/knowledge_graph.rs:395-418 | crates/zeroclaw-memory/src/knowledge_graph.rs:425-448 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:4031— crates/zeroclaw-runtime/src/sop/engine.rs:4031-4054 | crates/zeroclaw-runtime/src/sop/engine.rs:6277-6308 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-channels/src/discord/mod.rs:3454— crates/zeroclaw-channels/src/discord/mod.rs:3454-3482 | crates/zeroclaw-channels/src/telegram.rs:8874-8897 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-channels/src/tts.rs:185— crates/zeroclaw-channels/src/tts.rs:185-210 | crates/zeroclaw-channels/src/tts.rs:312-335 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) crates/zeroclaw-tools/src/composio.rs:377— crates/zeroclaw-tools/src/composio.rs:377-406 | crates/zeroclaw-tools/src/composio.rs:484-507 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (7–8 lines × 2) apps/zerocode/src/chat.rs:4660— apps/zerocode/src/chat.rs:4660-4666 | apps/zerocode/src/chat.rs:4679-4686 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/chat.rs:4660` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) crates/zeroclaw-channels/src/email_channel.rs:309— crates/zeroclaw-channels/src/email_channel.rs:309-316 | crates/zeroclaw-channels/src/email_channel.rs:327-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/email_channel.rs:309` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:5097` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:845` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:1377` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/whatsapp_web.rs:1931` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) crates/zeroclaw-providers/src/bedrock.rs:158— crates/zeroclaw-providers/src/bedrock.rs:158-164 | crates/zeroclaw-providers/src/bedrock.rs:250-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/bedrock.rs:158` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–8 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5517— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5517-5524 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5743-5749 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:5517` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:1800— crates/zeroclaw-runtime/src/sop/engine.rs:1800-1806 | crates/zeroclaw-runtime/src/sop/engine.rs:1826-1833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:1800` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) crates/zeroclaw-tools/src/image_gen.rs:423— crates/zeroclaw-tools/src/image_gen.rs:423-429 | crates/zeroclaw-tools/src/linkedin_client.rs:1150-1157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/image_gen.rs:423` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–8 lines × 2) crates/zeroclaw-runtime/src/rpc/dispatch.rs:13176— crates/zeroclaw-runtime/src/rpc/dispatch.rs:13176-13182 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:13206-13213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
RpcDispatcher::dispatch_method (cyclomatic 115) crates/zeroclaw-runtime/src/rpc/dispatch.rs:3391— RpcDispatcher::dispatch_method has cyclomatic complexity 115 (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::run_session_prompt (cyclomatic 90) crates/zeroclaw-runtime/src/rpc/dispatch.rs:6590— RpcDispatcher::run_session_prompt has cyclomatic complexity 90 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RpcDispatcher::session_new_with_mode (cyclomatic 88) crates/zeroclaw-runtime/src/rpc/dispatch.rs:4484— RpcDispatcher::session_new_with_mode has cyclomatic complexity 88 (threshold 15). To reduce it, separate the cases: extract each independent 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 29) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5989— RpcDispatcher::rehydrate_reaped_session_under_guard has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. 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_record (cyclomatic 29) crates/zeroclaw-runtime/src/rpc/dispatch.rs:8941— RpcDispatcher::handle_session_messages_record 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:10373— 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:5760— 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::resolve_session_record_for_mode (cyclomatic 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:2323— 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_session_delete (cyclomatic 17) crates/zeroclaw-runtime/src/rpc/dispatch.rs:9250— RpcDispatcher::handle_session_delete 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. 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:12965— 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:6189— 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:2087— 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:3143— 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 19) crates/zeroclaw-channels/src/telegram.rs:4790— TelegramChannel::handle_unauthorized_message 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.
TelegramChannel::try_parse_voice_message (cyclomatic 19) crates/zeroclaw-channels/src/telegram.rs:5650— 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:7176— 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:6627— 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:8237— 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:8553— 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:4208— 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:2833— 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.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×10
Edited copy of a member (19 corresponding lines) crates/zeroclaw-gateway/src/api_pairing.rs:43— crates/zeroclaw-gateway/src/api_pairing.rs:43-113 | crates/zeroclaw-gateway/src/api_pairing.rs:199-232 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-providers/src/auth/gemini_oauth.rs:71— crates/zeroclaw-providers/src/auth/gemini_oauth.rs:71-93 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:71-89 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-providers/src/dispatch/accounting.rs:345— crates/zeroclaw-providers/src/dispatch/accounting.rs:345-363 | crates/zeroclaw-providers/src/dispatch/accounting.rs:372-391 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-runtime/src/sop/executor.rs:1434— crates/zeroclaw-runtime/src/sop/executor.rs:1434-1455 | crates/zeroclaw-runtime/src/sop/executor.rs:1461-1479 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-providers/src/azure_openai.rs:302— crates/zeroclaw-providers/src/azure_openai.rs:302-320 | crates/zeroclaw-providers/src/compatible.rs:1320-1351 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-runtime/src/identity.rs:659— crates/zeroclaw-runtime/src/identity.rs:659-677 | crates/zeroclaw-runtime/src/identity.rs:687-705 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-channels/src/telegram.rs:8165— crates/zeroclaw-channels/src/telegram.rs:8165-8183 | crates/zeroclaw-channels/src/telegram.rs:8190-8217 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) apps/zerocode/src/quickstart_pane.rs:420— apps/zerocode/src/quickstart_pane.rs:420-439 | apps/zerocode/src/quickstart_pane.rs:495-513 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-config/src/helpers.rs:364— crates/zeroclaw-config/src/helpers.rs:364-382 | crates/zeroclaw-config/src/helpers.rs:384-402 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) crates/zeroclaw-config/src/policy.rs:3524— crates/zeroclaw-config/src/policy.rs:3524-3546 | crates/zeroclaw-config/src/policy.rs:3548-3566 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×10
Edited copy of a member (27 corresponding lines) crates/zeroclaw-runtime/src/i18n.rs:247— crates/zeroclaw-runtime/src/i18n.rs:247-273 | crates/zeroclaw-tools/src/i18n.rs:116-142 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-api/src/channel.rs:1017— crates/zeroclaw-api/src/channel.rs:1017-1043 | crates/zeroclaw-channels/src/signal.rs:1204-1246 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:1023— crates/zeroclaw-infra/src/session_sqlite.rs:1023-1049 | crates/zeroclaw-infra/src/session_sqlite.rs:1385-1417 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-providers/src/grok_cli/acp.rs:586— crates/zeroclaw-providers/src/grok_cli/acp.rs:586-615 | crates/zeroclaw-providers/src/grok_cli/acp.rs:622-648 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-channels/src/qq.rs:518— crates/zeroclaw-channels/src/qq.rs:518-544 | crates/zeroclaw-channels/src/twitter.rs:96-123 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-tools/src/text_browser.rs:419— crates/zeroclaw-tools/src/text_browser.rs:419-445 | crates/zeroclaw-tools/src/web_fetch.rs:858-884 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-tools/src/channel_room.rs:183— crates/zeroclaw-tools/src/channel_room.rs:183-209 | crates/zeroclaw-tools/src/channel_room.rs:215-244 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-tools/src/web_search_tool.rs:697— crates/zeroclaw-tools/src/web_search_tool.rs:697-725 | crates/zeroclaw-tools/src/web_search_tool.rs:1007-1033 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-config/src/schema.rs:24376— crates/zeroclaw-config/src/schema.rs:24376-24402 | crates/zeroclaw-config/src/schema.rs:24415-24442 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) crates/zeroclaw-tools/src/discord_search.rs:29— crates/zeroclaw-tools/src/discord_search.rs:29-55 | crates/zeroclaw-tools/src/memory_recall.rs:29-56 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×10
Edited copy of a member (22 corresponding lines) xtask/src/cmd/mdbook/peer_groups.rs:759— xtask/src/cmd/mdbook/peer_groups.rs:759-780 | xtask/src/cmd/mdbook/peer_groups.rs:963-989 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-channels/src/wechat.rs:869— crates/zeroclaw-channels/src/wechat.rs:869-890 | crates/zeroclaw-channels/src/whatsapp_web.rs:1290-1311 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-runtime/src/sop/executor.rs:1512— crates/zeroclaw-runtime/src/sop/executor.rs:1512-1533 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:725-751 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-tools/src/mcp_client.rs:732— crates/zeroclaw-tools/src/mcp_client.rs:732-765 | crates/zeroclaw-tools/src/mcp_client.rs:774-795 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:27— crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:27-48 | crates/zeroclaw-channels/src/git/providers/github/mapping.rs:35-56 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-providers/src/reliable.rs:2494— crates/zeroclaw-providers/src/reliable.rs:2494-2518 | crates/zeroclaw-providers/src/router.rs:693-714 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) apps/zerorelay/src/frontdoor.rs:318— apps/zerorelay/src/frontdoor.rs:318-343 | apps/zerorelay/src/frontdoor.rs:356-377 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-api/src/elicitation.rs:132— crates/zeroclaw-api/src/elicitation.rs:132-153 | crates/zeroclaw-api/src/elicitation.rs:171-194 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:1305— crates/zeroclaw-infra/src/session_sqlite.rs:1305-1327 | crates/zeroclaw-infra/src/session_sqlite.rs:1452-1473 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) crates/zeroclaw-tools/src/http_request.rs:59— crates/zeroclaw-tools/src/http_request.rs:59-80 | crates/zeroclaw-tools/src/http_request.rs:91-112 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (22 lines × 2) crates/zeroclaw-config/src/policy.rs:2244— crates/zeroclaw-config/src/policy.rs:2244-2265 | crates/zeroclaw-config/src/policy.rs:2279-2300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/policy.rs:2244` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1687` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) crates/zeroclaw-runtime/src/live_config_authority.rs:248— crates/zeroclaw-runtime/src/live_config_authority.rs:248-269 | crates/zeroclaw-runtime/src/live_config_authority.rs:283-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/live_config_authority.rs:248` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) crates/zeroclaw-runtime/src/tools/cron_add.rs:212— crates/zeroclaw-runtime/src/tools/cron_add.rs:212-233 | crates/zeroclaw-runtime/src/tools/cron_update.rs:152-173 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/cron_add.rs:212` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) crates/zeroclaw-tools/src/hardware_board_info.rs:89— crates/zeroclaw-tools/src/hardware_board_info.rs:89-110 | crates/zeroclaw-tools/src/hardware_memory_map.rs:72-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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cron/mod.rs:199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (22 lines × 2) src/main.rs:10862— src/main.rs:10862-10883 | src/main.rs:12398-12419 — both copies are in the same file, so extract the block into 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-tool-call-parser/src/lib.rs:1465— crates/zeroclaw-tool-call-parser/src/lib.rs:1465-1486 | crates/zeroclaw-tool-call-parser/src/lib.rs:1538-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tool-call-parser/src/lib.rs:1465` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) crates/zeroclaw-runtime/src/agent/tool_execution.rs:245— crates/zeroclaw-runtime/src/agent/tool_execution.rs:245-266 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:277-298 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/tool_execution.rs:245` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) crates/zeroclaw-channels/src/slack.rs:5724— crates/zeroclaw-channels/src/slack.rs:5724-5745 | crates/zeroclaw-channels/src/slack.rs:5769-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:5724` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) apps/zerocode/src/config_manager.rs:1464— apps/zerocode/src/config_manager.rs:1464-1471 | apps/zerocode/src/config_manager.rs:1498-1506 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:1464` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wecom_ws.rs:2339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) crates/zeroclaw-gateway/src/lib.rs:443— crates/zeroclaw-gateway/src/lib.rs:443-450 | crates/zeroclaw-gateway/src/lib.rs:516-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:443` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-gateway/src/lib.rs:450` calls `remove` and `crates/zeroclaw-gateway/src/lib.rs:524` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1238` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/auth/mod.rs:1304` calls `clear_pending_oauth_login` and `crates/zeroclaw-providers/src/auth/mod.rs:1247` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:439— crates/zeroclaw-runtime/src/cron/store.rs:439-446 | crates/zeroclaw-runtime/src/cron/store.rs:480-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/store.rs:439` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) crates/zeroclaw-runtime/src/rpc/session.rs:962— crates/zeroclaw-runtime/src/rpc/session.rs:962-970 | crates/zeroclaw-runtime/src/rpc/session.rs:1156-1163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/session.rs:962` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/security/webauthn.rs:268` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `response` to `&RegisterCredentialResponse` in one and `&AuthenticateCredentialResponse` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/service/mod.rs:3145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:576— crates/zeroclaw-channels/src/discord/mod.rs:576-584 | crates/zeroclaw-channels/src/discord/mod.rs:704-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–9 lines × 2) crates/zeroclaw-tool-call-parser/src/lib.rs:1455— crates/zeroclaw-tool-call-parser/src/lib.rs:1455-1462 | crates/zeroclaw-tool-call-parser/src/lib.rs:1571-1579 — both copies are in the same file, so extract the block into 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 × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:402` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) crates/zeroclaw-channels/src/orchestrator/mod.rs:10811— crates/zeroclaw-channels/src/orchestrator/mod.rs:10811-10818 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11316-11323 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11354-11361 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11488-11495 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10811` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) crates/zeroclaw-providers/src/compatible.rs:5022— crates/zeroclaw-providers/src/compatible.rs:5022-5029 | crates/zeroclaw-providers/src/compatible.rs:5200-5208 | crates/zeroclaw-providers/src/compatible.rs:5345-5352 | 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 9 separate duplicated blocks between them, totalling at least 81 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:5022` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 4) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5486— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5486-5493 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6025-6032 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6042-6049 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6249-6256 — 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-tools/src/file_write.rs:85— crates/zeroclaw-tools/src/file_write.rs:85-92 | crates/zeroclaw-tools/src/knowledge_tool.rs:189-196 | crates/zeroclaw-tools/src/knowledge_tool.rs:490-497 | crates/zeroclaw-tools/src/memory_store.rs:64-71 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/file_write.rs:85` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `args` to `serde_json::Value` in one and `&serde_json::Value` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (8 lines × 4) crates/zeroclaw-tools/src/model_routing_config.rs:95— crates/zeroclaw-tools/src/model_routing_config.rs:95-102 | crates/zeroclaw-tools/src/model_routing_config.rs:113-120 | crates/zeroclaw-tools/src/proxy_config.rs:24-31 | crates/zeroclaw-tools/src/proxy_config.rs:41-48 — 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 12 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/model_routing_config.rs:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) crates/zeroclaw-tools/src/web_search_tool.rs:732— crates/zeroclaw-tools/src/web_search_tool.rs:732-739 | crates/zeroclaw-tools/src/web_search_tool.rs:1434-1441 | crates/zeroclaw-tools/src/web_search_tool.rs:1667-1674 | crates/zeroclaw-tools/src/web_search_tool.rs:1854-1861 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:732` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 4) 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:9491-9498 — 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/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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/skill_tool.rs:263` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-tools/src/text_browser.rs:405` calls `as_secs` and `crates/zeroclaw-tools/src/screenshot.rs:144` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/metrics.rs:117` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Chat::handle_key (cyclomatic 160) apps/zerocode/src/chat.rs:4024— 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:5387— 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::relay_turn (cyclomatic 40) crates/zeroclaw-gateway/src/chat_core.rs:564— Chat::relay_turn 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.
Chat::execute_context_menu_request (cyclomatic 28) apps/zerocode/src/chat.rs:3448— 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::serve (cyclomatic 28) crates/zeroclaw-gateway/src/chat_core.rs:292— Chat::serve 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:2448— 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:2251— 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:1346— 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:2851— 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.
Config::validate (cognitive 486) crates/zeroclaw-config/src/schema.rs:24639— Config::validate has cognitive complexity 486 (threshold 15). Drivers by points: if/else 179 (341 pts), loops 51 (80 pts), match/switch 15 (34 pts), boolean chains 31 (nesting depth added 210). To reduce it, split the body into named stages: move each independent 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:14471— 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::load_or_init (cognitive 34) crates/zeroclaw-config/src/schema.rs:23448— Config::load_or_init has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4 (8 pts), boolean chains 5 (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::extra_nested_model_provider_tables (cognitive 24) crates/zeroclaw-config/src/schema.rs:23381— 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::reachable_delegate_target_configs (cognitive 18) crates/zeroclaw-config/src/schema.rs:4566— 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:5260— 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_context_compression_ignored_warnings (cognitive 17) crates/zeroclaw-config/src/schema.rs:24274— Config::collect_context_compression_ignored_warnings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 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.
Config::resolve_alias_source (cognitive 16) crates/zeroclaw-config/src/schema.rs:4494— 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:23223— 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· Edited copy of a member (26 corresponding lines) · ×9
Edited copy of a member (26 corresponding lines) crates/zeroclaw-config/src/providers.rs:499— crates/zeroclaw-config/src/providers.rs:499-524 | crates/zeroclaw-config/src/providers.rs:529-558 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/zeroclaw-gateway/src/nodes/mdns.rs:308— crates/zeroclaw-gateway/src/nodes/mdns.rs:308-335 | crates/zeroclaw-gateway/src/nodes/mdns.rs:337-362 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) apps/zerocode/src/config_manager.rs:3114— apps/zerocode/src/config_manager.rs:3114-3139 | apps/zerocode/src/config_manager.rs:3150-3179 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/zeroclaw-providers/src/openai.rs:852— crates/zeroclaw-providers/src/openai.rs:852-882 | crates/zeroclaw-providers/src/openai_codex.rs:575-600 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/zeroclaw-runtime/src/sop/audit.rs:158— crates/zeroclaw-runtime/src/sop/audit.rs:158-183 | crates/zeroclaw-runtime/src/sop/audit.rs:192-217 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) apps/zerocode/src/logs.rs:1564— apps/zerocode/src/logs.rs:1564-1589 | apps/zerocode/src/logs.rs:1613-1640 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/zeroclaw-api/src/memory_traits.rs:697— crates/zeroclaw-api/src/memory_traits.rs:697-723 | crates/zeroclaw-memory/src/agent_scoped.rs:635-660 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/zeroclaw-tools/src/calculator.rs:189— crates/zeroclaw-tools/src/calculator.rs:189-214 | crates/zeroclaw-tools/src/poll.rs:97-126 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) crates/zeroclaw-config/src/schema.rs:27669— crates/zeroclaw-config/src/schema.rs:27669-27708 | crates/zeroclaw-config/src/schema.rs:27936-27961 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×9
Edited copy of a member (23 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:1795— crates/zeroclaw-runtime/src/sop/engine.rs:1795-1817 | crates/zeroclaw-runtime/src/sop/engine.rs:1822-1844 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/zeroclaw-memory/src/qdrant.rs:625— crates/zeroclaw-memory/src/qdrant.rs:625-647 | crates/zeroclaw-memory/src/qdrant.rs:974-1004 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/zeroclaw-channels/src/telegram.rs:1002— crates/zeroclaw-channels/src/telegram.rs:1002-1024 | crates/zeroclaw-channels/src/wechat.rs:392-414 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/zeroclaw-runtime/src/rpc/tui_identity.rs:102— crates/zeroclaw-runtime/src/rpc/tui_identity.rs:102-128 | crates/zeroclaw-runtime/src/rpc/tui_identity.rs:133-155 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/zeroclaw-runtime/src/security/bubblewrap.rs:40— crates/zeroclaw-runtime/src/security/bubblewrap.rs:40-65 | crates/zeroclaw-runtime/src/security/firejail.rs:139-161 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) apps/zerocode/src/config_manager.rs:3079— apps/zerocode/src/config_manager.rs:3079-3104 | apps/zerocode/src/config_manager.rs:3181-3203 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/zeroclaw-runtime/src/control_plane/task_store_sqlite/goal.rs:384— crates/zeroclaw-runtime/src/control_plane/task_store_sqlite/goal.rs:384-406 | crates/zeroclaw-runtime/src/control_plane/task_store_sqlite/goal.rs:413-440 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/zeroclaw-runtime/src/agent/agent.rs:2706— crates/zeroclaw-runtime/src/agent/agent.rs:2706-2728 | crates/zeroclaw-runtime/src/agent/agent.rs:2798-2820 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) crates/zeroclaw-tools/src/claude_code_runner.rs:85— crates/zeroclaw-tools/src/claude_code_runner.rs:85-107 | crates/zeroclaw-tools/src/llm_task.rs:117-144 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (11–12 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1857— crates/zeroclaw-channels/src/discord/mod.rs:1857-1868 | crates/zeroclaw-channels/src/discord/mod.rs:3787-3797 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:4827` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) crates/zeroclaw-infra/src/session_sqlite.rs:1025— crates/zeroclaw-infra/src/session_sqlite.rs:1025-1036 | crates/zeroclaw-infra/src/session_sqlite.rs:1058-1068 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/pricing_catalog.rs:145` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/schedule.rs:33` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:4459— crates/zeroclaw-runtime/src/sop/engine.rs:4459-4469 | crates/zeroclaw-runtime/src/sop/engine.rs:4933-4944 — both copies are in the same file, so extract the block into 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/store/sqlite.rs:295— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:295-306 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:385-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/store/sqlite.rs:295` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) src/main.rs:10273— src/main.rs:10273-10284 | src/main.rs:10685-10695 — both copies are in the same file, so extract the block into 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. Read the line range as the matched WINDOW rather than a finished unit: at `xtask/src/cmd/mdbook/check.rs:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) crates/zeroclaw-api/src/model_provider.rs:911— crates/zeroclaw-api/src/model_provider.rs:911-921 | crates/zeroclaw-api/src/model_provider.rs:948-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-api/src/model_provider.rs:911` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) crates/zeroclaw-memory/src/sqlite.rs:1009— crates/zeroclaw-memory/src/sqlite.rs:1009-1018 | crates/zeroclaw-memory/src/sqlite.rs:1996-2006 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1009` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:3376— crates/zeroclaw-runtime/src/agent/agent.rs:3376-3386 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:4149-4158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:3376` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10–11 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:5037— crates/zeroclaw-runtime/src/agent/agent.rs:5037-5047 | crates/zeroclaw-runtime/src/agent/agent.rs:5060-5069 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:5037` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1703— crates/zeroclaw-runtime/src/agent/loop_.rs:1703-1712 | crates/zeroclaw-runtime/src/agent/loop_.rs:3830-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 (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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/git_operations.rs:231` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 2) src/main.rs:10795— src/main.rs:10795-10805 | src/main.rs:12380-12389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/main.rs:10795` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–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. Read the line range as the matched WINDOW rather than a finished unit: at `xtask/src/generate/docs.rs:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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.
DelegateTool::execute_agentic_with_approval_registry (cognitive 56) crates/zeroclaw-runtime/src/tools/delegate.rs:5225— DelegateTool::execute_agentic_with_approval_registry has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (29 pts), match/switch 13 (18 pts), boolean chains 5, loops 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.
DelegateTool::read_background_view (cognitive 28) crates/zeroclaw-runtime/src/tools/delegate.rs:4463— 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:4699— 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:5040— 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:3525— 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:4082— 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:3190— 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:4847— 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.
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:2881— 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.
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
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×8
Edited copy of a member (28 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:9545— crates/zeroclaw-runtime/src/rpc/dispatch.rs:9545-9572 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:9574-9606 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) crates/zeroclaw-memory/src/agent_scoped_markdown.rs:174— crates/zeroclaw-memory/src/agent_scoped_markdown.rs:174-201 | crates/zeroclaw-memory/src/agent_scoped_markdown.rs:211-254 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) crates/zeroclaw-gateway/src/principal_gate.rs:632— crates/zeroclaw-gateway/src/principal_gate.rs:632-661 | crates/zeroclaw-gateway/src/principal_gate.rs:671-698 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) apps/zerocode/src/chat.rs:10917— apps/zerocode/src/chat.rs:10917-10952 | apps/zerocode/src/chat.rs:10954-10981 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) apps/zerocode/src/clipboard.rs:121— apps/zerocode/src/clipboard.rs:121-168 | apps/zerocode/src/clipboard.rs:170-197 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) apps/zerorelay/src/lib.rs:1552— apps/zerorelay/src/lib.rs:1552-1585 | crates/zeroclaw-runtime/src/relay.rs:1447-1474 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:1011— crates/zeroclaw-runtime/src/cron/store.rs:1011-1047 | crates/zeroclaw-runtime/src/cron/store.rs:1049-1076 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) crates/zeroclaw-channels/src/slack.rs:3562— crates/zeroclaw-channels/src/slack.rs:3562-3590 | crates/zeroclaw-channels/src/slack.rs:3668-3695 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×8
Edited copies of one member (3 members, 15+ corresponding lines) crates/zeroclaw-channels/src/whatsapp_storage.rs:787— crates/zeroclaw-channels/src/whatsapp_storage.rs:787-802 | crates/zeroclaw-channels/src/whatsapp_storage.rs:839-855 | crates/zeroclaw-channels/src/whatsapp_storage.rs:929-943 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) apps/zerocode/src/dashboard.rs:1103— apps/zerocode/src/dashboard.rs:1103-1117 | apps/zerocode/src/dashboard.rs:1262-1277 | apps/zerocode/src/dashboard.rs:1883-1899 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) crates/zeroclaw-memory/src/knowledge_graph.rs:455— crates/zeroclaw-memory/src/knowledge_graph.rs:455-469 | crates/zeroclaw-memory/src/knowledge_graph.rs:478-502 | crates/zeroclaw-memory/src/knowledge_graph.rs:511-535 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) crates/zeroclaw-plugins/src/runtime.rs:35— crates/zeroclaw-plugins/src/runtime.rs:35-54 | crates/zeroclaw-plugins/src/wasm_channel.rs:303-322 | crates/zeroclaw-plugins/src/wasm_memory.rs:55-69 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:431— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:431-445 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:596-611 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:724-738 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) REDACTED:2823— REDACTED:2823-2837 | REDACTED:2843-2857 | REDACTED:2899-2915 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) crates/zeroclaw-tools/src/cloud_ops.rs:185— crates/zeroclaw-tools/src/cloud_ops.rs:185-199 | crates/zeroclaw-tools/src/cloud_ops.rs:201-217 | crates/zeroclaw-tools/src/cloud_ops.rs:219-234 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) crates/zeroclaw-channels/src/discord/markers.rs:930— crates/zeroclaw-channels/src/discord/markers.rs:930-944 | crates/zeroclaw-channels/src/signal.rs:1128-1142 | crates/zeroclaw-channels/src/whatsapp_web.rs:3173-3187 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (16–17 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13448— crates/zeroclaw-channels/src/orchestrator/mod.rs:13448-13464 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14701-14716 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:13448` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/voice_wake.rs:348` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) crates/zeroclaw-config/src/schema.rs:12526— crates/zeroclaw-config/src/schema.rs:12526-12542 | crates/zeroclaw-config/src/schema.rs:12687-12702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:12526` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1484` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/auth/mod.rs:1567` calls `clear_pending_oauth_login` and `crates/zeroclaw-providers/src/auth/mod.rs:1501` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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:1592-1608 — 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:2197— crates/zeroclaw-runtime/src/tools/delegate.rs:2197-2213 | crates/zeroclaw-runtime/src/tools/delegate.rs:2240-2255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:2197` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) crates/zeroclaw-channels/src/line.rs:1106— crates/zeroclaw-channels/src/line.rs:1106-1122 | crates/zeroclaw-channels/src/line.rs:1143-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:1106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:16401— crates/zeroclaw-channels/src/orchestrator/mod.rs:16401-16417 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17449-17464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:16401` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:16419` calls `read` and `crates/zeroclaw-channels/src/orchestrator/mod.rs:17465` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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 9 separate duplicated blocks between them, totalling at least 115 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/dingtalk.rs:372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:581` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) crates/zeroclaw-providers/src/compatible.rs:4921— crates/zeroclaw-providers/src/compatible.rs:4921-4933 | crates/zeroclaw-providers/src/compatible.rs:5128-5140 | crates/zeroclaw-providers/src/compatible.rs:5282-5294 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/compatible.rs:4934` calls `targets_mistral_tool_call_contract` and `crates/zeroclaw-providers/src/compatible.rs:5143` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 3) crates/zeroclaw-runtime/src/skills/mod.rs:826— crates/zeroclaw-runtime/src/skills/mod.rs:826-838 | crates/zeroclaw-runtime/src/skills/mod.rs:955-967 | crates/zeroclaw-runtime/src/skills/mod.rs:1086-1098 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:826` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 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 9 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 × 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cron/mod.rs:238` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 3) REDACTED:1330— REDACTED:1330-1342 | REDACTED:1397-1409 | REDACTED:3033-3045 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1330` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/composio.rs:661` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/git/providers/gitea/provider.rs:75` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) crates/zeroclaw-channels/src/slack.rs:1273— crates/zeroclaw-channels/src/slack.rs:1273-1284 | crates/zeroclaw-channels/src/slack.rs:1329-1340 | crates/zeroclaw-channels/src/slack.rs:5381-5392 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:1273` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) crates/zeroclaw-gateway/src/lib.rs:134— crates/zeroclaw-gateway/src/lib.rs:134-145 | 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 6 separate duplicated blocks between them, totalling at least 81 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:134` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) crates/zeroclaw-providers/src/openai.rs:496— crates/zeroclaw-providers/src/openai.rs:496-507 | crates/zeroclaw-providers/src/openai.rs:584-595 | crates/zeroclaw-providers/src/openai.rs:680-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openai.rs:496` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) crates/zeroclaw-runtime/src/daemon/mod.rs:1214— crates/zeroclaw-runtime/src/daemon/mod.rs:1214-1225 | crates/zeroclaw-runtime/src/daemon/mod.rs:1239-1250 | crates/zeroclaw-runtime/src/daemon/mod.rs:1264-1275 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/daemon/mod.rs:1214` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) crates/zeroclaw-runtime/src/tools/delegate.rs:3293— crates/zeroclaw-runtime/src/tools/delegate.rs:3293-3304 | crates/zeroclaw-runtime/src/tools/delegate.rs:3622-3633 | crates/zeroclaw-runtime/src/tools/delegate.rs:4185-4196 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:3293` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/tools/delegate.rs:3621` calls `as_deref` and `crates/zeroclaw-runtime/src/tools/delegate.rs:3292` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-tools/src/backup_tool.rs:1069` calls `join` and `crates/zeroclaw-tools/src/backup_tool.rs:1029` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/security/bubblewrap.rs:43` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:2377` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/jira_tool.rs:205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-tools/src/jira_tool.rs:201` calls `Some` and `crates/zeroclaw-tools/src/jira_tool.rs:275` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/notion_tool.rs:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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:717-724 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `xtask/src/generate/container.rs:42` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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:589-596 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:532` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/cron/scheduler.rs:586` calls `mark_component_error`, `to_string` and `crates/zeroclaw-channels/src/bluesky.rs:529` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/dingtalk.rs:227` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 5) crates/zeroclaw-channels/src/matrix.rs:1971— crates/zeroclaw-channels/src/matrix.rs:1971-1978 | crates/zeroclaw-channels/src/wechat.rs:1202-1209 | crates/zeroclaw-channels/src/wechat.rs:1244-1251 | crates/zeroclaw-hardware/src/rpi.rs:277-284 | crates/zeroclaw-runtime/src/cron/scheduler.rs:673-680 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:1971` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/whatsapp_storage.rs:456` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 5) crates/zeroclaw-channels/src/bluesky.rs:591— crates/zeroclaw-channels/src/bluesky.rs:591-599 | crates/zeroclaw-channels/src/matrix.rs:1947-1952 | crates/zeroclaw-channels/src/telegram.rs:8284-8290 | crates/zeroclaw-channels/src/whatsapp.rs:374-383 | crates/zeroclaw-providers/src/compatible.rs:849-858 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/matrix.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:591` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 5) crates/zeroclaw-channels/src/matrix.rs:3821— crates/zeroclaw-channels/src/matrix.rs:3821-3826 | crates/zeroclaw-channels/src/voice_call.rs:457-462 | crates/zeroclaw-channels/src/whatsapp_web.rs:1898-1903 | crates/zeroclaw-channels/src/whatsapp_web.rs:1948-1953 | crates/zeroclaw-hardware/src/uf2.rs:116-121 — 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 8 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3821` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 5) crates/zeroclaw-channels/src/telegram.rs:8108— crates/zeroclaw-channels/src/telegram.rs:8108-8114 | crates/zeroclaw-hardware/src/loader.rs:22-27 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1676-1681 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:8108` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/observability/log.rs:60` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 5) crates/zeroclaw-channels/src/matrix.rs:1207— crates/zeroclaw-channels/src/matrix.rs:1207-1212 | crates/zeroclaw-channels/src/matrix.rs:1238-1243 | crates/zeroclaw-channels/src/matrix.rs:1256-1261 | crates/zeroclaw-runtime/src/tools/file_read.rs:271-276 | crates/zeroclaw-tools/src/pushover.rs:49-54 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:1207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 5) crates/zeroclaw-tools/src/web_search_tool.rs:440— crates/zeroclaw-tools/src/web_search_tool.rs:440-445 | crates/zeroclaw-tools/src/web_search_tool.rs:661-666 | crates/zeroclaw-tools/src/web_search_tool.rs:837-842 | crates/zeroclaw-tools/src/web_search_tool.rs:979-984 | crates/zeroclaw-tools/src/web_search_tool.rs:1358-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:440` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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 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 × 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:1694-1704 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:2165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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 57% of the time (8 of the 14 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 8 shared commits counted here, the most recent 3 are `03b29bcc` fix(runtime): honour keep_tool_context_turns when building provider r…; `638d0f63` fix(runtime): gate the no-vision error on image markers that resolve …; `e40f153f` refactor(runtime): seal the engine tool registry as ScopedToolRegistr… — run `git show` on any of them.
Change coupling: chat.rs ↔ zerocode_pane.rs apps/zerocode/src/chat.rs:1— `apps/zerocode/src/chat.rs` and `apps/zerocode/src/zerocode_pane.rs` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 6 shared commits counted here, the most recent 3 are `782843e2` feat(zerocode): drag session rows and switch sessions by number (#11573); `3c40ce74` feat(zerocode): combine Sessions Queue and Plan in one dock (#10879); `c265ff64` feat(zerocode): make modifier intent explicit (#10479) — 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: 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: 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.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×7
Edited copies of one member (3 members, 10+ corresponding lines) crates/zeroclaw-gateway/src/lib.rs:4912— crates/zeroclaw-gateway/src/lib.rs:4912-4921 | crates/zeroclaw-gateway/src/lib.rs:5030-5046 | crates/zeroclaw-gateway/src/lib.rs:5168-5184 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) apps/zerocode/src/config/mod.rs:1569— apps/zerocode/src/config/mod.rs:1569-1578 | apps/zerocode/src/config/mod.rs:1583-1592 | apps/zerocode/src/config/mod.rs:1748-1757 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:1521— crates/zeroclaw-infra/src/session_sqlite.rs:1521-1530 | crates/zeroclaw-infra/src/session_sqlite.rs:1807-1823 | crates/zeroclaw-infra/src/session_sqlite.rs:1825-1841 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:16— crates/zeroclaw-channels/src/git/providers/gitea/mapping.rs:16-25 | crates/zeroclaw-channels/src/git/providers/github/mapping.rs:22-31 | crates/zeroclaw-channels/src/git/providers/github/mapping.rs:80-89 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) crates/zeroclaw-providers/src/catalog.rs:132— crates/zeroclaw-providers/src/catalog.rs:132-143 | crates/zeroclaw-providers/src/catalog.rs:160-172 | src/plugins/egress_ceremony.rs:320-329 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) REDACTED:2737— REDACTED:2737-2746 | crates/zeroclaw-providers/src/lib.rs:1080-1091 | crates/zeroclaw-tools/src/file_upload.rs:125-135 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) crates/zeroclaw-providers/src/auth/gemini_oauth.rs:327— crates/zeroclaw-providers/src/auth/gemini_oauth.rs:327-336 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:228-237 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:351-360 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
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 2 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 19 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.
Off the main sequence: zeroclaw-config — zeroclaw-config: abstractness 0.03, instability 0.27, distance 0.71 — zone of pain — concrete and depended on by 11 project(s), so it's rigid to change.
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:1999— 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:3562— 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:3740— 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:1816— 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 75) crates/zeroclaw-config/src/policy.rs:4719— SecurityPolicy::forbidden_path_argument_impl has cognitive complexity 75 (threshold 15). Drivers by points: if/else 24 (55 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:5562— 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::is_posix_like_command_allowed (cognitive 24) crates/zeroclaw-config/src/policy.rs:4509— SecurityPolicy::is_posix_like_command_allowed has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 6, 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.
SecurityPolicy::command_risk_level_for_shell (cognitive 21) crates/zeroclaw-config/src/policy.rs:4175— 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_path_allowed (cognitive 19) crates/zeroclaw-config/src/policy.rs:5035— 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:4447— 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:4505— 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:3157— 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:4747— 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.
OpenAiCompatibleModelProvider::relocate_tool_result_images (cognitive 42) crates/zeroclaw-providers/src/compatible.rs:3708— OpenAiCompatibleModelProvider::relocate_tool_result_images has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 2 (5 pts), match/switch 1 (5 pts), boolean chains 3 (nesting depth added 24). 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.
OpenAiCompatibleModelProvider::stream_chat (cognitive 32) crates/zeroclaw-providers/src/compatible.rs:4779— 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:5035— 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:3853— 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.
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.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (7 members, 50+ identical tokens) crates/zeroclaw-channels/src/matrix.rs:1935— crates/zeroclaw-channels/src/matrix.rs:1935-2031 | crates/zeroclaw-channels/src/wechat.rs:1199-1238 | crates/zeroclaw-channels/src/wechat.rs:1241-1277 | crates/zeroclaw-gateway/src/lib.rs:1402-3177 | crates/zeroclaw-hardware/src/rpi.rs:270-304 | crates/zeroclaw-runtime/src/cron/scheduler.rs:660-714 | crates/zeroclaw-runtime/src/cron/scheduler.rs:716-780 — 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-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:216-247 | crates/zeroclaw-gateway/src/api_skills.rs:254-276 | crates/zeroclaw-gateway/src/api_skills.rs:284-304 | crates/zeroclaw-gateway/src/api_skills.rs:312-333 — 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-hardware/src/peripherals/rpi.rs:154— crates/zeroclaw-hardware/src/peripherals/rpi.rs:154-194 | crates/zeroclaw-hardware/src/peripherals/serial.rs:312-336 | 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 | crates/zeroclaw-runtime/src/tools/security_ops.rs:101-185 — 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-providers/src/azure_openai.rs:395— crates/zeroclaw-providers/src/azure_openai.rs:395-465 | crates/zeroclaw-providers/src/compatible.rs:3493-3694 | crates/zeroclaw-providers/src/copilot.rs:372-439 | crates/zeroclaw-providers/src/hailo_ollama.rs:552-640 | crates/zeroclaw-providers/src/ollama.rs:406-495 | crates/zeroclaw-providers/src/openai.rs:373-443 | crates/zeroclaw-providers/src/openrouter.rs:311-383 — 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-runtime/src/tools/delegate.rs:2952— crates/zeroclaw-runtime/src/tools/delegate.rs:2952-3072 | crates/zeroclaw-runtime/src/tools/delegate.rs:4086-4415 | 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 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.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×6
Edited copy of a member (25 corresponding lines) apps/zerocode/src/mouse.rs:161— apps/zerocode/src/mouse.rs:161-185 | crates/zeroclaw-channels/src/irc.rs:117-149 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/zeroclaw-providers/src/dispatch.rs:517— crates/zeroclaw-providers/src/dispatch.rs:517-541 | crates/zeroclaw-providers/src/dispatch.rs:550-574 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/zeroclaw-providers/src/reliable.rs:3141— crates/zeroclaw-providers/src/reliable.rs:3141-3165 | crates/zeroclaw-providers/src/reliable.rs:3167-3192 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/zeroclaw-providers/src/compatible.rs:3157— crates/zeroclaw-providers/src/compatible.rs:3157-3181 | crates/zeroclaw-providers/src/compatible.rs:3245-3297 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/zeroclaw-channels/src/discord/mod.rs:3943— crates/zeroclaw-channels/src/discord/mod.rs:3943-3969 | crates/zeroclaw-channels/src/discord/mod.rs:3976-4000 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) crates/zeroclaw-runtime/src/sop/capability/builtins.rs:51— crates/zeroclaw-runtime/src/sop/capability/builtins.rs:51-75 | crates/zeroclaw-runtime/src/sop/capability/builtins.rs:128-153 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/osc_status.rs:428` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) crates/zeroclaw-memory/src/sqlite.rs:2167— crates/zeroclaw-memory/src/sqlite.rs:2167-2189 | crates/zeroclaw-memory/src/sqlite.rs:2479-2501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:2167` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:59` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) src/main.rs:15636— src/main.rs:15636-15658 | src/main.rs:15671-15693 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/main.rs:15636` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `src/memory/cli.rs:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/memory/cli.rs:425` calls `Ok` and `src/memory/cli.rs:209` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23 lines × 2) crates/zeroclaw-channels/src/lark.rs:4117— crates/zeroclaw-channels/src/lark.rs:4117-4139 | crates/zeroclaw-channels/src/lark.rs:4242-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:4117` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:1323` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:1341` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–15 lines × 2) apps/zerorelay/src/enroll_route.rs:296— apps/zerorelay/src/enroll_route.rs:296-309 | apps/zerorelay/src/lib.rs:1704-1718 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerorelay/src/enroll_route.rs:296` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/acp_channel.rs:134` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:2968— crates/zeroclaw-providers/src/anthropic.rs:2968-2981 | crates/zeroclaw-providers/src/anthropic.rs:3121-3135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/anthropic.rs:3121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1948— crates/zeroclaw-runtime/src/agent/loop_.rs:1948-1962 | crates/zeroclaw-runtime/src/agent/loop_.rs:4008-4021 — both copies are in the same file, so extract the block into 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:2628— apps/zerocode/src/chat.rs:2628-2640 | apps/zerocode/src/chat.rs:2643-2654 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/chat.rs:2643` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `apps/zerocode/src/chat.rs:2656` calls `mark_dirty_full` and `apps/zerocode/src/chat.rs:2640` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–13 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:9762— crates/zeroclaw-channels/src/orchestrator/mod.rs:9762-9773 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10663-10675 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:9762` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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:2743— crates/zeroclaw-providers/src/anthropic.rs:2743-2754 | crates/zeroclaw-providers/src/anthropic.rs:2825-2837 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/anthropic.rs:2743` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1430` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12–13 lines × 2) src/main.rs:15781— src/main.rs:15781-15792 | src/main.rs:15800-15812 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `src/main.rs:15781` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 4) crates/zeroclaw-providers/src/glm.rs:199— crates/zeroclaw-providers/src/glm.rs:199-209 | crates/zeroclaw-providers/src/glm.rs:254-264 | crates/zeroclaw-providers/src/telnyx.rs:209-219 | crates/zeroclaw-providers/src/telnyx.rs:276-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 4 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/glm.rs:199` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 4) crates/zeroclaw-providers/src/openrouter.rs:653— crates/zeroclaw-providers/src/openrouter.rs:653-663 | crates/zeroclaw-providers/src/openrouter.rs:719-729 | crates/zeroclaw-providers/src/openrouter.rs:792-802 | crates/zeroclaw-providers/src/openrouter.rs:997-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openrouter.rs:653` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/openrouter.rs:1010` calls `is_empty` and `crates/zeroclaw-providers/src/openrouter.rs:731` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 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-channels/src/discord/mod.rs:3618— crates/zeroclaw-channels/src/discord/mod.rs:3618-3628 | crates/zeroclaw-channels/src/signal.rs:1385-1397 | crates/zeroclaw-channels/src/signal.rs:1432-1442 | crates/zeroclaw-tools/src/microsoft365/auth.rs:114-124 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/signal.rs` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, 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-runtime/src/skills/mod.rs:520— crates/zeroclaw-runtime/src/skills/mod.rs:520-530 | crates/zeroclaw-runtime/src/skills/mod.rs:1211-1221 | crates/zeroclaw-runtime/src/skills/mod.rs:3114-3124 | crates/zeroclaw-runtime/src/skills/mod.rs:3329-3339 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:520` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 4) apps/zerocode/src/config_manager.rs:3122— apps/zerocode/src/config_manager.rs:3122-3130 | apps/zerocode/src/config_manager.rs:3156-3164 | apps/zerocode/src/config_manager.rs:3781-3789 | apps/zerocode/src/config_manager.rs:3978-3986 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:3122` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 4) crates/zeroclaw-runtime/src/tools/cron_remove.rs:94— crates/zeroclaw-runtime/src/tools/cron_remove.rs:94-102 | crates/zeroclaw-runtime/src/tools/cron_run.rs:157-165 | crates/zeroclaw-runtime/src/tools/cron_runs.rs:79-87 | crates/zeroclaw-runtime/src/tools/cron_update.rs:229-237 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/cron_remove.rs:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/notion_tool.rs:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3535` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:3365` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-plugins/src/wasm_channel.rs:1431` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 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 78 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:923` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/mattermost.rs:920` calls `token`, `Ok`, `to_string` and `crates/zeroclaw-channels/src/slack.rs:2684` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/plugin_runtime.rs:974` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-runtime/src/plugin_runtime.rs:1003` calls `bounded_plugin_log_value` and `crates/zeroclaw-runtime/src/plugin_runtime.rs:981` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 5) crates/zeroclaw-tools/src/web_search_tool.rs:404— 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 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:404` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 5) crates/zeroclaw-tools/src/microsoft365/graph_client.rs:88— crates/zeroclaw-tools/src/microsoft365/graph_client.rs:88-94 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:157-163 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:277-283 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:340-346 | crates/zeroclaw-tools/src/microsoft365/graph_client.rs:417-423 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/microsoft365/graph_client.rs:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 5) crates/zeroclaw-channels/src/discord/mod.rs:3927— crates/zeroclaw-channels/src/discord/mod.rs:3927-3933 | crates/zeroclaw-channels/src/nextcloud_talk.rs:770-776 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6498-6506 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6891-6899 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6908-6916 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:3927` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/nextcloud_talk.rs:777` calls `remove` and `crates/zeroclaw-channels/src/discord/mod.rs:3935` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 5) crates/zeroclaw-channels/src/telegram.rs:6730— crates/zeroclaw-channels/src/telegram.rs:6730-6736 | crates/zeroclaw-channels/src/telegram.rs:6823-6829 | crates/zeroclaw-channels/src/telegram.rs:6916-6922 | crates/zeroclaw-channels/src/telegram.rs:6965-6971 | crates/zeroclaw-channels/src/telegram.rs:7014-7020 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:6730` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 6) crates/zeroclaw-channels/src/gmail_push.rs:208— crates/zeroclaw-channels/src/gmail_push.rs:208-215 | crates/zeroclaw-channels/src/gmail_push.rs:286-290 | crates/zeroclaw-channels/src/gmail_push.rs:340-344 | crates/zeroclaw-channels/src/gmail_push.rs:594-601 | crates/zeroclaw-channels/src/linq.rs:345-350 | crates/zeroclaw-channels/src/whatsapp.rs:808-812 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/gmail_push.rs:208` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 6) crates/zeroclaw-runtime/src/sop/engine.rs:2580— crates/zeroclaw-runtime/src/sop/engine.rs:2580-2584 | crates/zeroclaw-runtime/src/sop/engine.rs:2891-2895 | crates/zeroclaw-runtime/src/sop/engine.rs:4083-4088 | crates/zeroclaw-runtime/src/sop/engine.rs:4751-4756 | crates/zeroclaw-runtime/src/sop/engine.rs:5657-5661 | crates/zeroclaw-runtime/src/sop/engine.rs:6063-6067 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:2580` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 6) crates/zeroclaw-runtime/src/tools/schedule.rs:115— crates/zeroclaw-runtime/src/tools/schedule.rs:115-120 | crates/zeroclaw-runtime/src/tools/security_ops.rs:470-474 | crates/zeroclaw-tools/src/composio.rs:616-620 | crates/zeroclaw-tools/src/knowledge_tool.rs:128-132 | crates/zeroclaw-tools/src/linkedin.rs:163-167 | crates/zeroclaw-tools/src/project_intel.rs:544-548 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/schedule.rs:115` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/dingtalk.rs:313` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:10602— crates/zeroclaw-channels/src/orchestrator/mod.rs:10602-10609 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10690-10697 | REDACTED:489-493 | crates/zeroclaw-runtime/src/agent/agent.rs:4111-4115 | crates/zeroclaw-runtime/src/daemon/mod.rs:845-849 | crates/zeroclaw-runtime/src/tools/skill_http.rs:195-199 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-runtime/src/daemon/mod.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 65 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10602` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:17952— crates/zeroclaw-channels/src/orchestrator/mod.rs:17952-17956 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17971-17975 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17997-18001 | crates/zeroclaw-channels/src/orchestrator/mod.rs:18028-18032 | crates/zeroclaw-channels/src/orchestrator/mod.rs:18055-18059 | crates/zeroclaw-channels/src/orchestrator/mod.rs:18201-18205 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:17952` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
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:1999— 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:1816— 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:3562— 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:3740— 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.
zerorelay::handle_client (cognitive 55) apps/zerorelay/src/lib.rs:1607— 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:1175— 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:349— 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:135— 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.
zerorelay::dashboard::splice (cognitive 17) apps/zerorelay/src/dashboard.rs:325— zerorelay::dashboard::splice has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (8 pts), match/switch 3 (8 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AcpSessionStore::provider_safe_history (cognitive 41) REDACTED:2752— 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:911— 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:1665— 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:2661— 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:1422— 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:1826— 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:1555— 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:1964— 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:2240— 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:2187— 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.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×5
Edited copy of a member (32 corresponding lines) crates/zeroclaw-runtime/src/i18n.rs:209— crates/zeroclaw-runtime/src/i18n.rs:209-240 | crates/zeroclaw-tools/src/i18n.rs:78-109 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) apps/zerocode/src/enroll.rs:716— apps/zerocode/src/enroll.rs:716-747 | crates/zeroclaw-runtime/src/sop/mod.rs:383-418 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) crates/zeroclaw-config/src/platform/native.rs:125— crates/zeroclaw-config/src/platform/native.rs:125-160 | crates/zeroclaw-runtime/src/live_config_authority.rs:755-786 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) crates/zeroclaw-runtime/src/security/estop.rs:211— crates/zeroclaw-runtime/src/security/estop.rs:211-248 | crates/zeroclaw-runtime/src/security/otp.rs:131-162 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) crates/zeroclaw-tools/src/a2a_client.rs:1146— crates/zeroclaw-tools/src/a2a_client.rs:1146-1178 | crates/zeroclaw-tools/src/a2a_client.rs:1188-1219 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×5
Edited copy of a member (33 corresponding lines) crates/zeroclaw-channels/src/lark.rs:2886— crates/zeroclaw-channels/src/lark.rs:2886-2918 | crates/zeroclaw-channels/src/lark.rs:3368-3409 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:122— crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:122-160 | crates/zeroclaw-runtime/src/tools/verifiable_intent.rs:223-255 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) crates/zeroclaw-channels/src/tts.rs:117— crates/zeroclaw-channels/src/tts.rs:117-152 | crates/zeroclaw-channels/src/tts.rs:961-993 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) REDACTED:2177— REDACTED:2177-2212 | REDACTED:2237-2269 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:226— crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:226-259 | crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:279-311 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×5
Edited copy of a member (30 corresponding lines) crates/zeroclaw-channels/src/orchestrator/mod.rs:7303— crates/zeroclaw-channels/src/orchestrator/mod.rs:7303-7332 | crates/zeroclaw-runtime/src/agent/turn/stream_guard.rs:603-632 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) apps/zerocode/src/config_manager.rs:3870— apps/zerocode/src/config_manager.rs:3870-3900 | apps/zerocode/src/config_manager.rs:4052-4081 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/zeroclaw-channels/src/mochat.rs:101— crates/zeroclaw-channels/src/mochat.rs:101-132 | crates/zeroclaw-channels/src/wecom.rs:76-105 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/zeroclaw-gateway/src/api_config.rs:2254— crates/zeroclaw-gateway/src/api_config.rs:2254-2296 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:3171-3200 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:757— crates/zeroclaw-channels/src/matrix.rs:757-786 | crates/zeroclaw-channels/src/orchestrator/mod.rs:8454-8486 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×5
Edited copies of one member (3 members, 13+ corresponding lines) crates/zeroclaw-memory/src/postgres.rs:536— crates/zeroclaw-memory/src/postgres.rs:536-548 | crates/zeroclaw-memory/src/postgres.rs:550-563 | crates/zeroclaw-memory/src/postgres.rs:565-579 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) crates/zeroclaw-api/src/media.rs:336— crates/zeroclaw-api/src/media.rs:336-353 | crates/zeroclaw-runtime/src/tools/file_read.rs:326-340 | crates/zeroclaw-tools/src/embedded_resource.rs:226-238 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) apps/zerocode/src/config/mod.rs:1523— apps/zerocode/src/config/mod.rs:1523-1535 | apps/zerocode/src/config/mod.rs:1540-1552 | apps/zerocode/src/config/mod.rs:1554-1566 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) REDACTED:806— REDACTED:806-818 | REDACTED:824-836 | REDACTED:1178-1191 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) crates/zeroclaw-providers/src/hailo_ollama.rs:653— crates/zeroclaw-providers/src/hailo_ollama.rs:653-665 | crates/zeroclaw-runtime/src/skills/improver.rs:227-239 | tools/fill-translations/src/main.rs:165-177 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×5
Edited copies of one member (3 members, 11+ corresponding lines) crates/zeroclaw-channels/src/orchestrator/mod.rs:11868— crates/zeroclaw-channels/src/orchestrator/mod.rs:11868-11884 | crates/zeroclaw-runtime/src/agent_lifecycle.rs:180-190 | crates/zeroclaw-runtime/src/tools/skill_manage.rs:709-723 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) crates/zeroclaw-plugins/src/sockets.rs:186— crates/zeroclaw-plugins/src/sockets.rs:186-196 | crates/zeroclaw-plugins/src/sockets.rs:198-211 | crates/zeroclaw-plugins/src/sockets.rs:213-223 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) crates/zeroclaw-config/src/providers.rs:315— crates/zeroclaw-config/src/providers.rs:315-326 | crates/zeroclaw-config/src/providers.rs:331-341 | crates/zeroclaw-config/src/providers.rs:437-447 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) crates/zeroclaw-plugins/src/host.rs:1281— crates/zeroclaw-plugins/src/host.rs:1281-1291 | crates/zeroclaw-plugins/src/host.rs:1296-1307 | crates/zeroclaw-plugins/src/host.rs:1318-1331 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) REDACTED:2984— REDACTED:2984-2994 | crates/zeroclaw-infra/src/session_sqlite.rs:1497-1509 | crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:111-121 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (34 lines × 2) crates/zeroclaw-channels/src/telegram.rs:6733— crates/zeroclaw-channels/src/telegram.rs:6733-6766 | crates/zeroclaw-channels/src/telegram.rs:6777-6810 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:6733` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (34 lines × 2) crates/zeroclaw-channels/src/telegram.rs:6826— crates/zeroclaw-channels/src/telegram.rs:6826-6859 | crates/zeroclaw-channels/src/telegram.rs:6870-6903 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:6826` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (34 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:4468— crates/zeroclaw-runtime/src/agent/agent.rs:4468-4501 | crates/zeroclaw-runtime/src/agent/agent.rs:5004-5037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:4468` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (34 lines × 2) crates/zeroclaw-providers/src/openai.rs:633— crates/zeroclaw-providers/src/openai.rs:633-666 | crates/zeroclaw-providers/src/openai.rs:721-754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openai.rs:633` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (34 lines × 2) crates/zeroclaw-runtime/src/rpc/local.rs:810— crates/zeroclaw-runtime/src/rpc/local.rs:810-843 | crates/zeroclaw-runtime/src/rpc/wss.rs:1259-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 6 separate duplicated blocks between them, totalling at least 81 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/local.rs:810` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:5543— crates/zeroclaw-runtime/src/sop/engine.rs:5543-5572 | crates/zeroclaw-runtime/src/sop/engine.rs:5614-5643 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:5543` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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 (30 lines × 2) crates/zeroclaw-tools/src/model_routing_config.rs:335— crates/zeroclaw-tools/src/model_routing_config.rs:335-364 | crates/zeroclaw-tools/src/proxy_config.rs:128-157 — 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 12 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (30 lines × 2) crates/zeroclaw-hardware/src/pico_code.rs:305— crates/zeroclaw-hardware/src/pico_code.rs:305-334 | crates/zeroclaw-hardware/src/pico_code.rs:490-519 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/pico_code.rs:305` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:4607` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/slack.rs:4603` calls `resolve_sender_identity` and `crates/zeroclaw-channels/src/slack.rs:6048` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (25 lines × 2) REDACTED:1329— REDACTED:1329-1353 | REDACTED:3032-3056 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1329` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4559— crates/zeroclaw-providers/src/compatible.rs:4559-4583 | crates/zeroclaw-providers/src/compatible.rs:4687-4711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/compatible.rs:4685` calls `sanitize_api_error` and `crates/zeroclaw-providers/src/compatible.rs:4558` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (25 lines × 2) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:317— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:317-341 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:361-385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/store/sqlite.rs:317` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/microsoft365/mod.rs:118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (21 lines × 2) crates/zeroclaw-gateway/src/lib.rs:1662— crates/zeroclaw-gateway/src/lib.rs:1662-1682 | crates/zeroclaw-gateway/src/lib.rs:1832-1852 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:1662` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (21 lines × 2) 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 17 separate duplicated blocks between them, totalling at least 226 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (21 lines × 2) crates/zeroclaw-runtime/src/tools/sop_advance.rs:158— crates/zeroclaw-runtime/src/tools/sop_advance.rs:158-178 | crates/zeroclaw-runtime/src/tools/sop_approve.rs:122-142 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/sop_advance.rs` and `crates/zeroclaw-runtime/src/tools/sop_approve.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/sop_advance.rs:158` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) crates/zeroclaw-channels/src/qq.rs:1700— crates/zeroclaw-channels/src/qq.rs:1700-1720 | crates/zeroclaw-channels/src/qq.rs:1773-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/qq.rs:1700` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) apps/zerocode/src/config_manager.rs:4581— apps/zerocode/src/config_manager.rs:4581-4598 | apps/zerocode/src/config_manager.rs:4632-4648 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:4581` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/diff.rs:130` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:3360— crates/zeroclaw-providers/src/anthropic.rs:3360-3376 | crates/zeroclaw-providers/src/anthropic.rs:3516-3533 — both copies are in the same file, so extract the block into 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/rpc/dispatch.rs:5825— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5825-5841 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:9310-9327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:5825` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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 47 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14–16 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:2551— crates/zeroclaw-channels/src/discord/mod.rs:2551-2566 | crates/zeroclaw-channels/src/discord/mod.rs:3009-3022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2551` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14–16 lines × 2) crates/zeroclaw-channels/src/discord/slash.rs:571— crates/zeroclaw-channels/src/discord/slash.rs:571-584 | crates/zeroclaw-channels/src/discord/slash.rs:643-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/slash.rs:571` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:2049— crates/zeroclaw-runtime/src/agent/turn/mod.rs:2049-2064 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3769-3782 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/turn/mod.rs:2049` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) crates/zeroclaw-runtime/src/sop/executor.rs:1078— crates/zeroclaw-runtime/src/sop/executor.rs:1078-1093 | crates/zeroclaw-runtime/src/sop/executor.rs:1195-1208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/executor.rs:1078` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tool-call-parser/src/lib.rs:2373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) apps/zerocode/src/i18n.rs:248— apps/zerocode/src/i18n.rs:248-261 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/i18n.rs:260` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) crates/zeroclaw-channels/src/qq.rs:186— crates/zeroclaw-channels/src/qq.rs:186-199 | crates/zeroclaw-channels/src/telegram.rs:1079-1092 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/qq.rs:186` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:273` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/auth/mod.rs:456` calls `Some`, `as_str` and `crates/zeroclaw-providers/src/auth/mod.rs:368` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:469` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/azure_openai.rs:468` calls `effective_content` and `crates/zeroclaw-providers/src/openrouter.rs:450` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 3) crates/zeroclaw-memory/src/knowledge_graph.rs:337— crates/zeroclaw-memory/src/knowledge_graph.rs:337-350 | crates/zeroclaw-memory/src/knowledge_graph.rs:399-412 | crates/zeroclaw-memory/src/knowledge_graph.rs:429-442 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/knowledge_graph.rs:337` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11–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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:4241` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/hailo_ollama.rs:320` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/doctor/mod.rs:1305` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–14 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:2404— crates/zeroclaw-runtime/src/sop/engine.rs:2404-2417 | crates/zeroclaw-runtime/src/sop/engine.rs:5082-5092 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:5082` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `crate) fn reserve_run_slot(&mut` in one and `&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 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:1013-1021 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/dashboard.rs:785` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `&mut` in one and `crate) fn draw(&mut` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9 lines × 5) crates/zeroclaw-providers/src/azure_openai.rs:399— crates/zeroclaw-providers/src/azure_openai.rs:399-407 | crates/zeroclaw-providers/src/compatible.rs:3504-3512 | crates/zeroclaw-providers/src/copilot.rs:376-384 | crates/zeroclaw-providers/src/openai.rs:377-385 | crates/zeroclaw-providers/src/openrouter.rs:315-323 — 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 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:399` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 5) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:179— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:179-187 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:237-245 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:274-282 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:312-320 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:356-364 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/store/sqlite.rs:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/sop/store/sqlite.rs:272` calls `to_string` and `crates/zeroclaw-runtime/src/sop/store/sqlite.rs:177` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/qdrant.rs:416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 5) crates/zeroclaw-tools/src/linkedin_client.rs:321— crates/zeroclaw-tools/src/linkedin_client.rs:321-329 | crates/zeroclaw-tools/src/linkedin_client.rs:386-394 | 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 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.
Low cohesion: PairingGuard (LCOM4 7) crates/zeroclaw-config/src/pairing.rs:467— PairingGuard'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: 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: 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.
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:1555— 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:1826— 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 24) apps/zerocode/src/input_bar.rs:1964— InputBarState::handle_enter 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.
InputBarState::render (cyclomatic 20) apps/zerocode/src/input_bar.rs:2240— 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 42) crates/zeroclaw-config/src/policy.rs:4719— SecurityPolicy::forbidden_path_argument_impl 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.
SecurityPolicy::ensure_no_escalation_beyond (cyclomatic 25) crates/zeroclaw-config/src/policy.rs:5562— 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::is_posix_like_command_allowed (cyclomatic 21) crates/zeroclaw-config/src/policy.rs:4509— SecurityPolicy::is_posix_like_command_allowed 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.
SecurityPolicy::command_risk_level_for_shell (cyclomatic 20) crates/zeroclaw-config/src/policy.rs:4175— 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.
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 31) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1881— AcpServer::handle_session_prompt 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.
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:2932— 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:1498— 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:4505— 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:3157— 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 133) crates/zeroclaw-runtime/src/agent/agent.rs:4912— Agent::turn_streamed_with_steering_body has cognitive complexity 133 (threshold 15). Drivers by points: if/else 36 (101 pts), match/switch 7 (17 pts), boolean chains 8, 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:4209— 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::build_with_capabilities (cognitive 27) crates/zeroclaw-runtime/src/agent/agent.rs:3274— Agent::build_with_capabilities has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21 (22 pts), match/switch 4, boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Agent::turn (cognitive 19) crates/zeroclaw-runtime/src/agent/agent.rs:4385— 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:2485— 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:3255— 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:1407— 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:2162— 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.
AcpServer::materialize_prompt (cognitive 49) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2932— 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 47) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1881— AcpServer::handle_session_prompt has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (35 pts), match/switch 7 (10 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1498— 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.
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.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×4
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.
Edited copy of a member (38 corresponding lines) crates/zeroclaw-tools/src/git_operations.rs:1628— crates/zeroclaw-tools/src/git_operations.rs:1628-1665 | crates/zeroclaw-tools/src/git_operations.rs:1671-1713 — 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.
Edited copy of a member (38 corresponding lines) crates/zeroclaw-config/src/schema/v2.rs:3288— crates/zeroclaw-config/src/schema/v2.rs:3288-3325 | crates/zeroclaw-config/src/schema/v2.rs:3333-3372 — 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.
Edited copy of a member (38 corresponding lines) xtask/src/bin/web.rs:239— xtask/src/bin/web.rs:239-276 | xtask/src/bin/web.rs:283-321 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (52 corresponding lines) · ×4
Edited copy of a member (52 corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:10000— crates/zeroclaw-runtime/src/rpc/dispatch.rs:10000-10074 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:10738-10789 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (52 corresponding lines) crates/zeroclaw-memory/src/postgres.rs:400— crates/zeroclaw-memory/src/postgres.rs:400-451 | crates/zeroclaw-memory/src/postgres.rs:755-817 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (52 corresponding lines) src/skills/discovery.rs:512— src/skills/discovery.rs:512-572 | src/skills/discovery.rs:574-625 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (52 corresponding lines) crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:36— crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:36-87 | crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:112-201 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×4
Edited copy of a member (44 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:6461— crates/zeroclaw-runtime/src/sop/engine.rs:6461-6512 | crates/zeroclaw-runtime/src/sop/engine.rs:6520-6563 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (44 corresponding lines) crates/zeroclaw-tools/src/http_request.rs:761— crates/zeroclaw-tools/src/http_request.rs:761-807 | crates/zeroclaw-tools/src/web_fetch.rs:780-823 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (44 corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:173— crates/zeroclaw-runtime/src/cron/store.rs:173-221 | crates/zeroclaw-runtime/src/cron/store.rs:236-279 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (44 corresponding lines) crates/zeroclaw-channels/src/login_probe.rs:42— crates/zeroclaw-channels/src/login_probe.rs:42-85 | crates/zeroclaw-channels/src/login_relink.rs:70-116 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (41 corresponding lines) · ×4
Edited copy of a member (41 corresponding lines) crates/zeroclaw-memory/src/sqlite.rs:1716— crates/zeroclaw-memory/src/sqlite.rs:1716-1756 | crates/zeroclaw-memory/src/sqlite.rs:2539-2579 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (41 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:4615— crates/zeroclaw-channels/src/matrix.rs:4615-4655 | crates/zeroclaw-channels/src/matrix.rs:4680-4723 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (41 corresponding lines) apps/zerocode/src/jsonrpc.rs:221— apps/zerocode/src/jsonrpc.rs:221-261 | crates/zeroclaw-api/src/jsonrpc.rs:370-417 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (41 corresponding lines) apps/zerocode/src/dashboard.rs:976— apps/zerocode/src/dashboard.rs:976-1023 | apps/zerocode/src/dashboard.rs:1652-1692 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×4
Edited copies of one member (3 members, 9+ corresponding lines) crates/zeroclaw-providers/src/auth/mod.rs:708— crates/zeroclaw-providers/src/auth/mod.rs:708-716 | crates/zeroclaw-providers/src/auth/mod.rs:723-733 | crates/zeroclaw-providers/src/auth/mod.rs:741-757 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) apps/zerocode/src/enroll.rs:535— apps/zerocode/src/enroll.rs:535-546 | apps/zerorelay/src/enroll_proxy.rs:372-380 | crates/zeroclaw-tls/src/lib.rs:238-247 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) crates/zeroclaw-infra/src/session_store.rs:408— crates/zeroclaw-infra/src/session_store.rs:408-416 | crates/zeroclaw-runtime/src/doctor/mod.rs:565-573 | crates/zeroclaw-runtime/src/sop/mod.rs:800-808 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) crates/zeroclaw-runtime/src/live_config_authority.rs:1390— crates/zeroclaw-runtime/src/live_config_authority.rs:1390-1398 | crates/zeroclaw-runtime/src/live_config_authority.rs:1402-1410 | crates/zeroclaw-runtime/src/live_config_authority.rs:1414-1422 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×4
Edited copies of one member (3 members, 4+ corresponding lines) crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:129— crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:129-132 | crates/zeroclaw-runtime/src/tunnel/ngrok.rs:122-125 | crates/zeroclaw-runtime/src/tunnel/openvpn.rs:159-162 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) crates/zeroclaw-channels/src/git/channel.rs:205— crates/zeroclaw-channels/src/git/channel.rs:205-209 | crates/zeroclaw-channels/src/imessage.rs:84-87 | crates/zeroclaw-channels/src/irc.rs:264-267 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) apps/zerocode/src/main.rs:217— apps/zerocode/src/main.rs:217-220 | crates/zeroclaw-channels/src/telegram.rs:4609-4612 | crates/zeroclaw-config/src/schema.rs:11522-11525 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) crates/zeroclaw-tools/src/file_download.rs:176— crates/zeroclaw-tools/src/file_download.rs:176-179 | crates/zeroclaw-tools/src/http_request.rs:756-759 | crates/zeroclaw-tools/src/web_fetch.rs:638-641 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (31 lines × 2) crates/zeroclaw-config/src/policy.rs:2956— crates/zeroclaw-config/src/policy.rs:2956-2986 | crates/zeroclaw-config/src/policy.rs:3010-3040 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/policy.rs:2956` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/hygiene.rs:225` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-memory/src/hygiene.rs:222` calls `join`, `create_dir_all` and `crates/zeroclaw-memory/src/hygiene.rs:316` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (31 lines × 2) crates/zeroclaw-runtime/src/sop/dispatch.rs:927— crates/zeroclaw-runtime/src/sop/dispatch.rs:927-957 | crates/zeroclaw-runtime/src/sop/dispatch.rs:976-1006 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/dispatch.rs:927` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/file_upload.rs:176` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) apps/zerocode/src/enroll.rs:424— apps/zerocode/src/enroll.rs:424-452 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (29 lines × 2) crates/zeroclaw-providers/src/openrouter.rs:682— crates/zeroclaw-providers/src/openrouter.rs:682-710 | crates/zeroclaw-providers/src/openrouter.rs:755-783 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openrouter.rs:682` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:665— crates/zeroclaw-runtime/src/tools/delegate.rs:665-693 | crates/zeroclaw-runtime/src/tools/delegate.rs:726-754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:665` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29 lines × 2) crates/zeroclaw-providers/src/dispatch.rs:720— crates/zeroclaw-providers/src/dispatch.rs:720-748 | crates/zeroclaw-providers/src/dispatch.rs:1100-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/dispatch.rs:720` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 3) crates/zeroclaw-memory/src/sqlite.rs:2004— crates/zeroclaw-memory/src/sqlite.rs:2004-2018 | crates/zeroclaw-memory/src/sqlite.rs:2053-2067 | crates/zeroclaw-memory/src/sqlite.rs:2192-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:2004` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cron/mod.rs:231` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 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 12 separate duplicated blocks between them, totalling at least 145 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openai.rs:643` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 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 (14 lines × 4) crates/zeroclaw-runtime/src/tools/schedule.rs:130— crates/zeroclaw-runtime/src/tools/schedule.rs:130-143 | crates/zeroclaw-runtime/src/tools/schedule.rs:160-173 | crates/zeroclaw-runtime/src/tools/schedule.rs:183-196 | crates/zeroclaw-runtime/src/tools/schedule.rs:206-219 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/schedule.rs:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 4) crates/zeroclaw-tools/src/claude_code.rs:217— crates/zeroclaw-tools/src/claude_code.rs:217-230 | crates/zeroclaw-tools/src/codex_cli.rs:178-191 | crates/zeroclaw-tools/src/gemini_cli.rs:158-171 | crates/zeroclaw-tools/src/opencode_cli.rs:158-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 5 separate duplicated blocks between them, totalling at least 94 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/claude_code.rs:217` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/email_channel.rs:489` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:10821— crates/zeroclaw-channels/src/orchestrator/mod.rs:10821-10834 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11326-11338 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10821` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:5067— crates/zeroclaw-runtime/src/agent/turn/mod.rs:5067-5079 | crates/zeroclaw-runtime/src/sop/executor.rs:1329-1342 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/turn/mod.rs:5067` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–14 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:292— crates/zeroclaw-runtime/src/cron/store.rs:292-305 | crates/zeroclaw-runtime/src/cron/store.rs:509-521 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/store.rs:292` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–13 lines × 2) crates/zeroclaw-gateway/src/acp.rs:74— crates/zeroclaw-gateway/src/acp.rs:74-83 | src/main.rs:10351-10363 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/acp.rs:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–13 lines × 2) crates/zeroclaw-gateway/src/api_oidc.rs:625— crates/zeroclaw-gateway/src/api_oidc.rs:625-634 | crates/zeroclaw-gateway/src/api_oidc.rs:846-858 — both copies are in the same file, so extract the block into 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–13 lines × 2) crates/zeroclaw-runtime/src/tools/delegate.rs:1911— crates/zeroclaw-runtime/src/tools/delegate.rs:1911-1920 | crates/zeroclaw-runtime/src/tools/delegate.rs:1958-1970 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–13 lines × 2) crates/zeroclaw-runtime/src/tools/sop_advance.rs:246— crates/zeroclaw-runtime/src/tools/sop_advance.rs:246-255 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:164-176 — 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 6 separate duplicated blocks between them, totalling at least 73 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/sop_advance.rs:246` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/cli.rs:72` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 4) REDACTED:2100— REDACTED:2100-2111 | REDACTED:2274-2285 | REDACTED:2299-2310 | REDACTED:2458-2469 — 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 7 separate duplicated blocks between them, totalling at least 96 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 5 separate duplicated blocks between them, totalling at least 94 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/claude_code.rs:286` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 6) crates/zeroclaw-providers/src/dispatch.rs:734— crates/zeroclaw-providers/src/dispatch.rs:734-740 | crates/zeroclaw-providers/src/dispatch.rs:772-778 | crates/zeroclaw-providers/src/dispatch.rs:804-810 | crates/zeroclaw-providers/src/dispatch.rs:1114-1120 | crates/zeroclaw-providers/src/dispatch.rs:1150-1156 | crates/zeroclaw-providers/src/dispatch.rs:1182-1188 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/dispatch.rs:734` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/dispatch.rs:733` calls `enter` and `crates/zeroclaw-providers/src/dispatch.rs:771` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 6) crates/zeroclaw-runtime/src/rpc/dispatch.rs:5485— crates/zeroclaw-runtime/src/rpc/dispatch.rs:5485-5491 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6024-6030 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6041-6047 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6248-6254 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:6521-6527 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:8637-8643 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:5485` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 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:3380-3386 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:297` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 6) crates/zeroclaw-providers/src/anthropic.rs:686— crates/zeroclaw-providers/src/anthropic.rs:686-692 | 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 5 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 (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:237-241 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/imessage.rs:322` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/slack.rs:3767` calls `Some` and `crates/zeroclaw-runtime/src/skills/review.rs:234` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 9) crates/zeroclaw-channels/src/matrix.rs:1205— crates/zeroclaw-channels/src/matrix.rs:1205-1209 | crates/zeroclaw-channels/src/matrix.rs:2795-2799 | crates/zeroclaw-tools/src/model_routing_config.rs:113-117 | crates/zeroclaw-tools/src/proxy_config.rs:41-45 | crates/zeroclaw-tools/src/web_search_tool.rs:407-411 | crates/zeroclaw-tools/src/web_search_tool.rs:629-633 | crates/zeroclaw-tools/src/web_search_tool.rs:805-809 | crates/zeroclaw-tools/src/web_search_tool.rs:944-948 | crates/zeroclaw-tools/src/web_search_tool.rs:1784-1788 — 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 12 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:1205` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 9) crates/zeroclaw-tools/src/knowledge_tool.rs:163— crates/zeroclaw-tools/src/knowledge_tool.rs:163-168 | crates/zeroclaw-tools/src/knowledge_tool.rs:177-181 | crates/zeroclaw-tools/src/knowledge_tool.rs:192-197 | crates/zeroclaw-tools/src/knowledge_tool.rs:334-339 | crates/zeroclaw-tools/src/knowledge_tool.rs:348-352 | crates/zeroclaw-tools/src/knowledge_tool.rs:363-368 | crates/zeroclaw-tools/src/knowledge_tool.rs:410-415 | crates/zeroclaw-tools/src/knowledge_tool.rs:493-498 | crates/zeroclaw-tools/src/knowledge_tool.rs:753-758 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/knowledge_tool.rs:163` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-tools/src/knowledge_tool.rs:408` calls `or_else`, `get` and `crates/zeroclaw-tools/src/knowledge_tool.rs:161` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 9) crates/zeroclaw-tools/src/model_routing_config.rs:205— crates/zeroclaw-tools/src/model_routing_config.rs:205-209 | crates/zeroclaw-tools/src/model_routing_config.rs:345-350 | crates/zeroclaw-tools/src/model_routing_config.rs:376-380 | crates/zeroclaw-tools/src/model_routing_config.rs:398-402 | crates/zeroclaw-tools/src/model_routing_config.rs:430-434 | crates/zeroclaw-tools/src/model_routing_config.rs:462-466 | crates/zeroclaw-tools/src/model_routing_config.rs:490-494 | crates/zeroclaw-tools/src/proxy_config.rs:107-111 | crates/zeroclaw-tools/src/proxy_config.rs:138-143 — 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 12 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/model_routing_config.rs:205` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 7) crates/zeroclaw-channels/src/notion.rs:498— crates/zeroclaw-channels/src/notion.rs:498-502 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11216-11223 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15086-15090 | crates/zeroclaw-gateway/src/ws.rs:840-844 | crates/zeroclaw-runtime/src/observability/mod.rs:398-405 | crates/zeroclaw-runtime/src/tools/mod.rs:3732-3736 | crates/zeroclaw-runtime/src/tools/mod.rs:3764-3769 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/notion.rs:498` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:11227` calls `Err` and `crates/zeroclaw-channels/src/notion.rs:506` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 7) crates/zeroclaw-runtime/src/tools/delegate.rs:3041— crates/zeroclaw-runtime/src/tools/delegate.rs:3041-3046 | crates/zeroclaw-runtime/src/tools/delegate.rs:4091-4096 | crates/zeroclaw-tools/src/claude_code.rs:105-109 | crates/zeroclaw-tools/src/claude_code_runner.rs:127-131 | crates/zeroclaw-tools/src/codex_cli.rs:108-112 | crates/zeroclaw-tools/src/gemini_cli.rs:88-92 | crates/zeroclaw-tools/src/opencode_cli.rs:88-92 — before extracting anything, compare `crates/zeroclaw-tools/src/claude_code.rs` and `crates/zeroclaw-tools/src/claude_code_runner.rs` as WHOLE FILES: this scan already matched 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:3041` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 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:1527-1532 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1550-1554 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2430-2434 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:682` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/microsoft365/mod.rs:125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Outbound HTTP without resilience crates/zeroclaw-runtime/src/agent/agent.rs:1500— `AgentBuilder::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 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 · ×3
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/auth/ReauthPrompt.tsx:101— 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.
Low contrast colour pair in CSS (2.1:1) .claude/skills/skill-creator/eval-viewer/viewer.html:83— `.section-header` sets color: #b0aea5 on background-color: #faf9f5 — 2.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (2.1:1) .claude/skills/skill-creator/eval-viewer/viewer.html:136— `.output-file-header` sets color: #b0aea5 on background-color: #faf9f5 — 2.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (2.1:1) .claude/skills/skill-creator/eval-viewer/viewer.html:221— `.prev-feedback` sets color: #b0aea5 on background-color: #faf9f5 — 2.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Focus outline removed inline web/src/components/ChatTabBar.tsx:229— <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:357— <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).
Config::validate (cyclomatic 277) crates/zeroclaw-config/src/schema.rs:24639— Config::validate has cyclomatic complexity 277 (threshold 15). To reduce it, separate the cases: extract each independent 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 20) crates/zeroclaw-config/src/schema.rs:23448— Config::load_or_init 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.
Config::validate_auth (cyclomatic 18) crates/zeroclaw-config/src/schema.rs:14471— 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.
Agent::turn_streamed_with_steering_body (cyclomatic 52) crates/zeroclaw-runtime/src/agent/agent.rs:4912— Agent::turn_streamed_with_steering_body has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Agent::build_with_capabilities (cyclomatic 20) crates/zeroclaw-runtime/src/agent/agent.rs:3274— Agent::build_with_capabilities 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.
Agent::turn (cyclomatic 17) crates/zeroclaw-runtime/src/agent/agent.rs:4385— 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:2485— 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:3255— 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:1407— 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.
DelegateTool::execute_agentic_with_approval_registry (cyclomatic 39) crates/zeroclaw-runtime/src/tools/delegate.rs:5225— DelegateTool::execute_agentic_with_approval_registry 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.
DelegateTool::execute_background (cyclomatic 17) crates/zeroclaw-runtime/src/tools/delegate.rs:3525— 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:4699— 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.
WhatsAppWebChannel::listen (cyclomatic 37) crates/zeroclaw-channels/src/whatsapp_web.rs:3927— 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:3666— 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.
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.
RpcClient::spawn_ws_session (cyclomatic 20) apps/zerocode/src/client.rs:2010— 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:1732— 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.
RpcClient::connect_over (cyclomatic 17) crates/zeroclaw-rpc-client/src/client.rs:368— RpcClient::connect_over 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_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:1157— 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:976— 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:671— 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:3927— 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:3666— 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 76) apps/zerocode/src/chat.rs:11831— ChatState::apply_update has cognitive complexity 76 (threshold 15). Drivers by points: if/else 31 (64 pts), match/switch 4 (7 pts), boolean chains 3, loops 1 (2 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.
ChatState::open_transcript_context_menu (cognitive 18) apps/zerocode/src/chat.rs:10756— 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:12863— 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.
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:774— 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::retry_claims (cognitive 17) crates/zeroclaw-plugins/src/host.rs:1050— 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.
RpcClient::spawn_ws_session (cognitive 38) apps/zerocode/src/client.rs:2010— 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:1732— 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.
RpcClient::connect_over (cognitive 23) crates/zeroclaw-rpc-client/src/client.rs:368— RpcClient::connect_over has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 6 (9 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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:1823— 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 28) apps/zerocode/src/logs.rs:648— Logs::load_page has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (22 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:1365— 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.
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.
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/gmail_push.rs:697— crates/zeroclaw-channels/src/gmail_push.rs:697-719 | crates/zeroclaw-channels/src/notion.rs:64-92 | crates/zeroclaw-channels/src/wechat.rs:479-569 | crates/zeroclaw-providers/src/azure_openai.rs:118-138 | crates/zeroclaw-providers/src/openai.rs:149-169 | crates/zeroclaw-runtime/src/security/vulnerability.rs:71-94 | crates/zeroclaw-tools/src/notion_tool.rs:33-51 | crates/zeroclaw-tools/src/pipeline.rs:352-401 — 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:3262— crates/zeroclaw-providers/src/anthropic.rs:3262-3593 | crates/zeroclaw-providers/src/compatible.rs:2838-3020 | crates/zeroclaw-providers/src/compatible.rs:4785-5033 | crates/zeroclaw-providers/src/compatible.rs:5042-5212 | crates/zeroclaw-providers/src/compatible.rs:5220-5356 | 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-providers/src/auth/mod.rs:1337— crates/zeroclaw-providers/src/auth/mod.rs:1337-1399 | crates/zeroclaw-providers/src/bedrock.rs:355-372 | crates/zeroclaw-providers/src/gemini.rs:356-441 | 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 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.
D4 · Code Duplication· Edited copy of a member (48 corresponding lines) · ×3
Edited copy of a member (48 corresponding lines) crates/zeroclaw-tool-call-parser/src/lib.rs:1439— crates/zeroclaw-tool-call-parser/src/lib.rs:1439-1486 | crates/zeroclaw-tool-call-parser/src/lib.rs:1488-1559 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (48 corresponding lines) crates/zeroclaw-memory/src/hygiene.rs:212— crates/zeroclaw-memory/src/hygiene.rs:212-262 | crates/zeroclaw-memory/src/hygiene.rs:308-355 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (48 corresponding lines) crates/zeroclaw-config/src/policy.rs:2948— crates/zeroclaw-config/src/policy.rs:2948-2999 | crates/zeroclaw-config/src/policy.rs:3002-3049 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (53 corresponding lines) · ×3
Edited copy of a member (53 corresponding lines) crates/zeroclaw-channels/src/matrix.rs:5472— crates/zeroclaw-channels/src/matrix.rs:5472-5535 | crates/zeroclaw-channels/src/signal.rs:1529-1581 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (53 corresponding lines) src/alias_cli/mod.rs:756— src/alias_cli/mod.rs:756-808 | src/alias_cli/mod.rs:827-884 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (53 corresponding lines) src/alias_cli/mod.rs:145— src/alias_cli/mod.rs:145-197 | src/alias_cli/mod.rs:471-524 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (51 corresponding lines) · ×3
Edited copy of a member (51 corresponding lines) crates/zeroclaw-channels/src/slack.rs:1264— crates/zeroclaw-channels/src/slack.rs:1264-1314 | crates/zeroclaw-channels/src/slack.rs:4173-4227 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (51 corresponding lines) crates/zeroclaw-runtime/src/tools/delegate.rs:2631— crates/zeroclaw-runtime/src/tools/delegate.rs:2631-2684 | crates/zeroclaw-runtime/src/tools/delegate.rs:2690-2740 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (51 corresponding lines) crates/zeroclaw-tools/src/cloud_ops.rs:256— crates/zeroclaw-tools/src/cloud_ops.rs:256-319 | crates/zeroclaw-tools/src/cloud_ops.rs:366-416 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×3
Edited copy of a member (36 corresponding lines) crates/zeroclaw-runtime/src/tools/delegate.rs:658— crates/zeroclaw-runtime/src/tools/delegate.rs:658-693 | crates/zeroclaw-runtime/src/tools/delegate.rs:719-754 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) crates/zeroclaw-runtime/src/skills/mod.rs:1296— crates/zeroclaw-runtime/src/skills/mod.rs:1296-1332 | crates/zeroclaw-runtime/src/skills/mod.rs:3045-3080 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) crates/zeroclaw-runtime/src/tools/delegate.rs:2177— crates/zeroclaw-runtime/src/tools/delegate.rs:2177-2213 | crates/zeroclaw-runtime/src/tools/delegate.rs:2220-2255 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×3
Edited copy of a member (35 corresponding lines) crates/zeroclaw-gateway/src/api_config.rs:1693— crates/zeroclaw-gateway/src/api_config.rs:1693-1738 | crates/zeroclaw-gateway/src/api_config.rs:2164-2198 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) REDACTED:2616— REDACTED:2616-2650 | REDACTED:2803-2838 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:417— crates/zeroclaw-runtime/src/cron/store.rs:417-451 | crates/zeroclaw-runtime/src/cron/store.rs:453-496 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×3
Edited copy of a member (34 corresponding lines) crates/zeroclaw-channels/src/line.rs:1104— crates/zeroclaw-channels/src/line.rs:1104-1138 | crates/zeroclaw-channels/src/line.rs:1141-1174 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) crates/zeroclaw-runtime/src/sop/engine.rs:3787— crates/zeroclaw-runtime/src/sop/engine.rs:3787-3820 | crates/zeroclaw-runtime/src/sop/engine.rs:3836-3877 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:1322— crates/zeroclaw-runtime/src/cron/store.rs:1322-1355 | crates/zeroclaw-runtime/src/cron/store.rs:1370-1404 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 23+ corresponding lines) · ×3
Edited copies of one member (3 members, 23+ corresponding lines) crates/zeroclaw-log/src/writer.rs:826— crates/zeroclaw-log/src/writer.rs:826-849 | crates/zeroclaw-log/src/writer.rs:854-876 | crates/zeroclaw-log/src/writer.rs:880-904 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 23+ corresponding lines) crates/zeroclaw-config/src/presets.rs:231— crates/zeroclaw-config/src/presets.rs:231-253 | crates/zeroclaw-config/src/presets.rs:255-279 | crates/zeroclaw-config/src/presets.rs:287-309 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 23+ corresponding lines) crates/zeroclaw-config/src/presets.rs:72— crates/zeroclaw-config/src/presets.rs:72-94 | crates/zeroclaw-config/src/presets.rs:96-120 | crates/zeroclaw-config/src/presets.rs:122-146 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×3
Edited copies of one member (3 members, 16+ corresponding lines) crates/zeroclaw-gateway/src/api_sop_author.rs:924— crates/zeroclaw-gateway/src/api_sop_author.rs:924-939 | crates/zeroclaw-gateway/src/api_sop_author.rs:994-1011 | crates/zeroclaw-gateway/src/api_sop_author.rs:1017-1032 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) xtask/src/cmd/mdbook/feature_matrix.rs:114— xtask/src/cmd/mdbook/feature_matrix.rs:114-130 | xtask/src/cmd/mdbook/feature_matrix.rs:132-147 | xtask/src/cmd/mdbook/feature_matrix.rs:149-166 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) crates/zeroclaw-channels/src/whatsapp_storage.rs:631— crates/zeroclaw-channels/src/whatsapp_storage.rs:631-647 | crates/zeroclaw-channels/src/whatsapp_storage.rs:969-987 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1395-1410 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×3
Edited copies of one member (3 members, 14+ corresponding lines) crates/zeroclaw-runtime/src/rpc/dispatch.rs:11739— crates/zeroclaw-runtime/src/rpc/dispatch.rs:11739-11754 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:11756-11773 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:11775-11788 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) crates/zeroclaw-channels/src/lark.rs:2453— crates/zeroclaw-channels/src/lark.rs:2453-2467 | crates/zeroclaw-channels/src/lark.rs:2502-2515 | crates/zeroclaw-channels/src/lark.rs:3691-3709 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) crates/zeroclaw-channels/src/discord/slash.rs:15— crates/zeroclaw-channels/src/discord/slash.rs:15-31 | crates/zeroclaw-config/src/schema/v2.rs:2984-2997 | crates/zeroclaw-runtime/src/sop/procedural_memory.rs:488-501 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×3
Edited copies of one member (3 members, 17+ corresponding lines) crates/zeroclaw-runtime/src/identity.rs:233— crates/zeroclaw-runtime/src/identity.rs:233-251 | crates/zeroclaw-runtime/src/identity.rs:498-514 | crates/zeroclaw-runtime/src/identity.rs:516-532 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) crates/zeroclaw-channels/src/transcription.rs:150— crates/zeroclaw-channels/src/transcription.rs:150-170 | crates/zeroclaw-channels/src/transcription.rs:260-277 | crates/zeroclaw-channels/src/transcription.rs:365-381 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) crates/zeroclaw-channels/src/discord/interaction.rs:31— crates/zeroclaw-channels/src/discord/interaction.rs:31-47 | crates/zeroclaw-channels/src/discord/interaction.rs:58-76 | crates/zeroclaw-channels/src/discord/interaction.rs:130-150 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×3
Edited copies of one member (4 members, 12+ corresponding lines) apps/zerocode/src/input_bar.rs:1290— apps/zerocode/src/input_bar.rs:1290-1303 | apps/zerocode/src/input_bar.rs:1309-1321 | apps/zerocode/src/input_bar.rs:1323-1336 | apps/zerocode/src/input_bar.rs:1338-1349 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) crates/zeroclaw-runtime/src/approval/mod.rs:117— crates/zeroclaw-runtime/src/approval/mod.rs:117-128 | crates/zeroclaw-runtime/src/approval/mod.rs:130-141 | crates/zeroclaw-runtime/src/approval/mod.rs:154-165 | crates/zeroclaw-runtime/src/approval/mod.rs:177-188 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) crates/zeroclaw-runtime/src/tools/spawn_subagent.rs:199— crates/zeroclaw-runtime/src/tools/spawn_subagent.rs:199-210 | crates/zeroclaw-tools/src/codex_cli.rs:73-88 | crates/zeroclaw-tools/src/gemini_cli.rs:53-68 | crates/zeroclaw-tools/src/opencode_cli.rs:53-68 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×3
Edited copies of one member (3 members, 8+ corresponding lines) crates/zeroclaw-runtime/src/plugin_state.rs:432— crates/zeroclaw-runtime/src/plugin_state.rs:432-439 | crates/zeroclaw-runtime/src/plugin_state.rs:447-457 | crates/zeroclaw-runtime/src/plugin_state.rs:464-471 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) crates/zeroclaw-tools/src/web_search_tool.rs:993— crates/zeroclaw-tools/src/web_search_tool.rs:993-1000 | crates/zeroclaw-tools/src/web_search_tool.rs:1177-1184 | crates/zeroclaw-tools/src/web_search_tool.rs:1372-1379 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) crates/zeroclaw-api/src/channel.rs:1106— crates/zeroclaw-api/src/channel.rs:1106-1113 | crates/zeroclaw-plugins/src/wasm_channel.rs:1269-1276 | crates/zeroclaw-runtime/src/peers.rs:52-59 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×3
Edited copies of one member (3 members, 6+ corresponding lines) apps/tauri/src/commands/agent.rs:9— apps/tauri/src/commands/agent.rs:9-17 | apps/tauri/src/commands/gateway.rs:14-19 | apps/tauri/src/commands/pairing.rs:6-11 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 6+ corresponding lines) crates/zeroclaw-config/src/schema/v2.rs:3064— crates/zeroclaw-config/src/schema/v2.rs:3064-3071 | crates/zeroclaw-tools/src/hardware_memory_map.rs:41-46 | xtask/src/generate/openrpc.rs:119-125 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 6+ corresponding lines) crates/zeroclaw-channels/src/telegram.rs:6343— crates/zeroclaw-channels/src/telegram.rs:6343-6349 | crates/zeroclaw-config/src/schema_markdown.rs:372-377 | crates/zeroclaw-tools/src/report_templates.rs:31-37 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×3
Edited copy of a member (5 corresponding lines) crates/zeroclaw-gateway/src/api_sop_author.rs:38— crates/zeroclaw-gateway/src/api_sop_author.rs:38-42 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:13493-13497 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) crates/zeroclaw-gateway/src/api_config.rs:285— crates/zeroclaw-gateway/src/api_config.rs:285-289 | crates/zeroclaw-gateway/src/api_sections.rs:101-105 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) crates/zeroclaw-providers/src/request_payload.rs:1— crates/zeroclaw-providers/src/request_payload.rs:1-7 | crates/zeroclaw-tools/src/git_forge.rs:686-690 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×3
Edited copy of a member (4 corresponding lines) crates/zeroclaw-channels/src/slack.rs:3228— crates/zeroclaw-channels/src/slack.rs:3228-3236 | crates/zeroclaw-providers/src/multimodal.rs:4452-4455 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) crates/zeroclaw-providers/src/gemini.rs:682— crates/zeroclaw-providers/src/gemini.rs:682-688 | crates/zeroclaw-tools/src/microsoft365/auth.rs:346-349 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) crates/zeroclaw-runtime/src/security/bubblewrap.rs:138— crates/zeroclaw-runtime/src/security/bubblewrap.rs:138-141 | crates/zeroclaw-runtime/src/security/firejail.rs:242-245 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (35 lines × 2) crates/zeroclaw-memory/src/lucid.rs:416— crates/zeroclaw-memory/src/lucid.rs:416-450 | crates/zeroclaw-memory/src/markdown.rs:205-239 — 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 (35 lines × 2) crates/zeroclaw-memory/src/qdrant.rs:182— crates/zeroclaw-memory/src/qdrant.rs:182-216 | crates/zeroclaw-memory/src/qdrant.rs:885-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/qdrant.rs:182` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1777— crates/zeroclaw-runtime/src/agent/loop_.rs:1777-1811 | crates/zeroclaw-runtime/src/agent/loop_.rs:3866-3900 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:1777` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28 lines × 2) crates/zeroclaw-providers/src/glm.rs:188— crates/zeroclaw-providers/src/glm.rs:188-215 | crates/zeroclaw-providers/src/glm.rs:243-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/glm.rs:188` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28 lines × 2) crates/zeroclaw-tools/src/jira_tool.rs:212— crates/zeroclaw-tools/src/jira_tool.rs:212-239 | crates/zeroclaw-tools/src/jira_tool.rs:284-311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/jira_tool.rs:212` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `firmware/nucleo/src/main.rs:33` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:6025` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–27 lines × 2) crates/zeroclaw-runtime/src/agent/agent.rs:4697— crates/zeroclaw-runtime/src/agent/agent.rs:4697-4722 | crates/zeroclaw-runtime/src/agent/agent.rs:5354-5380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/agent.rs:4697` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–27 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:2069— crates/zeroclaw-runtime/src/agent/turn/mod.rs:2069-2094 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3786-3812 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/turn/mod.rs:2069` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/agent/turn/mod.rs:2069` calls `as_ref` and `crates/zeroclaw-runtime/src/agent/turn/mod.rs:3786` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/file_explorer.rs:444` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–24 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1884— crates/zeroclaw-runtime/src/agent/loop_.rs:1884-1907 | crates/zeroclaw-runtime/src/agent/loop_.rs:3967-3988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:1884` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/discord_search.rs:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (24 lines × 2) crates/zeroclaw-tools/src/sessions.rs:915— crates/zeroclaw-tools/src/sessions.rs:915-938 | crates/zeroclaw-tools/src/sessions.rs:1041-1064 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/sessions.rs:915` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) crates/zeroclaw-hardware/src/peripherals/arduino_upload.rs:325— crates/zeroclaw-hardware/src/peripherals/arduino_upload.rs:325-348 | crates/zeroclaw-hardware/src/peripherals/arduino_upload.rs:359-382 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/peripherals/arduino_upload.rs:325` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (22–23 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2807— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2807-2828 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2865-2887 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2807` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–23 lines × 2) crates/zeroclaw-runtime/src/agent/turn/mod.rs:2357— crates/zeroclaw-runtime/src/agent/turn/mod.rs:2357-2379 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:2528-2549 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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:1558— crates/zeroclaw-providers/src/compatible.rs:1558-1578 | crates/zeroclaw-providers/src/compatible.rs:4412-4431 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:1558` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/file_edit.rs:150` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20 lines × 3) crates/zeroclaw-infra/src/session_sqlite.rs:1257— crates/zeroclaw-infra/src/session_sqlite.rs:1257-1276 | crates/zeroclaw-infra/src/session_sqlite.rs:1662-1681 | crates/zeroclaw-infra/src/session_sqlite.rs:1714-1733 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-infra/src/session_sqlite.rs:1257` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 3) crates/zeroclaw-providers/src/azure_openai.rs:423— crates/zeroclaw-providers/src/azure_openai.rs:423-442 | crates/zeroclaw-providers/src/openai.rs:401-420 | crates/zeroclaw-providers/src/openrouter.rs:340-359 — 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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:423` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2965` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/reliable.rs:2963` calls `Some`, `candidate_name`, `to_string` and `crates/zeroclaw-providers/src/reliable.rs:3413` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19–20 lines × 2) crates/zeroclaw-gateway/src/ws.rs:989— crates/zeroclaw-gateway/src/ws.rs:989-1007 | crates/zeroclaw-gateway/src/ws.rs:1208-1227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/ws.rs:989` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cron/mod.rs:343` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cron/mod.rs:397` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/gpio.rs:119` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–19 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:945— crates/zeroclaw-providers/src/anthropic.rs:945-962 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/anthropic.rs:945` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:233` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18 lines × 3) crates/zeroclaw-runtime/src/sop/dispatch.rs:922— crates/zeroclaw-runtime/src/sop/dispatch.rs:922-939 | crates/zeroclaw-runtime/src/sop/dispatch.rs:971-988 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1212-1229 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/dispatch.rs:922` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 3) crates/zeroclaw-runtime/src/sop/store/sqlite.rs:184— crates/zeroclaw-runtime/src/sop/store/sqlite.rs:184-201 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:242-259 | crates/zeroclaw-runtime/src/sop/store/sqlite.rs:279-296 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/store/sqlite.rs:184` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 3) crates/zeroclaw-runtime/src/tools/cron_remove.rs:89— crates/zeroclaw-runtime/src/tools/cron_remove.rs:89-106 | crates/zeroclaw-runtime/src/tools/cron_run.rs:152-169 | crates/zeroclaw-runtime/src/tools/cron_runs.rs:74-91 — 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/nextcloud_talk.rs:262` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/metrics.rs:372` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/file_upload.rs:260` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-tools/src/file_upload_bundle.rs:381` calls `display` and `crates/zeroclaw-tools/src/file_upload.rs:278` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–16 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:3829— crates/zeroclaw-channels/src/discord/mod.rs:3829-3844 | crates/zeroclaw-channels/src/discord/mod.rs:3862-3876 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:3829` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15–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 6 separate duplicated blocks between them, totalling at least 108 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/hailo_ollama.rs:947` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/daemon/mod.rs:444` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:556` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/glm.rs:179` calls `to_string` and `crates/zeroclaw-providers/src/azure_openai.rs:571` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 4) crates/zeroclaw-runtime/src/agent/loop_.rs:2185— crates/zeroclaw-runtime/src/agent/loop_.rs:2185-2199 | crates/zeroclaw-runtime/src/agent/loop_.rs:2286-2300 | crates/zeroclaw-runtime/src/agent/loop_.rs:2422-2436 | crates/zeroclaw-runtime/src/agent/loop_.rs:3076-3090 — 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 (15 lines × 4) crates/zeroclaw-providers/src/dispatch.rs:769— crates/zeroclaw-providers/src/dispatch.rs:769-783 | crates/zeroclaw-providers/src/dispatch.rs:801-815 | crates/zeroclaw-providers/src/dispatch.rs:1147-1161 | crates/zeroclaw-providers/src/dispatch.rs:1179-1193 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/dispatch.rs:769` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–15 lines × 2) apps/zerorelay/src/lib.rs:1557— apps/zerorelay/src/lib.rs:1557-1571 | crates/zeroclaw-runtime/src/relay.rs:1452-1464 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerorelay/src/lib.rs:1557` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/git/channel.rs:694` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–15 lines × 2) crates/zeroclaw-infra/src/session_sqlite.rs:1145— crates/zeroclaw-infra/src/session_sqlite.rs:1145-1157 | crates/zeroclaw-infra/src/session_sqlite.rs:1176-1190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-infra/src/session_sqlite.rs:1176` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/multimodal.rs:3194` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/approval/broker.rs:358` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10–15 lines × 2) crates/zeroclaw-runtime/src/tools/read_skill.rs:54— crates/zeroclaw-runtime/src/tools/read_skill.rs:54-68 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:97-106 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/read_skill.rs:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:346` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 4) crates/zeroclaw-providers/src/azure_openai.rs:433— crates/zeroclaw-providers/src/azure_openai.rs:433-445 | crates/zeroclaw-providers/src/copilot.rs:408-420 | crates/zeroclaw-providers/src/openai.rs:411-423 | crates/zeroclaw-providers/src/openrouter.rs:350-362 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/copilot.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:433` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 4) crates/zeroclaw-runtime/src/tools/sop_advance.rs:299— crates/zeroclaw-runtime/src/tools/sop_advance.rs:299-311 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:214-226 | 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 6 separate duplicated blocks between them, totalling at least 73 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/sop_advance.rs:299` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 3) REDACTED:879— REDACTED:879-891 | REDACTED:1134-1145 | REDACTED:1261-1272 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1257` calls `is_some`, `Ok` and `REDACTED:877` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/hygiene.rs:232` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–13 lines × 3) crates/zeroclaw-tools/src/ask_user.rs:161— crates/zeroclaw-tools/src/ask_user.rs:161-172 | crates/zeroclaw-tools/src/escalate.rs:271-282 | crates/zeroclaw-tools/src/poll.rs:259-271 — 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 7 separate duplicated blocks between them, totalling at least 96 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/ask_user.rs:161` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/observability/otel.rs:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–13 lines × 2) crates/zeroclaw-runtime/src/tunnel/ngrok.rs:52— crates/zeroclaw-runtime/src/tunnel/ngrok.rs:52-62 | crates/zeroclaw-runtime/src/tunnel/pinggy.rs:62-74 — before extracting anything, compare `crates/zeroclaw-runtime/src/tunnel/ngrok.rs` and `crates/zeroclaw-runtime/src/tunnel/pinggy.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tunnel/ngrok.rs:52` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:9173-9183 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tool-call-parser/src/lib.rs:1208` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-tool-call-parser/src/lib.rs:1220` calls `Some`, `push` and `src/main.rs:9183` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2722` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/slack.rs:5631` calls `and_then` and `crates/zeroclaw-channels/src/slack.rs:5709` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:252` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 5) crates/zeroclaw-channels/src/slack.rs:1275— crates/zeroclaw-channels/src/slack.rs:1275-1285 | crates/zeroclaw-channels/src/slack.rs:1331-1341 | 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 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:1275` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 5) crates/zeroclaw-channels/src/transcription.rs:179— crates/zeroclaw-channels/src/transcription.rs:179-189 | crates/zeroclaw-channels/src/transcription.rs:286-296 | crates/zeroclaw-channels/src/transcription.rs:390-400 | crates/zeroclaw-channels/src/transcription.rs:508-518 | crates/zeroclaw-channels/src/transcription.rs:683-693 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/transcription.rs:179` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/transcription.rs:298` calls `to_string` and `crates/zeroclaw-channels/src/transcription.rs:695` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-plugins/src/wasm_channel.rs:1347` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 3) crates/zeroclaw-runtime/src/agent/agent.rs:3394— crates/zeroclaw-runtime/src/agent/agent.rs:3394-3404 | crates/zeroclaw-runtime/src/agent/loop_.rs:1794-1803 | crates/zeroclaw-runtime/src/agent/loop_.rs:3883-3892 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 3) crates/zeroclaw-runtime/src/agent/loop_.rs:2251— crates/zeroclaw-runtime/src/agent/loop_.rs:2251-2260 | crates/zeroclaw-runtime/src/agent/loop_.rs:2843-2852 | crates/zeroclaw-runtime/src/agent/loop_.rs:4237-4247 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2251` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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:9174-9183 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tool-call-parser/src/lib.rs:1210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-tool-call-parser/src/lib.rs:1220` calls `Some`, `push` and `src/main.rs:9183` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/cli.rs:71` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 6) crates/zeroclaw-providers/src/glm.rs:201— crates/zeroclaw-providers/src/glm.rs:201-210 | crates/zeroclaw-providers/src/glm.rs:256-265 | crates/zeroclaw-providers/src/openrouter.rs:696-705 | crates/zeroclaw-providers/src/openrouter.rs:769-778 | crates/zeroclaw-providers/src/telnyx.rs:211-220 | crates/zeroclaw-providers/src/telnyx.rs:278-287 — before extracting anything, compare `crates/zeroclaw-providers/src/glm.rs` and `crates/zeroclaw-providers/src/telnyx.rs` as WHOLE FILES: this scan already matched 4 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/glm.rs:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:6498— crates/zeroclaw-channels/src/orchestrator/mod.rs:6498-6507 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6534-6543 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6553-6565 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6584-6593 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6891-6900 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6908-6917 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:6498` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 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-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:241` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 3) apps/zerocode/src/config_manager.rs:3543— apps/zerocode/src/config_manager.rs:3543-3551 | apps/zerocode/src/config_manager.rs:3765-3774 | apps/zerocode/src/config_manager.rs:3963-3971 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:3543` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_sop_author.rs:443` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 3) crates/zeroclaw-runtime/src/hooks/runner.rs:197— crates/zeroclaw-runtime/src/hooks/runner.rs:197-205 | crates/zeroclaw-runtime/src/hooks/runner.rs:224-232 | crates/zeroclaw-runtime/src/hooks/runner.rs:255-264 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/hooks/runner.rs:197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/grok_cli/acp.rs:456` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:1161` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/dispatch.rs:745` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/hooks/runner.rs:311` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 6) crates/zeroclaw-tools/src/browser.rs:2397— crates/zeroclaw-tools/src/browser.rs:2397-2404 | crates/zeroclaw-tools/src/browser.rs:2414-2421 | crates/zeroclaw-tools/src/browser.rs:2441-2448 | crates/zeroclaw-tools/src/browser.rs:2468-2475 | crates/zeroclaw-tools/src/browser.rs:2545-2552 | crates/zeroclaw-tools/src/browser.rs:2583-2590 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/browser.rs:2397` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:877` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/email_oauth2.rs:148` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 3) crates/zeroclaw-providers/src/auth/mod.rs:1339— crates/zeroclaw-providers/src/auth/mod.rs:1339-1345 | crates/zeroclaw-providers/src/auth/mod.rs:1361-1368 | crates/zeroclaw-providers/src/auth/mod.rs:1382-1389 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–8 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1254— crates/zeroclaw-channels/src/discord/mod.rs:1254-1261 | crates/zeroclaw-channels/src/discord/mod.rs:1400-1405 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:1254` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/loader.rs:189` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–8 lines × 2) crates/zeroclaw-runtime/src/relay.rs:477— crates/zeroclaw-runtime/src/relay.rs:477-482 | crates/zeroclaw-runtime/src/relay.rs:493-500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/relay.rs:477` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 3) crates/zeroclaw-gateway/src/lib.rs:4953— crates/zeroclaw-gateway/src/lib.rs:4953-4958 | crates/zeroclaw-gateway/src/lib.rs:5083-5088 | crates/zeroclaw-gateway/src/lib.rs:5223-5229 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:5223` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 3) crates/zeroclaw-providers/src/compatible.rs:1068— crates/zeroclaw-providers/src/compatible.rs:1068-1074 | crates/zeroclaw-providers/src/compatible.rs:1142-1148 | crates/zeroclaw-providers/src/compatible.rs:1161-1166 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:1068` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 3) crates/zeroclaw-runtime/src/agent/tool_execution.rs:67— crates/zeroclaw-runtime/src/agent/tool_execution.rs:67-73 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3826-3831 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3871-3877 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/tool_execution.rs:67` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–7 lines × 2) crates/zeroclaw-channels/src/lark.rs:2293— crates/zeroclaw-channels/src/lark.rs:2293-2299 | crates/zeroclaw-channels/src/telegram.rs:5780-5785 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2293` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 2) crates/zeroclaw-providers/src/openai_codex.rs:1094— crates/zeroclaw-providers/src/openai_codex.rs:1094-1099 | crates/zeroclaw-providers/src/openai_codex.rs:1125-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openai_codex.rs:1094` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-sop-graph/src/lib.rs:339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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:217-222 | crates/zeroclaw-gateway/src/api_skills.rs:255-260 | crates/zeroclaw-gateway/src/api_skills.rs:285-290 | crates/zeroclaw-gateway/src/api_skills.rs:313-318 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-gateway/src/api_skills.rs:215` calls `Json` and `crates/zeroclaw-gateway/src/api_skills.rs:109` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 7) crates/zeroclaw-providers/src/azure_openai.rs:396— crates/zeroclaw-providers/src/azure_openai.rs:396-402 | crates/zeroclaw-providers/src/compatible.rs:3502-3507 | crates/zeroclaw-providers/src/copilot.rs:373-379 | crates/zeroclaw-providers/src/hailo_ollama.rs:555-561 | crates/zeroclaw-providers/src/ollama.rs:409-415 | crates/zeroclaw-providers/src/openai.rs:374-380 | crates/zeroclaw-providers/src/openrouter.rs:312-318 — 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 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:396` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 7) crates/zeroclaw-channels/src/matrix.rs:1950— crates/zeroclaw-channels/src/matrix.rs:1950-1956 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17094-17100 | crates/zeroclaw-channels/src/voice_wake.rs:407-415 | crates/zeroclaw-channels/src/wechat.rs:2613-2619 | crates/zeroclaw-gateway/src/lib.rs:2093-2099 | crates/zeroclaw-providers/src/openai_codex.rs:1433-1438 | crates/zeroclaw-runtime/src/daemon/mod.rs:2684-2690 — 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 7 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:1950` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 6) crates/zeroclaw-tools/src/linkedin_client.rs:625— crates/zeroclaw-tools/src/linkedin_client.rs:625-630 | crates/zeroclaw-tools/src/linkedin_client.rs:640-645 | crates/zeroclaw-tools/src/linkedin_client.rs:975-980 | crates/zeroclaw-tools/src/linkedin_client.rs:1038-1043 | crates/zeroclaw-tools/src/linkedin_client.rs:1096-1101 | crates/zeroclaw-tools/src/linkedin_client.rs:1152-1157 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin_client.rs:625` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:762` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-tools/src/web_search_tool.rs:757` calls `get`, `and_then`, `as_str` and `crates/zeroclaw-tools/src/web_search_tool.rs:1463` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 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 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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:3550` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5–6 lines × 2) REDACTED:856— REDACTED:856-860 | REDACTED:1110-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:856` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5–6 lines × 2) crates/zeroclaw-runtime/src/cron/outbox.rs:332— crates/zeroclaw-runtime/src/cron/outbox.rs:332-336 | crates/zeroclaw-runtime/src/cron/outbox.rs:430-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/outbox.rs:332` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5–6 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:3220— crates/zeroclaw-runtime/src/skills/mod.rs:3220-3224 | crates/zeroclaw-runtime/src/skills/mod.rs:3271-3276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:3220` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 13) crates/zeroclaw-channels/src/bluesky.rs:592— crates/zeroclaw-channels/src/bluesky.rs:592-599 | crates/zeroclaw-channels/src/clawdtalk.rs:339-343 | crates/zeroclaw-channels/src/matrix.rs:1948-1952 | crates/zeroclaw-channels/src/mattermost.rs:847-851 | crates/zeroclaw-channels/src/mattermost.rs:922-927 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15989-15993 | 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:3399-3403 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/matrix.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:592` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/qq.rs:1138` calls `clone` and `crates/zeroclaw-runtime/src/tools/mod.rs:3407` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 13) crates/zeroclaw-channels/src/telegram.rs:4185— crates/zeroclaw-channels/src/telegram.rs:4185-4189 | crates/zeroclaw-channels/src/telegram.rs:4534-4538 | crates/zeroclaw-channels/src/telegram.rs:5251-5256 | crates/zeroclaw-channels/src/telegram.rs:5273-5277 | crates/zeroclaw-channels/src/telegram.rs:5731-5736 | crates/zeroclaw-channels/src/telegram.rs:5767-5771 | crates/zeroclaw-channels/src/telegram.rs:5781-5785 | crates/zeroclaw-channels/src/telegram.rs:7347-7351 | crates/zeroclaw-channels/src/telegram.rs:8109-8114 | crates/zeroclaw-channels/src/telegram.rs:8285-8290 | crates/zeroclaw-channels/src/telegram.rs:8591-8596 | crates/zeroclaw-channels/src/telegram.rs:8721-8726 | crates/zeroclaw-channels/src/telegram.rs:8739-8744 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:4185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 13) crates/zeroclaw-channels/src/orchestrator/mod.rs:14988— crates/zeroclaw-channels/src/orchestrator/mod.rs:14988-14992 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15045-15049 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15133-15137 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15195-15199 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15338-15342 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15453-15457 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15488-15492 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15597-15601 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15727-15731 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15766-15770 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15810-15814 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15890-15894 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15927-15931 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:14988` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Low contrast colour pair in CSS (3.1:1) .claude/skills/skill-creator/assets/eval_review.html:19— `.btn-export` sets color: white on background-color: #d97757 — 3.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.1:1) .claude/skills/skill-creator/eval-viewer/viewer.html:467— `.done-btn.ready` sets color: white on background-color: #d97757 — 3.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.2:1) .claude/skills/skill-creator/eval-viewer/viewer.html:302— `.grade-pass` sets color: #788c5d on background-color: #eef2e8 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.2:1) web/src/index.css:610— `.table-electric thead th` sets color: #71717a on background-color: #232329 — 3.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (1.8:1) web/src/index.css:363— `.btn-electric` sets color: white on background-color: #22d3ee — 1.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (1.8:1) web/src/index.css:413— `.btn-primary` sets color: white on background-color: #22d3ee — 1.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
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:1157— 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:976— 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:1175— 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:1607— 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.
OidcAuthProvider::claims_to_identity (cyclomatic 34) crates/zeroclaw-runtime/src/security/auth_provider/oidc.rs:809— OidcAuthProvider::claims_to_identity 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.
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.
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.
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:1823— 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 17) apps/zerocode/src/logs.rs:648— Logs::load_page 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.
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.
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.
OpenAiCompatibleModelProvider::stream_chat (cyclomatic 20) crates/zeroclaw-providers/src/compatible.rs:4779— 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.
OpenAiCompatibleModelProvider::relocate_tool_result_images (cyclomatic 16) crates/zeroclaw-providers/src/compatible.rs:3708— OpenAiCompatibleModelProvider::relocate_tool_result_images 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.
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:911— 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:2752— 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:1271— 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:1141— 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:774— 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:1563— 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.
SignalChannel::listen (cognitive 117) crates/zeroclaw-channels/src/signal.rs:1248— SignalChannel::listen has cognitive complexity 117 (threshold 15). Drivers by points: if/else 14 (79 pts), loops 5 (19 pts), match/switch 5 (17 pts), boolean chains 2 (nesting depth added 91). 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::attach_inbound_media (cognitive 16) crates/zeroclaw-channels/src/signal.rs:658— SignalChannel::attach_inbound_media has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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.
BuildRegistry::seal (cognitive 30) crates/zeroclaw-runtime/src/tools/scoped.rs:276— BuildRegistry::seal has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (21 pts), match/switch 3 (6 pts), boolean chains 2, 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.
BuildRegistry::claim_search (cognitive 27) crates/zeroclaw-runtime/src/tools/scoped.rs:177— BuildRegistry::claim_search has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 6, 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.
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.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×2
REDACTED
REDACTED
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×2
Near-duplicate member pair (52 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: 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.
Near-duplicate member pair (50 shared lines) crates/zeroclaw-runtime/src/tools/sop_advance.rs:94— crates/zeroclaw-runtime/src/tools/sop_advance.rs:94-311 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:95-226 — These two members are variants of one another: 50 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 (50 shared lines) crates/zeroclaw-providers/src/compatible.rs:4493— crates/zeroclaw-providers/src/compatible.rs:4493-4605 | crates/zeroclaw-providers/src/compatible.rs:4612-4757 — These two members are variants of one another: 50 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 (39 shared lines) crates/zeroclaw-providers/src/compatible.rs:1527— crates/zeroclaw-providers/src/compatible.rs:1527-1607 | crates/zeroclaw-providers/src/compatible.rs:4355-4473 — 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.
D4 · Code Duplication· Edited copy of a member (58 corresponding lines) · ×2
Edited copy of a member (58 corresponding lines) crates/zeroclaw-gateway/src/canvas.rs:164— crates/zeroclaw-gateway/src/canvas.rs:164-226 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:31-88 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (58 corresponding lines) crates/zeroclaw-log/src/reader.rs:989— crates/zeroclaw-log/src/reader.rs:989-1047 | crates/zeroclaw-log/src/reader.rs:1055-1112 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (67 corresponding lines) · ×2
Edited copy of a member (67 corresponding lines) crates/zeroclaw-channels/src/discord/mod.rs:4019— crates/zeroclaw-channels/src/discord/mod.rs:4019-4085 | crates/zeroclaw-channels/src/slack.rs:6245-6322 — These two members are one piece of code written twice and then edited apart: 67 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (67 corresponding lines) crates/zeroclaw-tools/src/hardware_board_info.rs:88— crates/zeroclaw-tools/src/hardware_board_info.rs:88-154 | crates/zeroclaw-tools/src/hardware_memory_map.rs:71-139 — These two members are one piece of code written twice and then edited apart: 67 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×2
Edited copy of a member (39 corresponding lines) crates/zeroclaw-channels/src/whatsapp_web.rs:4419— crates/zeroclaw-channels/src/whatsapp_web.rs:4419-4457 | crates/zeroclaw-channels/src/whatsapp_web.rs:4459-4497 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) crates/zeroclaw-tools/src/model_routing_config.rs:1759— crates/zeroclaw-tools/src/model_routing_config.rs:1759-1799 | crates/zeroclaw-tools/src/proxy_config.rs:512-550 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (50 corresponding lines) · ×2
Edited copy of a member (50 corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:622— crates/zeroclaw-runtime/src/cron/store.rs:622-692 | crates/zeroclaw-runtime/src/cron/store.rs:707-756 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (50 corresponding lines) crates/zeroclaw-runtime/src/verifiable_intent/verification.rs:352— crates/zeroclaw-runtime/src/verifiable_intent/verification.rs:352-407 | crates/zeroclaw-runtime/src/verifiable_intent/verification.rs:412-461 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×2
Edited copy of a member (40 corresponding lines) crates/zeroclaw-gateway/src/api_sop_author.rs:113— crates/zeroclaw-gateway/src/api_sop_author.rs:113-152 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:13512-13557 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (40 corresponding lines) crates/zeroclaw-tools/src/content_search.rs:749— crates/zeroclaw-tools/src/content_search.rs:749-794 | crates/zeroclaw-tools/src/content_search.rs:804-843 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 30+ corresponding lines) · ×2
Edited copies of one member (4 members, 30+ corresponding lines) crates/zeroclaw-channels/src/acp_channel.rs:133— crates/zeroclaw-channels/src/acp_channel.rs:133-165 | crates/zeroclaw-channels/src/acp_channel.rs:367-408 | crates/zeroclaw-runtime/src/rpc/approval_channel.rs:225-254 | crates/zeroclaw-runtime/src/rpc/approval_channel.rs:265-294 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 30+ corresponding lines) crates/zeroclaw-runtime/src/security/leak_detector.rs:156— crates/zeroclaw-runtime/src/security/leak_detector.rs:156-244 | crates/zeroclaw-runtime/src/security/leak_detector.rs:253-282 | crates/zeroclaw-runtime/src/security/leak_detector.rs:291-323 | crates/zeroclaw-runtime/src/security/leak_detector.rs:434-468 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×2
Edited copy of a member (31 corresponding lines) crates/zeroclaw-channels/src/transcription.rs:210— crates/zeroclaw-channels/src/transcription.rs:210-241 | crates/zeroclaw-channels/src/transcription.rs:317-347 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) crates/zeroclaw-runtime/src/rpc/session.rs:948— crates/zeroclaw-runtime/src/rpc/session.rs:948-978 | crates/zeroclaw-runtime/src/rpc/session.rs:1140-1173 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×2
Edited copy of a member (37 corresponding lines) crates/zeroclaw-providers/src/compatible.rs:1460— crates/zeroclaw-providers/src/compatible.rs:1460-1496 | crates/zeroclaw-providers/src/compatible.rs:4040-4076 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) crates/zeroclaw-memory/src/hygiene.rs:168— crates/zeroclaw-memory/src/hygiene.rs:168-210 | crates/zeroclaw-memory/src/hygiene.rs:270-306 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 17+ corresponding lines) · ×2
Edited copies of one member (4 members, 17+ corresponding lines) crates/zeroclaw-memory/src/sqlite.rs:2108— crates/zeroclaw-memory/src/sqlite.rs:2108-2127 | crates/zeroclaw-memory/src/sqlite.rs:2129-2146 | crates/zeroclaw-memory/src/sqlite.rs:2212-2228 | crates/zeroclaw-memory/src/sqlite.rs:2234-2250 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 17+ corresponding lines) crates/zeroclaw-plugins/src/wasm_channel.rs:1278— crates/zeroclaw-plugins/src/wasm_channel.rs:1278-1297 | crates/zeroclaw-plugins/src/wasm_channel.rs:1299-1315 | crates/zeroclaw-plugins/src/wasm_channel.rs:1322-1338 | crates/zeroclaw-plugins/src/wasm_memory.rs:710-729 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×2
Edited copies of one member (3 members, 19+ corresponding lines) crates/zeroclaw-runtime/src/hooks/runner.rs:193— crates/zeroclaw-runtime/src/hooks/runner.rs:193-211 | crates/zeroclaw-runtime/src/hooks/runner.rs:220-238 | crates/zeroclaw-runtime/src/hooks/runner.rs:250-270 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 19+ corresponding lines) crates/zeroclaw-providers/src/factory.rs:172— crates/zeroclaw-providers/src/factory.rs:172-191 | crates/zeroclaw-providers/src/factory.rs:1111-1129 | crates/zeroclaw-providers/src/factory.rs:1144-1163 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 18+ corresponding lines) · ×2
Edited copies of one member (4 members, 18+ corresponding lines) crates/zeroclaw-channels/src/whatsapp_storage.rs:702— crates/zeroclaw-channels/src/whatsapp_storage.rs:702-719 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1066-1088 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1093-1116 | crates/zeroclaw-channels/src/whatsapp_storage.rs:1294-1314 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 18+ corresponding lines) crates/zeroclaw-plugins/src/wasm_channel.rs:1579— crates/zeroclaw-plugins/src/wasm_channel.rs:1579-1601 | crates/zeroclaw-plugins/src/wasm_memory.rs:343-363 | crates/zeroclaw-plugins/src/wasm_memory.rs:365-385 | crates/zeroclaw-plugins/src/wasm_memory.rs:409-426 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×2
Edited copies of one member (3 members, 12+ corresponding lines) crates/zeroclaw-plugins/src/component.rs:524— crates/zeroclaw-plugins/src/component.rs:524-535 | crates/zeroclaw-plugins/src/component.rs:543-554 | crates/zeroclaw-plugins/src/component.rs:561-572 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) crates/zeroclaw-channels/src/git/providers/gitea/api.rs:188— crates/zeroclaw-channels/src/git/providers/gitea/api.rs:188-201 | crates/zeroclaw-channels/src/git/providers/gitea/api.rs:257-268 | crates/zeroclaw-channels/src/git/providers/github/api.rs:507-518 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 20+ corresponding lines) · ×2
Edited copies of one member (3 members, 20+ corresponding lines) crates/zeroclaw-tool-call-parser/src/lib.rs:642— crates/zeroclaw-tool-call-parser/src/lib.rs:642-661 | crates/zeroclaw-tool-call-parser/src/lib.rs:757-783 | crates/zeroclaw-tool-call-parser/src/lib.rs:788-814 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 20+ corresponding lines) crates/zeroclaw-runtime/src/tools/deliver_file.rs:191— crates/zeroclaw-runtime/src/tools/deliver_file.rs:191-210 | crates/zeroclaw-tools/src/file_edit.rs:41-60 | crates/zeroclaw-tools/src/file_write.rs:51-71 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 17+ corresponding lines) · ×2
Edited copies of one member (5 members, 17+ corresponding lines) crates/zeroclaw-plugins/src/wasm_channel.rs:1426— crates/zeroclaw-plugins/src/wasm_channel.rs:1426-1445 | crates/zeroclaw-plugins/src/wasm_channel.rs:1510-1526 | crates/zeroclaw-plugins/src/wasm_channel.rs:1528-1547 | crates/zeroclaw-plugins/src/wasm_channel.rs:1554-1573 | crates/zeroclaw-plugins/src/wasm_memory.rs:387-407 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 17+ corresponding lines) crates/zeroclaw-providers/src/compatible.rs:306— crates/zeroclaw-providers/src/compatible.rs:306-326 | crates/zeroclaw-providers/src/compatible.rs:3022-3041 | crates/zeroclaw-providers/src/lib.rs:1314-1330 | crates/zeroclaw-providers/src/openrouter.rs:482-499 | crates/zeroclaw-providers/src/openrouter.rs:505-524 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 8+ corresponding lines) · ×2
Edited copies of one member (4 members, 8+ corresponding lines) apps/tauri/src/gateway_client.rs:28— apps/tauri/src/gateway_client.rs:28-35 | apps/tauri/src/gateway_client.rs:49-56 | apps/tauri/src/gateway_client.rs:58-67 | apps/tauri/src/gateway_client.rs:133-143 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 8+ corresponding lines) crates/zeroclaw-channels/src/telegram.rs:458— crates/zeroclaw-channels/src/telegram.rs:458-469 | crates/zeroclaw-plugins/src/wasm_channel.rs:879-890 | crates/zeroclaw-runtime/src/plugin_runtime.rs:940-948 | crates/zeroclaw-runtime/src/tools/cron_runs.rs:153-160 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 15+ corresponding lines) · ×2
Edited copies of one member (5 members, 15+ corresponding lines) apps/tauri/src/macos/permissions.rs:49— apps/tauri/src/macos/permissions.rs:49-68 | apps/tauri/src/macos/permissions.rs:81-102 | apps/tauri/src/macos/permissions.rs:105-126 | apps/tauri/src/macos/permissions.rs:190-215 | apps/tauri/src/macos/permissions.rs:221-235 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 15+ corresponding lines) crates/zeroclaw-providers/src/router.rs:402— crates/zeroclaw-providers/src/router.rs:402-416 | crates/zeroclaw-providers/src/router.rs:439-454 | crates/zeroclaw-providers/src/router.rs:462-477 | crates/zeroclaw-providers/src/router.rs:505-520 | crates/zeroclaw-providers/src/router.rs:528-542 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 8+ corresponding lines) · ×2
Edited copies of one member (5 members, 8+ corresponding lines) crates/zeroclaw-providers/src/catalog.rs:174— crates/zeroclaw-providers/src/catalog.rs:174-185 | crates/zeroclaw-providers/src/catalog.rs:187-198 | crates/zeroclaw-providers/src/models_dev.rs:59-66 | crates/zeroclaw-providers/src/openrouter_catalog.rs:37-48 | crates/zeroclaw-providers/src/openrouter_catalog.rs:50-61 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 8+ corresponding lines) crates/zeroclaw-gateway/src/dashboard_core.rs:1723— crates/zeroclaw-gateway/src/dashboard_core.rs:1723-1730 | crates/zeroclaw-gateway/src/dashboard_core.rs:1740-1747 | crates/zeroclaw-gateway/src/dashboard_core.rs:1757-1764 | crates/zeroclaw-gateway/src/dashboard_core.rs:1773-1780 | crates/zeroclaw-gateway/src/dashboard_core.rs:1789-1796 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 13+ corresponding lines) · ×2
Edited copies of one member (4 members, 13+ corresponding lines) crates/zeroclaw-providers/src/dispatch.rs:826— crates/zeroclaw-providers/src/dispatch.rs:826-838 | crates/zeroclaw-providers/src/dispatch.rs:867-879 | crates/zeroclaw-providers/src/dispatch.rs:1208-1220 | crates/zeroclaw-providers/src/dispatch.rs:1249-1261 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 13+ corresponding lines) crates/zeroclaw-channels/src/clawdtalk.rs:305— crates/zeroclaw-channels/src/clawdtalk.rs:305-326 | crates/zeroclaw-channels/src/linq.rs:372-386 | crates/zeroclaw-channels/src/nextcloud_talk.rs:781-793 | crates/zeroclaw-channels/src/whatsapp.rs:1100-1115 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (75 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4147— crates/zeroclaw-providers/src/compatible.rs:4147-4221 | crates/zeroclaw-providers/src/compatible.rs:4250-4324 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:4147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (75 lines × 2) crates/zeroclaw-macros/src/lib.rs:546— crates/zeroclaw-macros/src/lib.rs:546-620 | crates/zeroclaw-macros/src/lib.rs:976-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:546` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (48 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2333— crates/zeroclaw-runtime/src/agent/loop_.rs:2333-2380 | crates/zeroclaw-runtime/src/agent/loop_.rs:2952-2999 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2333` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (48 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1396— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1396-1443 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1692-1739 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1396` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:637` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2569` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29–32 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:4054— crates/zeroclaw-channels/src/discord/mod.rs:4054-4085 | crates/zeroclaw-channels/src/signal.rs:1553-1581 | crates/zeroclaw-channels/src/slack.rs:6294-6322 — before extracting anything, compare `crates/zeroclaw-channels/src/discord/mod.rs` and `crates/zeroclaw-channels/src/signal.rs` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:4054` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29–32 lines × 3) crates/zeroclaw-providers/src/compatible.rs:4938— crates/zeroclaw-providers/src/compatible.rs:4938-4968 | crates/zeroclaw-providers/src/compatible.rs:5147-5178 | crates/zeroclaw-providers/src/compatible.rs:5297-5325 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:4938` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/compatible.rs:4934` calls `targets_mistral_tool_call_contract` and `crates/zeroclaw-providers/src/compatible.rs:5140` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (29–32 lines × 2) crates/zeroclaw-runtime/src/cron/store.rs:624— crates/zeroclaw-runtime/src/cron/store.rs:624-655 | crates/zeroclaw-runtime/src/cron/store.rs:708-736 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/cron/store.rs:624` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (29–32 lines × 2) crates/zeroclaw-runtime/src/tools/deliver_file.rs:233— crates/zeroclaw-runtime/src/tools/deliver_file.rs:233-261 | 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 (29–30 lines × 2) apps/zerocode/src/config_manager.rs:3767— apps/zerocode/src/config_manager.rs:3767-3796 | apps/zerocode/src/config_manager.rs:3965-3993 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:3767` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (29–30 lines × 2) crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:227— crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:227-256 | crates/zeroclaw-runtime/src/verifiable_intent/issuance.rs:280-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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/gemini.rs:1352` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28–29 lines × 2) crates/zeroclaw-providers/src/ollama.rs:840— crates/zeroclaw-providers/src/ollama.rs:840-867 | crates/zeroclaw-providers/src/ollama.rs:886-914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/ollama.rs:840` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–28 lines × 2) crates/zeroclaw-channels/src/slack.rs:1270— crates/zeroclaw-channels/src/slack.rs:1270-1296 | crates/zeroclaw-channels/src/slack.rs:5378-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 (27–28 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1660— crates/zeroclaw-runtime/src/agent/loop_.rs:1660-1687 | crates/zeroclaw-runtime/src/agent/loop_.rs:3783-3809 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-runtime/src/agent/loop_.rs:3809` calls `to_string` and `crates/zeroclaw-runtime/src/agent/loop_.rs:1687` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (27 lines × 2) crates/zeroclaw-providers/src/azure_openai.rs:439— crates/zeroclaw-providers/src/azure_openai.rs:439-465 | crates/zeroclaw-providers/src/openai.rs:417-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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:439` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:798— crates/zeroclaw-runtime/src/skills/mod.rs:798-824 | crates/zeroclaw-runtime/src/skills/mod.rs:927-953 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:798` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 2) crates/zeroclaw-api/src/memory_traits.rs:662— crates/zeroclaw-api/src/memory_traits.rs:662-687 | crates/zeroclaw-memory/src/agent_scoped.rs:608-633 — before extracting anything, compare `crates/zeroclaw-api/src/memory_traits.rs` and `crates/zeroclaw-memory/src/agent_scoped.rs` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (26 lines × 2) crates/zeroclaw-providers/src/multimodal.rs:1359— crates/zeroclaw-providers/src/multimodal.rs:1359-1384 | crates/zeroclaw-providers/src/multimodal.rs:1510-1535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/multimodal.rs:1359` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/hardware_board_info.rs:181` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23–24 lines × 2) crates/zeroclaw-runtime/src/skills/mod.rs:847— crates/zeroclaw-runtime/src/skills/mod.rs:847-870 | crates/zeroclaw-runtime/src/skills/mod.rs:976-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/skills/mod.rs:847` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/markers.rs:75` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 3) crates/zeroclaw-runtime/src/sop/dispatch.rs:941— crates/zeroclaw-runtime/src/sop/dispatch.rs:941-956 | crates/zeroclaw-runtime/src/sop/dispatch.rs:990-1005 | crates/zeroclaw-runtime/src/sop/dispatch.rs:1232-1247 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/dispatch.rs:941` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 3) crates/zeroclaw-channels/src/qq.rs:135— crates/zeroclaw-channels/src/qq.rs:135-150 | crates/zeroclaw-channels/src/telegram.rs:1031-1046 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/pico_code.rs:344` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–16 lines × 2) crates/zeroclaw-runtime/src/sop/executor.rs:1435— crates/zeroclaw-runtime/src/sop/executor.rs:1435-1446 | crates/zeroclaw-runtime/src/sop/executor.rs:1462-1477 — both copies are in the same file, so extract the block into 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 × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/reddit.rs:131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/browser_open.rs:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–15 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:13719— crates/zeroclaw-channels/src/orchestrator/mod.rs:13719-13733 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15386-15396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:13719` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-macros/src/lib.rs:1604` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config/keybindings.rs:72` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–14 lines × 2) crates/zeroclaw-channels/src/telegram.rs:5695— crates/zeroclaw-channels/src/telegram.rs:5695-5706 | crates/zeroclaw-channels/src/telegram.rs:6110-6123 — both copies are in the same file, so extract the block into 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 × 3) apps/zerocode/src/config_manager.rs:5187— apps/zerocode/src/config_manager.rs:5187-5198 | apps/zerocode/src/config_manager.rs:5513-5524 | apps/zerocode/src/config_manager.rs:5777-5787 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:5187` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:1959` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–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:956-963 | crates/zeroclaw-runtime/src/sop/executor.rs:1004-1014 — before extracting anything, compare `crates/zeroclaw-runtime/src/sop/approval/timeout.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 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/approval/timeout.rs:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–11 lines × 3) crates/zeroclaw-runtime/src/tools/delegate.rs:2657— crates/zeroclaw-runtime/src/tools/delegate.rs:2657-2667 | crates/zeroclaw-runtime/src/tools/delegate.rs:2713-2723 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:545-552 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:2657` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–11 lines × 2) crates/zeroclaw-gateway/src/api_oidc.rs:844— crates/zeroclaw-gateway/src/api_oidc.rs:844-854 | crates/zeroclaw-gateway/src/api_oidc.rs:1009-1016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-gateway/src/api_oidc.rs:1006` calls `Query` and `crates/zeroclaw-gateway/src/api_oidc.rs:841` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–11 lines × 2) crates/zeroclaw-gateway/src/lib.rs:2192— crates/zeroclaw-gateway/src/lib.rs:2192-2202 | crates/zeroclaw-gateway/src/lib.rs:3135-3142 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/lib.rs:2192` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 7) crates/zeroclaw-channels/src/telegram.rs:6739— crates/zeroclaw-channels/src/telegram.rs:6739-6748 | crates/zeroclaw-channels/src/telegram.rs:6783-6792 | crates/zeroclaw-channels/src/telegram.rs:6832-6841 | crates/zeroclaw-channels/src/telegram.rs:6876-6885 | crates/zeroclaw-channels/src/telegram.rs:6925-6934 | crates/zeroclaw-channels/src/telegram.rs:6974-6983 | crates/zeroclaw-channels/src/telegram.rs:7023-7032 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:744` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–10 lines × 2) crates/zeroclaw-channels/src/discord/mod.rs:1829— crates/zeroclaw-channels/src/discord/mod.rs:1829-1836 | crates/zeroclaw-channels/src/discord/mod.rs:1854-1863 — both copies are in the same file, so extract the block into 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:5317-5324 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:4977` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/email_channel.rs:480` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–10 lines × 2) crates/zeroclaw-gateway/src/dashboard_session.rs:920— crates/zeroclaw-gateway/src/dashboard_session.rs:920-929 | crates/zeroclaw-gateway/src/dashboard_session.rs:1006-1012 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/dashboard_session.rs:920` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:2162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–10 lines × 2) crates/zeroclaw-providers/src/compatible.rs:4585— crates/zeroclaw-providers/src/compatible.rs:4585-4590 | crates/zeroclaw-providers/src/compatible.rs:4732-4741 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:4585` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–9 lines × 6) crates/zeroclaw-channels/src/discord/mod.rs:3894— crates/zeroclaw-channels/src/discord/mod.rs:3894-3899 | 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:8606-8614 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:3894` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/nextcloud_talk.rs:686` calls `Err` and `crates/zeroclaw-channels/src/line.rs:1254` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–9 lines × 6) crates/zeroclaw-channels/src/orchestrator/mod.rs:10178— crates/zeroclaw-channels/src/orchestrator/mod.rs:10178-10183 | crates/zeroclaw-channels/src/signal.rs:1309-1317 | crates/zeroclaw-channels/src/signal.rs:1325-1333 | 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 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10178` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/wechat.rs:2262` calls `sleep`, `from_secs` and `crates/zeroclaw-channels/src/signal.rs:1320` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 5) crates/zeroclaw-runtime/src/tools/sop_advance.rs:155— crates/zeroclaw-runtime/src/tools/sop_advance.rs:155-164 | crates/zeroclaw-runtime/src/tools/sop_approve.rs:119-128 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:123-132 | crates/zeroclaw-runtime/src/tools/sop_list.rs:48-57 | crates/zeroclaw-runtime/src/tools/sop_status.rs:102-111 — before extracting anything, compare `crates/zeroclaw-runtime/src/tools/sop_advance.rs` and `crates/zeroclaw-runtime/src/tools/sop_approve.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/sop_advance.rs:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 5) crates/zeroclaw-runtime/src/daemon/mod.rs:1176— crates/zeroclaw-runtime/src/daemon/mod.rs:1176-1185 | crates/zeroclaw-runtime/src/daemon/mod.rs:1210-1219 | crates/zeroclaw-runtime/src/daemon/mod.rs:1235-1244 | crates/zeroclaw-runtime/src/daemon/mod.rs:1260-1269 | crates/zeroclaw-runtime/src/daemon/mod.rs:1333-1342 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/daemon/mod.rs:1176` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/daemon/mod.rs:1174` calls `clone` and `crates/zeroclaw-runtime/src/daemon/mod.rs:1209` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:671` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 4) crates/zeroclaw-providers/src/compatible.rs:1598— crates/zeroclaw-providers/src/compatible.rs:1598-1606 | crates/zeroclaw-providers/src/compatible.rs:4464-4472 | crates/zeroclaw-providers/src/compatible.rs:4592-4599 | crates/zeroclaw-providers/src/compatible.rs:4744-4751 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:1598` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 3) crates/zeroclaw-channels/src/clawdtalk.rs:86— crates/zeroclaw-channels/src/clawdtalk.rs:86-93 | crates/zeroclaw-channels/src/clawdtalk.rs:122-130 | crates/zeroclaw-channels/src/clawdtalk.rs:185-193 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/clawdtalk.rs:86` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 3) crates/zeroclaw-providers/src/telnyx.rs:64— crates/zeroclaw-providers/src/telnyx.rs:64-71 | crates/zeroclaw-providers/src/telnyx.rs:160-168 | crates/zeroclaw-providers/src/telnyx.rs:233-241 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/telnyx.rs:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–9 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:10601— crates/zeroclaw-channels/src/orchestrator/mod.rs:10601-10609 | crates/zeroclaw-channels/src/orchestrator/mod.rs:10689-10697 | crates/zeroclaw-runtime/src/agent/agent.rs:4110-4115 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10601` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–9 lines × 3) crates/zeroclaw-runtime/src/agent/loop_.rs:2237— crates/zeroclaw-runtime/src/agent/loop_.rs:2237-2245 | crates/zeroclaw-runtime/src/agent/loop_.rs:2829-2837 | crates/zeroclaw-runtime/src/agent/loop_.rs:4226-4231 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (4–9 lines × 5) crates/zeroclaw-hardware/src/rpi.rs:389— crates/zeroclaw-hardware/src/rpi.rs:389-397 | crates/zeroclaw-hardware/src/rpi.rs:399-402 | crates/zeroclaw-hardware/src/rpi.rs:485-493 | crates/zeroclaw-hardware/src/rpi.rs:580-588 | crates/zeroclaw-runtime/src/tools/security_ops.rs:119-122 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/rpi.rs:389` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–9 lines × 5) crates/zeroclaw-infra/src/session_sqlite.rs:1233— crates/zeroclaw-infra/src/session_sqlite.rs:1233-1241 | crates/zeroclaw-infra/src/session_sqlite.rs:1548-1552 | crates/zeroclaw-infra/src/session_sqlite.rs:1640-1648 | crates/zeroclaw-infra/src/session_sqlite.rs:1700-1703 | crates/zeroclaw-infra/src/session_sqlite.rs:1774-1777 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-infra/src/session_sqlite.rs:1233` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-infra/src/session_sqlite.rs:1242` calls `get` and `crates/zeroclaw-infra/src/session_sqlite.rs:1553` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:409` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–9 lines × 2) crates/zeroclaw-runtime/src/daemon/mod.rs:1086— crates/zeroclaw-runtime/src/daemon/mod.rs:1086-1091 | src/main.rs:16032-16040 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/daemon/mod.rs:1086` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:1942` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–8 lines × 4) crates/zeroclaw-providers/src/compatible.rs:3349— crates/zeroclaw-providers/src/compatible.rs:3349-3355 | crates/zeroclaw-providers/src/compatible.rs:3372-3379 | crates/zeroclaw-providers/src/compatible.rs:3423-3429 | 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 9 separate duplicated blocks between them, totalling at least 81 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:3349` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/compatible.rs:3347` calls `is_tool_result_carrier` and `crates/zeroclaw-providers/src/openrouter.rs:425` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/linq.rs:351` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/linq.rs:355` calls `Ok` and `crates/zeroclaw-channels/src/linq.rs:351` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/hooks/runner.rs:302` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 12) crates/zeroclaw-providers/src/anthropic.rs:2904— crates/zeroclaw-providers/src/anthropic.rs:2904-2909 | crates/zeroclaw-providers/src/anthropic.rs:3016-3021 | crates/zeroclaw-providers/src/azure_openai.rs:543-548 | crates/zeroclaw-providers/src/azure_openai.rs:614-619 | crates/zeroclaw-providers/src/azure_openai.rs:679-684 | crates/zeroclaw-providers/src/openai.rs:495-500 | crates/zeroclaw-providers/src/openai.rs:583-588 | crates/zeroclaw-providers/src/openai.rs:679-684 | crates/zeroclaw-providers/src/openrouter.rs:652-657 | crates/zeroclaw-providers/src/openrouter.rs:718-723 | crates/zeroclaw-providers/src/openrouter.rs:791-796 | crates/zeroclaw-providers/src/openrouter.rs:996-1001 — 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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/anthropic.rs:2904` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/anthropic.rs:2903` calls `commit_safeguard_fallback` and `crates/zeroclaw-providers/src/azure_openai.rs:542` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 12) 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/wechat.rs:1231-1237 | crates/zeroclaw-channels/src/wechat.rs:1270-1276 | 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:533-539 | crates/zeroclaw-runtime/src/cron/scheduler.rs:553-559 | crates/zeroclaw-runtime/src/cron/store.rs:677-683 | crates/zeroclaw-runtime/src/cron/store.rs:741-747 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:2681` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/matrix.rs:2693` calls `Ok` and `crates/zeroclaw-channels/src/wechat.rs:1229` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 11) crates/zeroclaw-channels/src/discord/rest.rs:104— crates/zeroclaw-channels/src/discord/rest.rs:104-109 | crates/zeroclaw-channels/src/matrix.rs:1205-1210 | crates/zeroclaw-channels/src/matrix.rs:1236-1241 | crates/zeroclaw-channels/src/matrix.rs:1254-1259 | crates/zeroclaw-channels/src/matrix.rs:1354-1359 | crates/zeroclaw-channels/src/matrix.rs:1374-1379 | crates/zeroclaw-channels/src/matrix.rs:2795-2800 | crates/zeroclaw-channels/src/matrix.rs:2837-2842 | crates/zeroclaw-channels/src/matrix.rs:2956-2961 | crates/zeroclaw-tools/src/pushover.rs:47-52 | src/main.rs:10030-10035 — there are 11 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 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/rest.rs:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 11) crates/zeroclaw-channels/src/discord/rest.rs:104— crates/zeroclaw-channels/src/discord/rest.rs:104-109 | crates/zeroclaw-channels/src/matrix.rs:1205-1210 | crates/zeroclaw-channels/src/matrix.rs:1236-1241 | crates/zeroclaw-channels/src/matrix.rs:1254-1259 | crates/zeroclaw-channels/src/matrix.rs:1354-1359 | crates/zeroclaw-channels/src/matrix.rs:1374-1379 | crates/zeroclaw-channels/src/matrix.rs:2795-2800 | crates/zeroclaw-channels/src/matrix.rs:2837-2842 | crates/zeroclaw-channels/src/matrix.rs:2956-2961 | REDACTED:2073-2078 | crates/zeroclaw-tools/src/pushover.rs:47-52 — there are 11 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 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/rest.rs:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `path` to `&std::path::Path` in one and `&Path` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:2079` calls `display`, `to_string` and `crates/zeroclaw-channels/src/matrix.rs:1211` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 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:5272-5277 | crates/zeroclaw-channels/src/telegram.rs:5730-5735 | crates/zeroclaw-channels/src/telegram.rs:5766-5771 | crates/zeroclaw-channels/src/telegram.rs:5780-5785 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:400` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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:1102-1108 — 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.
Duplicated block (5 lines × 11) crates/zeroclaw-runtime/src/live_config_authority.rs:1514— crates/zeroclaw-runtime/src/live_config_authority.rs:1514-1518 | crates/zeroclaw-tools/src/microsoft365/mod.rs:81-85 | crates/zeroclaw-tools/src/microsoft365/mod.rs:113-117 | crates/zeroclaw-tools/src/microsoft365/mod.rs:163-167 | crates/zeroclaw-tools/src/microsoft365/mod.rs:216-220 | crates/zeroclaw-tools/src/microsoft365/mod.rs:246-250 | crates/zeroclaw-tools/src/microsoft365/mod.rs:303-307 | crates/zeroclaw-tools/src/microsoft365/mod.rs:341-345 | crates/zeroclaw-tools/src/microsoft365/mod.rs:414-418 | crates/zeroclaw-tools/src/microsoft365/mod.rs:470-474 | crates/zeroclaw-tools/src/microsoft365/mod.rs:544-548 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/live_config_authority.rs:1514` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 11) crates/zeroclaw-runtime/src/tools/read_skill.rs:54— crates/zeroclaw-runtime/src/tools/read_skill.rs:54-58 | crates/zeroclaw-runtime/src/tools/schedule.rs:349-353 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:151-155 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:168-172 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:185-189 | crates/zeroclaw-tools/src/ask_user.rs:106-110 | crates/zeroclaw-tools/src/escalate.rs:192-196 | crates/zeroclaw-tools/src/file_download.rs:487-491 | crates/zeroclaw-tools/src/file_download.rs:505-509 | crates/zeroclaw-tools/src/poll.rs:202-206 | crates/zeroclaw-tools/src/pushover.rs:163-167 — 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 7 separate duplicated blocks between them, totalling at least 96 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/read_skill.rs:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 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:14880-14884 | crates/zeroclaw-channels/src/transcription.rs:1083-1087 | crates/zeroclaw-runtime/src/tools/mod.rs:2608-2614 | crates/zeroclaw-runtime/src/tools/mod.rs:2719-2723 | crates/zeroclaw-runtime/src/tools/mod.rs:2759-2763 | crates/zeroclaw-runtime/src/tools/mod.rs:2807-2811 | crates/zeroclaw-runtime/src/tools/mod.rs:2884-2890 | crates/zeroclaw-runtime/src/tools/mod.rs:2912-2916 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/nextcloud_talk.rs:716` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 10) crates/zeroclaw-tools/src/model_routing_config.rs:95— crates/zeroclaw-tools/src/model_routing_config.rs:95-99 | crates/zeroclaw-tools/src/proxy_config.rs:24-28 | crates/zeroclaw-tools/src/web_search_tool.rs:389-393 | crates/zeroclaw-tools/src/web_search_tool.rs:611-615 | crates/zeroclaw-tools/src/web_search_tool.rs:787-791 | crates/zeroclaw-tools/src/web_search_tool.rs:926-930 | crates/zeroclaw-tools/src/web_search_tool.rs:1126-1130 | crates/zeroclaw-tools/src/web_search_tool.rs:1323-1327 | crates/zeroclaw-tools/src/web_search_tool.rs:1500-1504 | crates/zeroclaw-tools/src/web_search_tool.rs:1766-1770 — 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 12 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/model_routing_config.rs:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 8) crates/zeroclaw-providers/src/anthropic.rs:3589— crates/zeroclaw-providers/src/anthropic.rs:3589-3593 | crates/zeroclaw-providers/src/compatible.rs:3016-3020 | crates/zeroclaw-providers/src/compatible.rs:5029-5033 | crates/zeroclaw-providers/src/compatible.rs:5208-5212 | crates/zeroclaw-providers/src/compatible.rs:5352-5356 | 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 7 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/anthropic.rs:3589` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 8) 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:7335-7342 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:3138-3142 | crates/zeroclaw-runtime/src/sop/executor.rs:1514-1518 | crates/zeroclaw-runtime/src/sop/executor.rs:1525-1529 — there are 8 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 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:4799` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (1–5 lines × 4) crates/zeroclaw-runtime/src/agent/dispatcher.rs:193— crates/zeroclaw-runtime/src/agent/dispatcher.rs:193-193 | crates/zeroclaw-runtime/src/agent/tool_execution.rs:69-73 | crates/zeroclaw-runtime/src/agent/turn/mod.rs:3873-3877 | 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/dispatcher.rs:193` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (1–5 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:2304— crates/zeroclaw-channels/src/discord/mod.rs:2304-2308 | crates/zeroclaw-channels/src/discord/mod.rs:2377-2377 | crates/zeroclaw-channels/src/discord/mod.rs:2575-2579 | crates/zeroclaw-channels/src/discord/mod.rs:3107-3108 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2304` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
AC2 · Forms & labels· <ComboBox> field component without a label · ×1
<ComboBox> field component without a label web/src/components/sections/FieldForm.tsx:2600— 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.
Low contrast colour pair in CSS (2.9:1) .claude/skills/skill-creator/assets/eval_review.html:17— `.btn-add` sets color: white on background-color: #6a9bcc — 2.9:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (3.0:1) .claude/skills/skill-creator/eval-viewer/viewer.html:197— `.output-file-content .download-link` sets color: #d97757 on background-color: #faf9f5 — 3.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (4.0:1) .claude/skills/skill-creator/eval-viewer/viewer.html:303— `.grade-fail` sets color: #c44 on background-color: #fceaea — 4.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
ScopedToolRegistry::assemble_prepared (cyclomatic 72) crates/zeroclaw-runtime/src/tools/scoped.rs:699— ScopedToolRegistry::assemble_prepared has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent 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:561— 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 40) apps/zerocode/src/chat.rs:11831— ChatState::apply_update 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.
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.
SignalChannel::listen (cyclomatic 28) crates/zeroclaw-channels/src/signal.rs:1248— SignalChannel::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.
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:326— 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.
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:14698— 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.
SopAdvanceTool::execute (cyclomatic 23) crates/zeroclaw-runtime/src/tools/sop_advance.rs:94— SopAdvanceTool::execute 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_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.
TurnRelay::relay (cyclomatic 22) crates/zeroclaw-gateway/src/chat_core.rs:891— TurnRelay::relay 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.
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.
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.
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.
BuildRegistry::claim_search (cyclomatic 18) crates/zeroclaw-runtime/src/tools/scoped.rs:177— BuildRegistry::claim_search 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.
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:339— 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.
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.
SopStatusTool::execute (cyclomatic 16) crates/zeroclaw-runtime/src/tools/sop_status.rs:83— SopStatusTool::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.
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_prepared (cognitive 163) crates/zeroclaw-runtime/src/tools/scoped.rs:699— ScopedToolRegistry::assemble_prepared has cognitive complexity 163 (threshold 15). Drivers by points: if/else 46 (115 pts), boolean chains 19, loops 6 (18 pts), match/switch 6 (11 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.
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:561— 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:326— 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.
OidcAuthProvider::claims_to_identity (cognitive 36) crates/zeroclaw-runtime/src/security/auth_provider/oidc.rs:809— OidcAuthProvider::claims_to_identity has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 8, 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.
SopStatusTool::execute (cognitive 35) crates/zeroclaw-runtime/src/tools/sop_status.rs:83— SopStatusTool::execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 4 (11 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
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.
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:14698— 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.
RelayServer::serve (cognitive 23) apps/zerorelay/src/lib.rs:710— RelayServer::serve has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 4 (8 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EmailChannel::build_email_message (cognitive 23) crates/zeroclaw-channels/src/email_channel.rs:884— 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:3263— 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.
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:339— 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:18281— 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.
RepetitionGuard::observe_round (cognitive 20) crates/zeroclaw-runtime/src/agent/turn/repetition.rs:32— RepetitionGuard::observe_round has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 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.
SkillsService::list_skills (cognitive 20) crates/zeroclaw-runtime/src/skills/service.rs:138— 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.
InprocConnector::connect_with (cognitive 19) crates/zeroclaw-runtime/src/rpc/inproc.rs:384— InprocConnector::connect_with 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.
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:129— 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.
SopAdvanceTool::execute (cognitive 18) crates/zeroclaw-runtime/src/tools/sop_advance.rs:94— SopAdvanceTool::execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 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 18) crates/zeroclaw-runtime/src/tools/spawn_subagent.rs:212— SpawnSubagentTool::execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 6 (7 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.
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.
ZerocodePane::handle_mouse (cognitive 17) apps/zerocode/src/zerocode_pane.rs:1838— ZerocodePane::handle_mouse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 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.
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.
TurnRelay::relay (cognitive 17) crates/zeroclaw-gateway/src/chat_core.rs:891— TurnRelay::relay has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 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.
DashboardAuth::admit_key (cognitive 17) crates/zeroclaw-gateway/src/dashboard_session.rs:864— DashboardAuth::admit_key has cognitive complexity 17 (threshold 15). Drivers by points: match/switch 5 (9 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.
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:30— 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:504— 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.
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.
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.
SendMessageToPeerTool::execute (cognitive 16) crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:145— SendMessageToPeerTool::execute has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 5 (10 pts), if/else 4 (5 pts), boolean chains 1 (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.
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 (8 members, 20 shared lines) · ×1
Near-duplicate member family (8 members, 20 shared lines) 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:845-943 — These 8 members are variants of one another: a block of 20 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 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.
D4 · Code Duplication· Near-duplicate member family (7 members, 22 shared lines) · ×1
Near-duplicate member family (7 members, 22 shared lines) 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:600-653 | crates/zeroclaw-tools/src/jira_tool.rs:687-731 | crates/zeroclaw-tools/src/jira_tool.rs:845-943 — These 7 members are variants of one another: a block of 22 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 (7 members, 21 shared lines) · ×1
Near-duplicate member family (7 members, 21 shared lines) crates/zeroclaw-channels/src/telegram.rs:6726— crates/zeroclaw-channels/src/telegram.rs:6726-6766 | crates/zeroclaw-channels/src/telegram.rs:6776-6810 | crates/zeroclaw-channels/src/telegram.rs:6819-6859 | crates/zeroclaw-channels/src/telegram.rs:6869-6903 | crates/zeroclaw-channels/src/telegram.rs:6912-6952 | crates/zeroclaw-channels/src/telegram.rs:6961-7001 | crates/zeroclaw-channels/src/telegram.rs:7010-7050 — 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 (6 members, 15 shared lines) · ×1
Near-duplicate member family (6 members, 15 shared lines) 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 are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 21 shared lines) · ×1
Near-duplicate member family (5 members, 21 shared lines) crates/zeroclaw-tools/src/jira_tool.rs:186— 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:750-833 | crates/zeroclaw-tools/src/jira_tool.rs:845-943 — These 5 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 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 (5 members, 12 shared lines) · ×1
Near-duplicate member family (5 members, 12 shared lines) 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:1312-1370 — These 5 members are variants of one another: a block of 12 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, 174 shared lines) · ×1
Near-duplicate member family (4 members, 174 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 174 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, 45 shared lines) · ×1
Near-duplicate member family (3 members, 45 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 45 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 (78 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: 78 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:797— crates/zeroclaw-runtime/src/skills/mod.rs:797-900 | crates/zeroclaw-runtime/src/skills/mod.rs:926-1028 — 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 (53 shared lines) crates/zeroclaw-providers/src/multimodal.rs:1343— crates/zeroclaw-providers/src/multimodal.rs:1343-1419 | crates/zeroclaw-providers/src/multimodal.rs:1492-1579 — 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 (48 shared lines) apps/zerocode/src/client.rs:1736— apps/zerocode/src/client.rs:1736-1892 | apps/zerocode/src/client.rs:2020-2186 — These two members are variants of one another: 48 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 (45 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: 45 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 (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 (34 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: 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) 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: 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 (30 shared lines) crates/zeroclaw-tools/src/knowledge_tool.rs:159— crates/zeroclaw-tools/src/knowledge_tool.rs:159-247 | crates/zeroclaw-tools/src/knowledge_tool.rs:330-403 — These two members are variants of one another: 30 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 (29 shared lines) crates/zeroclaw-tools/src/model_routing_config.rs:93— crates/zeroclaw-tools/src/model_routing_config.rs:93-134 | crates/zeroclaw-tools/src/proxy_config.rs:22-62 — These two members are variants of one another: 29 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 (26 shared lines) crates/zeroclaw-channels/src/bluesky.rs:514— crates/zeroclaw-channels/src/bluesky.rs:514-636 | crates/zeroclaw-channels/src/mattermost.rs:895-1011 — These two members are variants of one another: 26 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 (23 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: 23 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 (34 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (34 members, 50+ identical tokens) crates/zeroclaw-channels/src/slack.rs:3429— crates/zeroclaw-channels/src/slack.rs:3429-3463 | crates/zeroclaw-channels/src/transcription.rs:71-91 | crates/zeroclaw-config/src/env_overrides.rs:156-226 | crates/zeroclaw-config/src/schema.rs:12456-12545 | crates/zeroclaw-config/src/schema.rs:12555-12702 | crates/zeroclaw-hardware/src/device.rs:467-524 | crates/zeroclaw-providers/src/auth/profiles.rs:238-259 | crates/zeroclaw-providers/src/models_dev.rs:77-94 | crates/zeroclaw-providers/src/openrouter.rs:528-551 | crates/zeroclaw-runtime/src/sop/engine.rs:2403-2448 | crates/zeroclaw-runtime/src/sop/engine.rs:2577-2790 | crates/zeroclaw-runtime/src/sop/engine.rs:2889-2902 | crates/zeroclaw-runtime/src/sop/engine.rs:4079-4178 | crates/zeroclaw-runtime/src/sop/engine.rs:4747-4919 | crates/zeroclaw-runtime/src/sop/engine.rs:5077-5109 | crates/zeroclaw-runtime/src/sop/engine.rs:5655-5716 | crates/zeroclaw-runtime/src/sop/engine.rs:6061-6102 | crates/zeroclaw-runtime/src/tools/security_ops.rs:101-185 | crates/zeroclaw-tools/src/browser_open.rs:274-325 | crates/zeroclaw-tools/src/mcp_client.rs:1258-1272 | crates/zeroclaw-tools/src/model_routing_config.rs:191-223 | crates/zeroclaw-tools/src/model_routing_config.rs:297-318 | crates/zeroclaw-tools/src/model_routing_config.rs:334-364 | crates/zeroclaw-tools/src/model_routing_config.rs:366-386 | crates/zeroclaw-tools/src/model_routing_config.rs:388-418 | crates/zeroclaw-tools/src/model_routing_config.rs:420-450 | crates/zeroclaw-tools/src/model_routing_config.rs:452-482 | crates/zeroclaw-tools/src/model_routing_config.rs:484-500 | 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 | src/main.rs:9633-14221 | src/skills/mod.rs:1180-1238 | src/sop/mod.rs:7-295 — These 34 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 34 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 34 times.
D4 · Code Duplication· Members sharing a duplicated core (12 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (12 members, 50+ identical tokens) crates/zeroclaw-providers/src/anthropic.rs:2902— crates/zeroclaw-providers/src/anthropic.rs:2902-2987 | crates/zeroclaw-providers/src/anthropic.rs:3010-3140 | 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/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 — These 12 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 12 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 12 times.
D4 · Code Duplication· Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (11 members, 50+ identical tokens) crates/zeroclaw-runtime/src/live_config_authority.rs:1510— crates/zeroclaw-runtime/src/live_config_authority.rs:1510-1531 | 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 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication· Edited copy of a member (107 corresponding lines) · ×1
Edited copy of a member (107 corresponding lines) apps/zerocode/src/config_manager.rs:3747— apps/zerocode/src/config_manager.rs:3747-3868 | apps/zerocode/src/config_manager.rs:3944-4050 — These two members are one piece of code written twice and then edited apart: 107 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (103 corresponding lines) · ×1
Edited copy of a member (103 corresponding lines) crates/zeroclaw-providers/src/compatible.rs:4138— crates/zeroclaw-providers/src/compatible.rs:4138-4241 | crates/zeroclaw-providers/src/compatible.rs:4245-4347 — These two members are one piece of code written twice and then edited apart: 103 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (100 corresponding lines) · ×1
Edited copy of a member (100 corresponding 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 one piece of code written twice and then edited apart: 100 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (88 corresponding lines) · ×1
Edited copy of a member (88 corresponding lines) apps/zerocode/src/config_manager.rs:5528— apps/zerocode/src/config_manager.rs:5528-5620 | apps/zerocode/src/config_manager.rs:5622-5709 — These two members are one piece of code written twice and then edited apart: 88 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (91 corresponding lines) · ×1
Edited copy of a member (91 corresponding lines) crates/zeroclaw-gateway/src/canvas.rs:233— crates/zeroclaw-gateway/src/canvas.rs:233-323 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:94-187 — These two members are one piece of code written twice and then edited apart: 91 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (92 corresponding lines) · ×1
Edited copy of a member (92 corresponding lines) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1778— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1778-1870 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3029-3120 — These two members are one piece of code written twice and then edited apart: 92 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (93 corresponding lines) · ×1
Edited copy of a member (93 corresponding lines) crates/zeroclaw-providers/src/auth/mod.rs:1158— crates/zeroclaw-providers/src/auth/mod.rs:1158-1250 | crates/zeroclaw-providers/src/auth/mod.rs:1410-1504 — These two members are one piece of code written twice and then edited apart: 93 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (55 corresponding lines) · ×1
Edited copy of a member (55 corresponding lines) crates/zeroclaw-memory/src/sqlite.rs:1955— crates/zeroclaw-memory/src/sqlite.rs:1955-2018 | crates/zeroclaw-memory/src/sqlite.rs:2152-2206 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (71 corresponding lines) · ×1
Edited copy of a member (71 corresponding lines) crates/zeroclaw-providers/src/compatible.rs:1016— crates/zeroclaw-providers/src/compatible.rs:1016-1086 | crates/zeroclaw-providers/src/compatible.rs:1095-1171 — These two members are one piece of code written twice and then edited apart: 71 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) crates/zeroclaw-providers/src/anthropic.rs:943— crates/zeroclaw-providers/src/anthropic.rs:943-1002 | crates/zeroclaw-providers/src/bedrock.rs:1335-1396 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (78 corresponding lines) · ×1
Edited copy of a member (78 corresponding lines) crates/zeroclaw-providers/src/reliable.rs:4111— crates/zeroclaw-providers/src/reliable.rs:4111-4192 | crates/zeroclaw-providers/src/reliable.rs:4200-4277 — These two members are one piece of code written twice and then edited apart: 78 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) crates/zeroclaw-tools/src/web_search_tool.rs:1120— crates/zeroclaw-tools/src/web_search_tool.rs:1120-1175 | crates/zeroclaw-tools/src/web_search_tool.rs:1488-1555 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 66+ corresponding lines) · ×1
Edited copies of one member (3 members, 66+ corresponding lines) REDACTED:841— REDACTED:841-906 | REDACTED:1093-1160 | REDACTED:1217-1287 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 66 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (64 corresponding lines) · ×1
Edited copy of a member (64 corresponding 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 one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (57 corresponding lines) · ×1
Edited copy of a member (57 corresponding lines) crates/zeroclaw-gateway/src/ws.rs:1876— crates/zeroclaw-gateway/src/ws.rs:1876-1947 | crates/zeroclaw-runtime/src/rpc/turn.rs:476-532 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 47+ corresponding lines) · ×1
Edited copies of one member (3 members, 47+ corresponding lines) crates/zeroclaw-hardware/src/introspect.rs:86— crates/zeroclaw-hardware/src/introspect.rs:86-132 | crates/zeroclaw-tools/src/hardware_board_info.rs:158-207 | crates/zeroclaw-tools/src/hardware_memory_map.rs:143-193 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 47 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 50+ corresponding lines) · ×1
Edited copies of one member (3 members, 50+ corresponding lines) crates/zeroclaw-providers/src/auth/email_oauth2.rs:124— crates/zeroclaw-providers/src/auth/email_oauth2.rs:124-173 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:169-226 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:269-319 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 50 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 41+ corresponding lines) · ×1
Edited copies of one member (6 members, 41+ corresponding lines) crates/zeroclaw-channels/src/discord/markers.rs:48— crates/zeroclaw-channels/src/discord/markers.rs:48-91 | crates/zeroclaw-channels/src/qq.rs:155-199 | crates/zeroclaw-channels/src/slack.rs:346-389 | crates/zeroclaw-channels/src/telegram.rs:1048-1092 | crates/zeroclaw-channels/src/util.rs:376-416 | crates/zeroclaw-channels/src/wechat.rs:346-390 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 41 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 40+ corresponding lines) · ×1
Edited copies of one member (3 members, 40+ corresponding lines) crates/zeroclaw-config/src/alias_refs.rs:315— crates/zeroclaw-config/src/alias_refs.rs:315-359 | crates/zeroclaw-config/src/alias_refs.rs:390-429 | crates/zeroclaw-config/src/alias_refs.rs:462-517 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 40 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) crates/zeroclaw-tools/src/linkedin_client.rs:309— crates/zeroclaw-tools/src/linkedin_client.rs:309-365 | crates/zeroclaw-tools/src/linkedin_client.rs:490-534 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 34+ corresponding lines) · ×1
Edited copies of one member (3 members, 34+ corresponding lines) crates/zeroclaw-channels/src/telegram.rs:6591— crates/zeroclaw-channels/src/telegram.rs:6591-6625 | crates/zeroclaw-channels/src/telegram.rs:7059-7092 | crates/zeroclaw-channels/src/telegram.rs:7101-7134 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) crates/zeroclaw-channels/src/slack.rs:1319— crates/zeroclaw-channels/src/slack.rs:1319-1355 | crates/zeroclaw-channels/src/slack.rs:5723-5761 | crates/zeroclaw-channels/src/slack.rs:5768-5806 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×1
Edited copy of a member (42 corresponding lines) REDACTED:302— REDACTED:302-343 | REDACTED:468-521 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (74 corresponding lines) · ×1
Edited copy of a member (74 corresponding lines) crates/zeroclaw-config/src/policy.rs:5131— crates/zeroclaw-config/src/policy.rs:5131-5215 | crates/zeroclaw-config/src/policy.rs:5313-5386 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 29+ corresponding lines) · ×1
Edited copies of one member (3 members, 29+ corresponding lines) crates/zeroclaw-providers/src/auth/gemini_oauth.rs:101— crates/zeroclaw-providers/src/auth/gemini_oauth.rs:101-150 | crates/zeroclaw-providers/src/auth/gemini_oauth.rs:157-204 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:321-349 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 16+ corresponding lines) · ×1
Edited copies of one member (4 members, 16+ corresponding lines) crates/zeroclaw-channels/src/acp_channel.rs:192— crates/zeroclaw-channels/src/acp_channel.rs:192-219 | crates/zeroclaw-channels/src/acp_channel.rs:225-267 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3306-3321 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3323-3338 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 32+ corresponding lines) · ×1
Edited copies of one member (3 members, 32+ corresponding lines) crates/zeroclaw-providers/src/auth/email_oauth2.rs:85— crates/zeroclaw-providers/src/auth/email_oauth2.rs:85-116 | crates/zeroclaw-providers/src/auth/openai_oauth.rs:131-164 | crates/zeroclaw-providers/src/auth/xai_oauth.rs:225-263 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (65 corresponding lines) · ×1
Edited copy of a member (65 corresponding lines) crates/zeroclaw-tools/src/cloud_ops.rs:419— crates/zeroclaw-tools/src/cloud_ops.rs:419-500 | crates/zeroclaw-tools/src/cloud_ops.rs:503-567 — These two members are one piece of code written twice and then edited apart: 65 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 28+ corresponding lines) · ×1
Edited copies of one member (4 members, 28+ corresponding lines) crates/zeroclaw-plugins/src/wasm_memory.rs:224— crates/zeroclaw-plugins/src/wasm_memory.rs:224-251 | crates/zeroclaw-plugins/src/wasm_memory.rs:596-629 | crates/zeroclaw-plugins/src/wasm_memory.rs:640-669 | crates/zeroclaw-plugins/src/wasm_memory.rs:679-708 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) crates/zeroclaw-runtime/src/skills/mod.rs:1192— crates/zeroclaw-runtime/src/skills/mod.rs:1192-1224 | crates/zeroclaw-runtime/src/skills/mod.rs:3101-3127 | crates/zeroclaw-runtime/src/skills/mod.rs:3317-3342 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 24+ corresponding lines) · ×1
Edited copies of one member (5 members, 24+ corresponding lines) crates/zeroclaw-plugins/src/wasm_channel.rs:1340— crates/zeroclaw-plugins/src/wasm_channel.rs:1340-1363 | crates/zeroclaw-plugins/src/wasm_channel.rs:1370-1393 | crates/zeroclaw-plugins/src/wasm_channel.rs:1401-1424 | crates/zeroclaw-plugins/src/wasm_channel.rs:1460-1483 | crates/zeroclaw-plugins/src/wasm_channel.rs:1485-1508 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 28+ corresponding lines) · ×1
Edited copies of one member (3 members, 28+ corresponding lines) crates/zeroclaw-infra/src/session_sqlite.rs:1144— crates/zeroclaw-infra/src/session_sqlite.rs:1144-1171 | crates/zeroclaw-infra/src/session_sqlite.rs:1175-1209 | crates/zeroclaw-infra/src/session_sqlite.rs:1329-1360 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 19+ corresponding lines) · ×1
Edited copies of one member (4 members, 19+ corresponding lines) crates/zeroclaw-runtime/src/security/prompt_guard.rs:125— crates/zeroclaw-runtime/src/security/prompt_guard.rs:125-148 | crates/zeroclaw-runtime/src/security/prompt_guard.rs:151-173 | crates/zeroclaw-runtime/src/security/prompt_guard.rs:196-214 | crates/zeroclaw-runtime/src/security/prompt_guard.rs:246-271 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 16+ corresponding lines) · ×1
Edited copies of one member (5 members, 16+ corresponding lines) crates/zeroclaw-memory/src/postgres.rs:453— crates/zeroclaw-memory/src/postgres.rs:453-475 | crates/zeroclaw-memory/src/postgres.rs:477-500 | crates/zeroclaw-memory/src/postgres.rs:581-596 | crates/zeroclaw-memory/src/postgres.rs:598-621 | crates/zeroclaw-memory/src/postgres.rs:660-676 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 21+ corresponding lines) · ×1
Edited copies of one member (3 members, 21+ corresponding lines) apps/zerocode/src/input_bar.rs:674— apps/zerocode/src/input_bar.rs:674-694 | apps/zerocode/src/widgets.rs:412-434 | apps/zerocode/src/zerocode_pane.rs:217-238 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 22+ corresponding lines) · ×1
Edited copies of one member (4 members, 22+ corresponding lines) crates/zeroclaw-runtime/src/cron/store.rs:281— crates/zeroclaw-runtime/src/cron/store.rs:281-305 | crates/zeroclaw-runtime/src/cron/store.rs:500-521 | crates/zeroclaw-runtime/src/cron/store.rs:1541-1565 | crates/zeroclaw-runtime/src/cron/store.rs:1578-1606 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 10+ corresponding lines) · ×1
Edited copies of one member (5 members, 10+ corresponding lines) crates/zeroclaw-gateway/src/api_browse.rs:81— crates/zeroclaw-gateway/src/api_browse.rs:81-90 | crates/zeroclaw-gateway/src/api_browse.rs:98-107 | crates/zeroclaw-gateway/src/api_browse.rs:188-197 | crates/zeroclaw-gateway/src/api_browse.rs:211-220 | crates/zeroclaw-gateway/src/api_browse.rs:228-237 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 11+ corresponding lines) · ×1
Edited copies of one member (5 members, 11+ corresponding lines) crates/zeroclaw-memory/src/knowledge_graph_pg.rs:201— crates/zeroclaw-memory/src/knowledge_graph_pg.rs:201-211 | crates/zeroclaw-memory/src/knowledge_graph_pg.rs:213-228 | crates/zeroclaw-memory/src/knowledge_graph_pg.rs:230-242 | crates/zeroclaw-memory/src/knowledge_graph_pg.rs:244-257 | crates/zeroclaw-memory/src/knowledge_graph_pg.rs:259-270 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 77+ corresponding lines) · ×1
Edited copies of one member (4 members, 77+ corresponding lines) crates/zeroclaw-tools/src/report_templates.rs:92— crates/zeroclaw-tools/src/report_templates.rs:92-200 | crates/zeroclaw-tools/src/report_templates.rs:203-311 | crates/zeroclaw-tools/src/report_templates.rs:314-390 | crates/zeroclaw-tools/src/report_templates.rs:393-469 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 77 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 12+ corresponding lines) · ×1
Edited copies of one member (6 members, 12+ corresponding lines) crates/zeroclaw-memory/src/sqlite.rs:2258— crates/zeroclaw-memory/src/sqlite.rs:2258-2272 | crates/zeroclaw-memory/src/sqlite.rs:2274-2288 | crates/zeroclaw-memory/src/sqlite.rs:2294-2310 | crates/zeroclaw-memory/src/sqlite.rs:2312-2327 | crates/zeroclaw-memory/src/sqlite.rs:2371-2390 | crates/zeroclaw-memory/src/sqlite.rs:2392-2403 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 13+ corresponding lines) · ×1
Edited copies of one member (6 members, 13+ corresponding lines) crates/zeroclaw-providers/src/dispatch.rs:615— crates/zeroclaw-providers/src/dispatch.rs:615-627 | crates/zeroclaw-providers/src/dispatch.rs:847-859 | crates/zeroclaw-providers/src/dispatch.rs:888-900 | crates/zeroclaw-providers/src/dispatch.rs:976-988 | crates/zeroclaw-providers/src/dispatch.rs:1229-1241 | crates/zeroclaw-providers/src/dispatch.rs:1270-1282 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×1
Edited copies of one member (3 members, 7+ corresponding lines) apps/zerocode/src/config/mod.rs:1472— apps/zerocode/src/config/mod.rs:1472-1478 | apps/zerocode/src/config/mod.rs:1497-1508 | apps/zerocode/src/config/mod.rs:1510-1521 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 10+ corresponding lines) · ×1
Edited copies of one member (4 members, 10+ corresponding lines) crates/zeroclaw-channels/src/orchestrator/mod.rs:16495— crates/zeroclaw-channels/src/orchestrator/mod.rs:16495-16504 | crates/zeroclaw-gateway/src/a2a.rs:192-201 | crates/zeroclaw-runtime/src/live_config_authority.rs:1270-1281 | src/plugins/channel_instance.rs:170-180 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) crates/zeroclaw-config/src/pairing.rs:886— crates/zeroclaw-config/src/pairing.rs:886-898 | crates/zeroclaw-config/src/pairing.rs:908-919 | crates/zeroclaw-config/src/pairing.rs:925-936 | crates/zeroclaw-config/src/pairing.rs:941-951 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) crates/zeroclaw-channels/src/wecom_ws.rs:2184— crates/zeroclaw-channels/src/wecom_ws.rs:2184-2190 | crates/zeroclaw-runtime/src/skills/creator.rs:537-543 | crates/zeroclaw-runtime/src/tools/param_options.rs:163-170 | crates/zeroclaw-tools/src/knowledge_tool.rs:820-827 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 3+ corresponding lines) · ×1
Edited copies of one member (3 members, 3+ corresponding lines) apps/zerocode/src/mouse.rs:13— apps/zerocode/src/mouse.rs:13-15 | apps/zerocode/src/quickstart_pane.rs:283-285 | REDACTED:2246-2248 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) crates/zeroclaw-runtime/src/agent/tool_execution.rs:38— crates/zeroclaw-runtime/src/agent/tool_execution.rs:38-40 | crates/zeroclaw-tools/src/pipeline.rs:122-127 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:214— crates/zeroclaw-runtime/src/control_plane/task_store_sqlite.rs:214-219 | src/plugins/update.rs:53-58 | src/quickstart_plugins/model.rs:608-612 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (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:1557-1640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1217` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:1968` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (50–55 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1804— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1804-1858 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3058-3107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1804` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (123–124 lines × 2) crates/zeroclaw-providers/src/reliable.rs:3306— crates/zeroclaw-providers/src/reliable.rs:3306-3428 | crates/zeroclaw-providers/src/reliable.rs:3682-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:3306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (49 lines × 5) crates/zeroclaw-tools/src/claude_code.rs:140— crates/zeroclaw-tools/src/claude_code.rs:140-188 | crates/zeroclaw-tools/src/claude_code_runner.rs:138-186 | crates/zeroclaw-tools/src/codex_cli.rs:122-170 | crates/zeroclaw-tools/src/gemini_cli.rs:102-150 | crates/zeroclaw-tools/src/opencode_cli.rs:102-150 — before extracting anything, compare `crates/zeroclaw-tools/src/claude_code.rs` and `crates/zeroclaw-tools/src/claude_code_runner.rs` as WHOLE FILES: this scan already matched 3 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 (44–48 lines × 2) crates/zeroclaw-providers/src/compatible.rs:5109— crates/zeroclaw-providers/src/compatible.rs:5109-5156 | crates/zeroclaw-providers/src/compatible.rs:5263-5306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:5109` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:4112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (43–46 lines × 2) crates/zeroclaw-providers/src/compatible.rs:2728— crates/zeroclaw-providers/src/compatible.rs:2728-2773 | crates/zeroclaw-providers/src/compatible.rs:2848-2890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:2728` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:1499-1537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1154` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (44 lines × 2) crates/zeroclaw-providers/src/hailo_ollama.rs:565— crates/zeroclaw-providers/src/hailo_ollama.rs:565-608 | crates/zeroclaw-providers/src/ollama.rs:419-462 — 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 6 separate duplicated blocks between them, totalling at least 108 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/hailo_ollama.rs:565` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (42–44 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2540— crates/zeroclaw-runtime/src/agent/loop_.rs:2540-2581 | crates/zeroclaw-runtime/src/agent/loop_.rs:3205-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (43 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2760` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/reliable.rs:2805` calls `with_outcome`, `with_attrs` and `crates/zeroclaw-providers/src/reliable.rs:3117` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (43 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:2050` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/util.rs:315` calls `Some`, `matching_close_tag` and `crates/zeroclaw-channels/src/orchestrator/mod.rs:2048` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (39–40 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2417— crates/zeroclaw-runtime/src/agent/loop_.rs:2417-2456 | crates/zeroclaw-runtime/src/agent/loop_.rs:3072-3110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2417` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cron/mod.rs:292` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/cron/mod.rs:476` calls `parse_delay`, `now` and `src/cron/mod.rs:291` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (74–76 lines × 4) crates/zeroclaw-providers/src/reliable.rs:2682— crates/zeroclaw-providers/src/reliable.rs:2682-2757 | crates/zeroclaw-providers/src/reliable.rs:2998-3071 | crates/zeroclaw-providers/src/reliable.rs:3447-3520 | crates/zeroclaw-providers/src/reliable.rs:3824-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2682` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (38–39 lines × 2) crates/zeroclaw-channels/src/telegram.rs:4247— crates/zeroclaw-channels/src/telegram.rs:4247-4284 | crates/zeroclaw-channels/src/telegram.rs:4316-4354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:4316` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (36–38 lines × 2) crates/zeroclaw-gateway/src/canvas.rs:165— crates/zeroclaw-gateway/src/canvas.rs:165-202 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:32-67 — 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 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/canvas.rs:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35–38 lines × 2) crates/zeroclaw-providers/src/compatible.rs:5170— crates/zeroclaw-providers/src/compatible.rs:5170-5207 | crates/zeroclaw-providers/src/compatible.rs:5317-5351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:5170` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2610` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (36–37 lines × 2) crates/zeroclaw-providers/src/telnyx.rs:189— crates/zeroclaw-providers/src/telnyx.rs:189-225 | crates/zeroclaw-providers/src/telnyx.rs:257-292 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/telnyx.rs:189` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (48–50 lines × 2) crates/zeroclaw-memory/src/qdrant.rs:790— crates/zeroclaw-memory/src/qdrant.rs:790-839 | crates/zeroclaw-memory/src/qdrant.rs:1182-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/qdrant.rs:790` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:106-138 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/observability/otel.rs:400` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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 × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:4161` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28–32 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:1819— crates/zeroclaw-runtime/src/agent/loop_.rs:1819-1850 | crates/zeroclaw-runtime/src/agent/loop_.rs:3906-3933 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:1819` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-runtime/src/agent/loop_.rs:1851` calls `as_deref` and `crates/zeroclaw-runtime/src/agent/loop_.rs:3934` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (26–30 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:6473— crates/zeroclaw-runtime/src/sop/engine.rs:6473-6502 | crates/zeroclaw-runtime/src/sop/engine.rs:6532-6557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:6473` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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:1661-1687 — both copies are in the same file, so extract the block into 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–29 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2022— crates/zeroclaw-runtime/src/agent/loop_.rs:2022-2037 | crates/zeroclaw-runtime/src/agent/loop_.rs:4047-4075 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2022` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (26–28 lines × 4) crates/zeroclaw-providers/src/azure_openai.rs:396— crates/zeroclaw-providers/src/azure_openai.rs:396-421 | crates/zeroclaw-providers/src/copilot.rs:373-400 | crates/zeroclaw-providers/src/openai.rs:374-399 | crates/zeroclaw-providers/src/openrouter.rs:312-338 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/copilot.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:396` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (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 7 separate duplicated blocks between them, totalling at least 96 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/ask_user.rs:261` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–27 lines × 2) crates/zeroclaw-gateway/src/api_oidc.rs:855— crates/zeroclaw-gateway/src/api_oidc.rs:855-881 | crates/zeroclaw-gateway/src/api_oidc.rs:1056-1076 — both copies are in the same file, so extract the block into 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–27 lines × 2) crates/zeroclaw-providers/src/anthropic.rs:3029— crates/zeroclaw-providers/src/anthropic.rs:3029-3055 | crates/zeroclaw-providers/src/anthropic.rs:3281-3303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/anthropic.rs:3029` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/gemini.rs:1210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (2–25 lines × 4) crates/zeroclaw-channels/src/discord/mod.rs:2496— crates/zeroclaw-channels/src/discord/mod.rs:2496-2497 | crates/zeroclaw-channels/src/discord/mod.rs:2511-2535 | crates/zeroclaw-channels/src/discord/mod.rs:2543-2544 | crates/zeroclaw-channels/src/discord/mod.rs:2723-2747 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2496` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (22–25 lines × 2) crates/zeroclaw-channels/src/telegram.rs:2705— crates/zeroclaw-channels/src/telegram.rs:2705-2729 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:2705` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–25 lines × 2) crates/zeroclaw-config/src/schema.rs:26916— crates/zeroclaw-config/src/schema.rs:26916-26940 | crates/zeroclaw-config/src/schema.rs:27073-27089 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41 lines × 2) crates/zeroclaw-providers/src/openrouter.rs:826— crates/zeroclaw-providers/src/openrouter.rs:826-866 | crates/zeroclaw-providers/src/openrouter.rs:1063-1103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/openrouter.rs:826` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2648` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (21–24 lines × 2) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1779— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1779-1799 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3030-3053 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1779` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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 7 separate duplicated blocks between them, totalling at least 127 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/codex_cli.rs:185` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17–23 lines × 2) crates/zeroclaw-gateway/src/api.rs:1984— crates/zeroclaw-gateway/src/api.rs:1984-2000 | crates/zeroclaw-gateway/src/api.rs:2077-2099 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api.rs:2077` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–23 lines × 2) crates/zeroclaw-gateway/src/canvas.rs:294— crates/zeroclaw-gateway/src/canvas.rs:294-316 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:160-180 — 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 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/canvas.rs:294` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–22 lines × 3) crates/zeroclaw-channels/src/line.rs:827— crates/zeroclaw-channels/src/line.rs:827-846 | crates/zeroclaw-channels/src/telegram.rs:2714-2735 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:827` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 3) crates/zeroclaw-channels/src/qq.rs:156— crates/zeroclaw-channels/src/qq.rs:156-177 | crates/zeroclaw-channels/src/telegram.rs:1049-1070 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/qq.rs:156` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/telegram.rs:1071` calls `from_marker` and `crates/zeroclaw-channels/src/qq.rs:178` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18–22 lines × 2) crates/zeroclaw-config/src/schema.rs:12495— crates/zeroclaw-config/src/schema.rs:12495-12512 | crates/zeroclaw-config/src/schema.rs:12658-12679 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:12495` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 4) crates/zeroclaw-tools/src/sessions.rs:442— crates/zeroclaw-tools/src/sessions.rs:442-462 | crates/zeroclaw-tools/src/sessions.rs:645-665 | crates/zeroclaw-tools/src/sessions.rs:903-923 | crates/zeroclaw-tools/src/sessions.rs:1029-1049 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/sessions.rs:442` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/reliable.rs:2578` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (1–21 lines × 10) crates/zeroclaw-channels/src/discord/mod.rs:2492— crates/zeroclaw-channels/src/discord/mod.rs:2492-2493 | crates/zeroclaw-channels/src/discord/mod.rs:2507-2508 | crates/zeroclaw-channels/src/discord/mod.rs:2539-2540 | crates/zeroclaw-channels/src/discord/mod.rs:2719-2720 | crates/zeroclaw-channels/src/discord/mod.rs:2775-2776 | crates/zeroclaw-channels/src/discord/mod.rs:2803-2823 | crates/zeroclaw-channels/src/discord/mod.rs:2845-2845 | crates/zeroclaw-channels/src/discord/mod.rs:2907-2927 | crates/zeroclaw-channels/src/discord/mod.rs:2962-2962 | crates/zeroclaw-channels/src/discord/mod.rs:2984-2985 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2492` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:254` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-providers/src/auth/mod.rs:272` calls `extract_account_id_from_jwt`, `or_else`, `clone` and `crates/zeroclaw-providers/src/auth/mod.rs:366` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–20 lines × 2) apps/zerocode/src/client.rs:1826— apps/zerocode/src/client.rs:1826-1845 | apps/zerocode/src/client.rs:2109-2125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/client.rs:1826` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–20 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:374— crates/zeroclaw-runtime/src/agent/loop_.rs:374-393 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:374` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 3) apps/zerocode/src/i18n.rs:134— apps/zerocode/src/i18n.rs:134-152 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/i18n.rs:134` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–19 lines × 3) crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1787— crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1787-1802 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3038-3056 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:3131-3146 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:1787` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (4–19 lines × 4) crates/zeroclaw-hardware/src/peripherals/rpi.rs:156— crates/zeroclaw-hardware/src/peripherals/rpi.rs:156-174 | crates/zeroclaw-hardware/src/peripherals/serial.rs:314-332 | crates/zeroclaw-hardware/src/peripherals/uno_q_bridge.rs:161-179 | 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 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-hardware/src/peripherals/rpi.rs:156` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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 7 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:1036` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/app.rs:1787` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/alias_refs.rs:323` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–18 lines × 3) apps/zerocode/src/chat.rs:8636— apps/zerocode/src/chat.rs:8636-8652 | apps/zerocode/src/chat.rs:8713-8726 | 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:6034-6051 | 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16–18 lines × 3) crates/zeroclaw-providers/src/compatible.rs:3349— crates/zeroclaw-providers/src/compatible.rs:3349-3364 | crates/zeroclaw-providers/src/compatible.rs:3372-3389 | 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 9 separate duplicated blocks between them, totalling at least 81 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/compatible.rs:3347` calls `is_tool_result_carrier` and `crates/zeroclaw-providers/src/openrouter.rs:425` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–18 lines × 3) crates/zeroclaw-providers/src/gemini.rs:1221— crates/zeroclaw-providers/src/gemini.rs:1221-1233 | crates/zeroclaw-providers/src/gemini.rs:1303-1320 | crates/zeroclaw-providers/src/gemini.rs:1549-1561 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/gemini.rs:1221` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13–18 lines × 2) crates/zeroclaw-runtime/src/sop/engine.rs:4087— crates/zeroclaw-runtime/src/sop/engine.rs:4087-4104 | crates/zeroclaw-runtime/src/sop/engine.rs:4755-4767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:4087` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 4) crates/zeroclaw-infra/src/session_sqlite.rs:1253— crates/zeroclaw-infra/src/session_sqlite.rs:1253-1269 | crates/zeroclaw-infra/src/session_sqlite.rs:1563-1579 | crates/zeroclaw-infra/src/session_sqlite.rs:1659-1674 | crates/zeroclaw-infra/src/session_sqlite.rs:1711-1726 — 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 (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 (16–17 lines × 3) crates/zeroclaw-api/src/memory_traits.rs:704— crates/zeroclaw-api/src/memory_traits.rs:704-719 | crates/zeroclaw-memory/src/agent_scoped.rs:642-657 | crates/zeroclaw-tools/src/memory_export.rs:20-36 — before extracting anything, compare `crates/zeroclaw-api/src/memory_traits.rs` and `crates/zeroclaw-memory/src/agent_scoped.rs` as WHOLE FILES: this scan already matched 3 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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 5 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/compatible.rs:1329` calls `Some`, `clone` and `crates/zeroclaw-providers/src/azure_openai.rs:303` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–17 lines × 2) crates/zeroclaw-providers/src/compatible.rs:3160— crates/zeroclaw-providers/src/compatible.rs:3160-3176 | crates/zeroclaw-providers/src/compatible.rs:3194-3207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/compatible.rs:3160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_webauthn.rs:70` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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:1235-1246 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-api/src/channel.rs:1028` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–16 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:6531— crates/zeroclaw-channels/src/orchestrator/mod.rs:6531-6543 | crates/zeroclaw-channels/src/orchestrator/mod.rs:6550-6565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:6531` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–16 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-429 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/alias_refs.rs:345` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–24 lines × 2) crates/zeroclaw-config/src/schema.rs:23760— crates/zeroclaw-config/src/schema.rs:23760-23783 | crates/zeroclaw-config/src/schema.rs:23807-23824 — both copies are in the same file, so extract the block into 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-gateway/src/api_webauthn.rs:291` calls `Path` and `crates/zeroclaw-gateway/src/api_webauthn.rs:246` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tunnel/cloudflare.rs:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–14 lines × 3) crates/zeroclaw-channels/src/orchestrator/mod.rs:13720— crates/zeroclaw-channels/src/orchestrator/mod.rs:13720-13730 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15386-15393 | crates/zeroclaw-gateway/src/lib.rs:1987-2000 — 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 10 separate duplicated blocks between them, totalling at least 96 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:13720` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–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 (10–13 lines × 3) crates/zeroclaw-channels/src/bluesky.rs:572— crates/zeroclaw-channels/src/bluesky.rs:572-584 | crates/zeroclaw-channels/src/lark.rs:2028-2038 | crates/zeroclaw-channels/src/mattermost.rs:952-961 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/mattermost.rs` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:572` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–14 lines × 2) crates/zeroclaw-config/src/schema.rs:23115— crates/zeroclaw-config/src/schema.rs:23115-23128 | crates/zeroclaw-config/src/schema.rs:23184-23193 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–13 lines × 2) crates/zeroclaw-gateway/src/canvas.rs:279— crates/zeroclaw-gateway/src/canvas.rs:279-291 | crates/zeroclaw-gateway/src/ws_sop_runs.rs:150-158 — 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 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/canvas.rs:279` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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:873-885 | crates/zeroclaw-runtime/src/skills/mod.rs:1001-1013 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/security/estop.rs:83` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/security/estop.rs:83` calls `with_outcome`, `with_attrs`, `display` and `crates/zeroclaw-runtime/src/skills/mod.rs:873` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–13 lines × 2) crates/zeroclaw-runtime/src/tools/scoped.rs:1064— crates/zeroclaw-runtime/src/tools/scoped.rs:1064-1076 | crates/zeroclaw-runtime/src/tools/scoped.rs:1344-1349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/scoped.rs:1064` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5–12 lines × 10) crates/zeroclaw-channels/src/bluesky.rs:558— crates/zeroclaw-channels/src/bluesky.rs:558-569 | 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:8720-8726 — before extracting anything, compare `crates/zeroclaw-channels/src/bluesky.rs` and `crates/zeroclaw-channels/src/mattermost.rs` as WHOLE FILES: this scan already matched 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:558` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/imessage.rs:304` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 6) crates/zeroclaw-providers/src/azure_openai.rs:651— crates/zeroclaw-providers/src/azure_openai.rs:651-662 | crates/zeroclaw-providers/src/azure_openai.rs:725-736 | crates/zeroclaw-providers/src/openai.rs:647-658 | crates/zeroclaw-providers/src/openai.rs:735-746 | crates/zeroclaw-providers/src/openrouter.rs:847-858 | crates/zeroclaw-providers/src/openrouter.rs:1084-1095 — 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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:651` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11–12 lines × 5) crates/zeroclaw-memory/src/qdrant.rs:187— crates/zeroclaw-memory/src/qdrant.rs:187-198 | crates/zeroclaw-memory/src/qdrant.rs:593-603 | crates/zeroclaw-memory/src/qdrant.rs:802-813 | crates/zeroclaw-memory/src/qdrant.rs:890-901 | crates/zeroclaw-memory/src/qdrant.rs:1194-1205 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/qdrant.rs:187` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 5) crates/zeroclaw-tools/src/claude_code.rs:96— crates/zeroclaw-tools/src/claude_code.rs:96-108 | crates/zeroclaw-tools/src/claude_code_runner.rs:118-130 | crates/zeroclaw-tools/src/codex_cli.rs:99-111 | crates/zeroclaw-tools/src/gemini_cli.rs:79-91 | crates/zeroclaw-tools/src/opencode_cli.rs:79-91 — before extracting anything, compare `crates/zeroclaw-tools/src/claude_code.rs` and `crates/zeroclaw-tools/src/claude_code_runner.rs` as WHOLE FILES: this scan already matched 3 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/claude_code.rs:96` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10–12 lines × 3) crates/zeroclaw-runtime/src/tools/delegate.rs:2636— crates/zeroclaw-runtime/src/tools/delegate.rs:2636-2647 | crates/zeroclaw-runtime/src/tools/delegate.rs:2694-2703 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:516-525 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/delegate.rs:2636` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–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:12017-12028 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/rpc/dispatch.rs:12017` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–12 lines × 2) crates/zeroclaw-runtime/src/agent/loop_.rs:2238— crates/zeroclaw-runtime/src/agent/loop_.rs:2238-2249 | crates/zeroclaw-runtime/src/agent/loop_.rs:4227-4235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/agent/loop_.rs:2238` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 10) crates/zeroclaw-tools/src/microsoft365/mod.rs:82— crates/zeroclaw-tools/src/microsoft365/mod.rs:82-92 | crates/zeroclaw-tools/src/microsoft365/mod.rs:114-124 | crates/zeroclaw-tools/src/microsoft365/mod.rs:164-174 | crates/zeroclaw-tools/src/microsoft365/mod.rs:217-227 | crates/zeroclaw-tools/src/microsoft365/mod.rs:247-257 | crates/zeroclaw-tools/src/microsoft365/mod.rs:304-314 | crates/zeroclaw-tools/src/microsoft365/mod.rs:342-352 | crates/zeroclaw-tools/src/microsoft365/mod.rs:415-425 | crates/zeroclaw-tools/src/microsoft365/mod.rs:471-481 | crates/zeroclaw-tools/src/microsoft365/mod.rs:545-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/microsoft365/mod.rs:82` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–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:4039-4046 | crates/zeroclaw-runtime/src/sop/engine.rs:6247-6257 | crates/zeroclaw-runtime/src/sop/engine.rs:6294-6301 | 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:1048-1058 | crates/zeroclaw-runtime/src/sop/executor.rs:1257-1267 | crates/zeroclaw-runtime/src/sop/executor.rs:1299-1309 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:836` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–11 lines × 7) crates/zeroclaw-channels/src/orchestrator/mod.rs:16798— crates/zeroclaw-channels/src/orchestrator/mod.rs:16798-16805 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16824-16831 | crates/zeroclaw-gateway/src/ws.rs:651-658 | crates/zeroclaw-gateway/src/ws.rs:1415-1422 | crates/zeroclaw-gateway/src/ws.rs:1506-1513 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5318-5328 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5382-5392 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:16798` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–11 lines × 5) crates/zeroclaw-api/src/model_provider.rs:885— crates/zeroclaw-api/src/model_provider.rs:885-893 | crates/zeroclaw-providers/src/compatible.rs:3912-3919 | crates/zeroclaw-providers/src/hailo_ollama.rs:950-960 | crates/zeroclaw-providers/src/ollama.rs:513-520 | crates/zeroclaw-runtime/src/agent/history.rs:308-315 — 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 6 separate duplicated blocks between them, totalling at least 108 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:1581` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–20 lines × 3) crates/zeroclaw-tools/src/ask_user.rs:141— crates/zeroclaw-tools/src/ask_user.rs:141-158 | crates/zeroclaw-tools/src/escalate.rs:249-268 | crates/zeroclaw-tools/src/poll.rs:246-256 — 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 7 separate duplicated blocks between them, totalling at least 96 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/ask_user.rs:141` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–10 lines × 8) 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-gateway/src/dashboard_session.rs:918-927 | crates/zeroclaw-runtime/src/cron/scheduler.rs:1005-1010 | crates/zeroclaw-runtime/src/rpc/locales.rs:62-67 | crates/zeroclaw-runtime/src/sop/executor.rs:1002-1011 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:302-308 — there are 8 copies across 6 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:927` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–10 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:4738-4747 | 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 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/azure_openai.rs:653` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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:8737-8744 | 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:2173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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:4009-4014 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/plugin_runtime.rs:1146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:238` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–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 — before extracting anything, compare `crates/zeroclaw-providers/src/azure_openai.rs` and `crates/zeroclaw-providers/src/copilot.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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–9 lines × 12) 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:15555-15561 | crates/zeroclaw-gateway/src/api_oidc.rs:1594-1600 | crates/zeroclaw-gateway/src/lib.rs:1809-1815 | crates/zeroclaw-gateway/src/ws.rs:625-631 | crates/zeroclaw-memory/src/lib.rs:828-833 | crates/zeroclaw-runtime/src/rpc/auth.rs:366-371 | crates/zeroclaw-runtime/src/rpc/locales.rs:129-137 | crates/zeroclaw-runtime/src/security/principal_resolver.rs:237-242 | crates/zeroclaw-runtime/src/sop/approval/channel_route.rs:403-409 | src/main.rs:16031-16039 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.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 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3286` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–9 lines × 7) crates/zeroclaw-channels/src/orchestrator/mod.rs:10600— crates/zeroclaw-channels/src/orchestrator/mod.rs:10600-10608 | REDACTED:1667-1672 | crates/zeroclaw-gateway/src/api_pairing.rs:497-502 | crates/zeroclaw-gateway/src/api_plugins.rs:256-262 | crates/zeroclaw-gateway/src/ws.rs:839-844 | crates/zeroclaw-providers/src/grok_cli.rs:883-889 | crates/zeroclaw-runtime/src/tools/skill_http.rs:193-198 — 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 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:10600` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/jira_tool.rs:129` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8–9 lines × 5) crates/zeroclaw-runtime/src/sop/engine.rs:2580— crates/zeroclaw-runtime/src/sop/engine.rs:2580-2587 | crates/zeroclaw-runtime/src/sop/engine.rs:2891-2898 | crates/zeroclaw-runtime/src/sop/engine.rs:4084-4092 | crates/zeroclaw-runtime/src/sop/engine.rs:4752-4760 | crates/zeroclaw-runtime/src/sop/engine.rs:5657-5664 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/sop/engine.rs:2580` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–9 lines × 4) crates/zeroclaw-channels/src/bluesky.rs:562— crates/zeroclaw-channels/src/bluesky.rs:562-570 | crates/zeroclaw-channels/src/bluesky.rs:592-600 | crates/zeroclaw-providers/src/pricing.rs:488-493 | crates/zeroclaw-providers/src/pricing.rs:534-539 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:562` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–9 lines × 3) crates/zeroclaw-tools/src/jira_tool.rs:406— crates/zeroclaw-tools/src/jira_tool.rs:406-412 | crates/zeroclaw-tools/src/jira_tool.rs:604-610 | crates/zeroclaw-tools/src/jira_tool.rs:693-701 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/jira_tool.rs:406` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 18) crates/zeroclaw-channels/src/orchestrator/mod.rs:14912— crates/zeroclaw-channels/src/orchestrator/mod.rs:14912-14919 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14982-14989 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15332-15339 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15368-15375 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15422-15429 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15447-15454 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15482-15489 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15526-15533 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15591-15598 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15629-15636 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15671-15678 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15721-15728 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15760-15767 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15804-15811 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15839-15846 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15884-15891 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15921-15928 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16018-16025 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:14912` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/whatsapp_storage.rs:622` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 7) crates/zeroclaw-runtime/src/tools/read_skill.rs:51— crates/zeroclaw-runtime/src/tools/read_skill.rs:51-58 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:148-155 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:165-172 | crates/zeroclaw-runtime/src/tools/send_message_to_peer.rs:182-189 | crates/zeroclaw-tools/src/file_download.rs:484-491 | crates/zeroclaw-tools/src/file_download.rs:502-509 | crates/zeroclaw-tools/src/pushover.rs:160-167 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-runtime/src/tools/read_skill.rs:51` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1210` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (3–8 lines × 4) apps/zerocode/src/config_manager.rs:1889— apps/zerocode/src/config_manager.rs:1889-1891 | apps/zerocode/src/config_manager.rs:1968-1970 | apps/zerocode/src/config_manager.rs:3499-3506 | apps/zerocode/src/config_manager.rs:5416-5423 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `apps/zerocode/src/config_manager.rs:3499` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (3–8 lines × 3) crates/zeroclaw-memory/src/sqlite.rs:948— crates/zeroclaw-memory/src/sqlite.rs:948-950 | crates/zeroclaw-memory/src/sqlite.rs:1018-1025 | crates/zeroclaw-memory/src/sqlite.rs:2507-2514 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-memory/src/sqlite.rs:1018` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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:17090-17096 | crates/zeroclaw-channels/src/telegram.rs:4532-4538 | crates/zeroclaw-channels/src/whatsapp_web.rs:1513-1519 | crates/zeroclaw-config/src/cost/tracker.rs:971-977 | crates/zeroclaw-gateway/src/lib.rs:2089-2095 | 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/orchestrator/mod.rs` as WHOLE FILES: this scan already matched 4 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2316` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 8) crates/zeroclaw-providers/src/auth/mod.rs:1360— crates/zeroclaw-providers/src/auth/mod.rs:1360-1366 | crates/zeroclaw-providers/src/auth/mod.rs:1381-1387 | crates/zeroclaw-providers/src/bedrock.rs:359-364 | crates/zeroclaw-tools/src/web_search_tool.rs:427-432 | crates/zeroclaw-tools/src/web_search_tool.rs:649-654 | crates/zeroclaw-tools/src/web_search_tool.rs:825-830 | crates/zeroclaw-tools/src/web_search_tool.rs:964-969 | crates/zeroclaw-tools/src/web_search_tool.rs:1804-1809 — there are 8 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 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/mod.rs:1360` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 6) crates/zeroclaw-providers/src/auth/gemini_oauth.rs:485— crates/zeroclaw-providers/src/auth/gemini_oauth.rs:485-491 | crates/zeroclaw-runtime/src/tools/schedule.rs:348-353 | crates/zeroclaw-tools/src/project_intel.rs:56-62 | crates/zeroclaw-tools/src/project_intel.rs:73-79 | crates/zeroclaw-tools/src/project_intel.rs:229-235 | crates/zeroclaw-tools/src/project_intel.rs:254-260 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/auth/gemini_oauth.rs:485` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-runtime/src/tools/schedule.rs:347` calls `and_then`, `as_str` and `crates/zeroclaw-providers/src/auth/gemini_oauth.rs:484` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/linkedin.rs:333` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (1–7 lines × 5) crates/zeroclaw-config/src/schema.rs:12125— crates/zeroclaw-config/src/schema.rs:12125-12131 | crates/zeroclaw-config/src/schema.rs:12157-12163 | crates/zeroclaw-config/src/schema.rs:12193-12199 | crates/zeroclaw-config/src/schema.rs:12286-12286 | crates/zeroclaw-config/src/schema.rs:12287-12287 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema.rs:12125` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mattermost.rs:1919` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (4–7 lines × 6) crates/zeroclaw-gateway/src/api_pairing.rs:84— crates/zeroclaw-gateway/src/api_pairing.rs:84-90 | crates/zeroclaw-gateway/src/api_pairing.rs:214-220 | crates/zeroclaw-infra/src/session_sqlite.rs:1248-1252 | crates/zeroclaw-infra/src/session_sqlite.rs:1558-1562 | crates/zeroclaw-infra/src/session_sqlite.rs:1655-1658 | crates/zeroclaw-infra/src/session_sqlite.rs:1707-1710 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_pairing.rs:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-gateway/src/api_pairing.rs:82` calls `parse_from_rfc3339`, `with_timezone`, `unwrap_or_else` and `crates/zeroclaw-infra/src/session_sqlite.rs:1248` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 13) crates/zeroclaw-tools/src/web_search_tool.rs:389— crates/zeroclaw-tools/src/web_search_tool.rs:389-394 | crates/zeroclaw-tools/src/web_search_tool.rs:407-412 | crates/zeroclaw-tools/src/web_search_tool.rs:611-616 | crates/zeroclaw-tools/src/web_search_tool.rs:629-634 | crates/zeroclaw-tools/src/web_search_tool.rs:787-792 | crates/zeroclaw-tools/src/web_search_tool.rs:805-810 | crates/zeroclaw-tools/src/web_search_tool.rs:926-931 | crates/zeroclaw-tools/src/web_search_tool.rs:944-949 | crates/zeroclaw-tools/src/web_search_tool.rs:1126-1131 | crates/zeroclaw-tools/src/web_search_tool.rs:1323-1328 | crates/zeroclaw-tools/src/web_search_tool.rs:1500-1505 | crates/zeroclaw-tools/src/web_search_tool.rs:1766-1771 | crates/zeroclaw-tools/src/web_search_tool.rs:1784-1789 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/web_search_tool.rs:389` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 9) 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:5318-5324 | crates/zeroclaw-gateway/src/ws.rs:649-654 | crates/zeroclaw-hardware/src/loader.rs:77-82 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5316-5324 | crates/zeroclaw-runtime/src/sop/engine.rs:6316-6321 | crates/zeroclaw-runtime/src/sop/engine.rs:6352-6357 — before extracting anything, compare `crates/zeroclaw-gateway/src/lib.rs` and `crates/zeroclaw-gateway/src/ws.rs` as WHOLE FILES: this scan already matched 4 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/line.rs:333` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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:2815-2820 | crates/zeroclaw-channels/src/orchestrator/acp_server.rs:2874-2879 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/acp_server.rs:632` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (3–6 lines × 4) apps/zerocode/src/app.rs:3534— apps/zerocode/src/app.rs:3534-3540 | apps/zerocode/src/app.rs:3670-3675 | apps/zerocode/src/app.rs:3730-3732 | apps/zerocode/src/quickstart_pane.rs:3382-3384 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `apps/zerocode/src/app.rs:3669` calls `saturating_sub` and `apps/zerocode/src/app.rs:3729` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (1–6 lines × 7) crates/zeroclaw-channels/src/mochat.rs:265— crates/zeroclaw-channels/src/mochat.rs:265-267 | crates/zeroclaw-channels/src/mochat.rs:268-268 | crates/zeroclaw-channels/src/signal.rs:1271-1276 | crates/zeroclaw-channels/src/telegram.rs:4172-4177 | crates/zeroclaw-channels/src/telegram.rs:9123-9128 | crates/zeroclaw-channels/src/twitter.rs:404-404 | crates/zeroclaw-channels/src/twitter.rs:405-405 — before extracting anything, compare `crates/zeroclaw-channels/src/mochat.rs` and `crates/zeroclaw-channels/src/twitter.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 115 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/mochat.rs:265` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/mochat.rs:267` calls `text`, `unwrap_or_default` and `crates/zeroclaw-channels/src/twitter.rs:405` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (4–6 lines × 3) 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-providers/src/lib.rs:403` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-providers/src/lib.rs:403` calls `timeout`, `from_secs` and `crates/zeroclaw-providers/src/gemini.rs:357` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 68) crates/zeroclaw-channels/src/discord/mod.rs:1637— crates/zeroclaw-channels/src/discord/mod.rs:1637-1641 | crates/zeroclaw-channels/src/discord/mod.rs:1650-1654 | crates/zeroclaw-channels/src/imessage.rs:272-276 | crates/zeroclaw-channels/src/matrix.rs:2529-2533 | crates/zeroclaw-channels/src/matrix.rs:2822-2826 | crates/zeroclaw-channels/src/matrix.rs:3765-3769 | crates/zeroclaw-channels/src/matrix.rs:3823-3827 | crates/zeroclaw-channels/src/matrix.rs:3953-3957 | 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:7880-7884 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11217-11224 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15087-15091 | crates/zeroclaw-channels/src/voice_call.rs:329-333 | crates/zeroclaw-channels/src/voice_call.rs:459-463 | crates/zeroclaw-channels/src/voice_call.rs:470-474 | crates/zeroclaw-channels/src/webhook.rs:154-158 | crates/zeroclaw-channels/src/wechat.rs:450-454 | crates/zeroclaw-channels/src/wechat.rs:468-472 | crates/zeroclaw-channels/src/wechat.rs:876-880 | crates/zeroclaw-channels/src/wechat.rs:2837-2844 | crates/zeroclaw-channels/src/wechat.rs:2946-2953 | crates/zeroclaw-channels/src/whatsapp_web.rs:1297-1301 | crates/zeroclaw-channels/src/whatsapp_web.rs:1864-1868 | crates/zeroclaw-channels/src/whatsapp_web.rs:1900-1904 | crates/zeroclaw-channels/src/whatsapp_web.rs:1950-1954 | crates/zeroclaw-channels/src/whatsapp_web.rs:4441-4445 | crates/zeroclaw-channels/src/whatsapp_web.rs:4481-4485 | crates/zeroclaw-config/src/secrets.rs:262-266 | crates/zeroclaw-gateway/src/lib.rs:3409-3413 | crates/zeroclaw-gateway/src/ws.rs:841-845 | crates/zeroclaw-hardware/src/uf2.rs:118-122 | crates/zeroclaw-providers/src/bedrock.rs:131-135 | crates/zeroclaw-providers/src/bedrock.rs:148-152 | 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:3733-3737 | crates/zeroclaw-runtime/src/tools/shell.rs:295-299 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:155-159 | crates/zeroclaw-runtime/src/tools/sop_approve.rs:119-123 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:123-127 | crates/zeroclaw-runtime/src/tools/sop_list.rs:48-52 | crates/zeroclaw-runtime/src/tools/sop_status.rs:102-106 | crates/zeroclaw-tools/src/jira_tool.rs:114-118 | crates/zeroclaw-tools/src/jira_tool.rs:134-138 | crates/zeroclaw-tools/src/jira_tool.rs:211-215 | crates/zeroclaw-tools/src/jira_tool.rs:231-235 | crates/zeroclaw-tools/src/jira_tool.rs:283-287 | crates/zeroclaw-tools/src/jira_tool.rs:303-307 | crates/zeroclaw-tools/src/jira_tool.rs:362-366 | crates/zeroclaw-tools/src/jira_tool.rs:382-386 | crates/zeroclaw-tools/src/jira_tool.rs:411-415 | crates/zeroclaw-tools/src/jira_tool.rs:431-435 | crates/zeroclaw-tools/src/jira_tool.rs:462-466 | crates/zeroclaw-tools/src/jira_tool.rs:474-478 | crates/zeroclaw-tools/src/jira_tool.rs:504-508 | crates/zeroclaw-tools/src/jira_tool.rs:531-538 | crates/zeroclaw-tools/src/jira_tool.rs:549-556 | crates/zeroclaw-tools/src/jira_tool.rs:569-573 | crates/zeroclaw-tools/src/jira_tool.rs:609-613 | crates/zeroclaw-tools/src/jira_tool.rs:629-633 | crates/zeroclaw-tools/src/jira_tool.rs:700-704 | crates/zeroclaw-tools/src/jira_tool.rs:720-724 | crates/zeroclaw-tools/src/jira_tool.rs:801-805 | crates/zeroclaw-tools/src/jira_tool.rs:899-903 | crates/zeroclaw-tools/src/jira_tool.rs:919-923 | crates/zeroclaw-tools/src/web_fetch.rs:250-254 — before extracting anything, compare `crates/zeroclaw-channels/src/imessage.rs` and `crates/zeroclaw-channels/src/matrix.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. 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:1637` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:11227` calls `Err` and `crates/zeroclaw-channels/src/notion.rs:506` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 14) 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:11182-11189 | crates/zeroclaw-channels/src/orchestrator/mod.rs:17092-17096 | crates/zeroclaw-channels/src/whatsapp_web.rs:1515-1519 | crates/zeroclaw-config/src/cost/tracker.rs:973-977 | crates/zeroclaw-gateway/src/lib.rs:2091-2095 | crates/zeroclaw-memory/src/lib.rs:1178-1182 | crates/zeroclaw-providers/src/anthropic.rs:1576-1584 | crates/zeroclaw-providers/src/pricing.rs:488-492 | crates/zeroclaw-runtime/src/daemon/mod.rs:2682-2686 | crates/zeroclaw-runtime/src/restart.rs:215-219 | src/commands/update.rs:396-400 — before extracting anything, compare `crates/zeroclaw-channels/src/lark.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 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:2318` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 12) crates/zeroclaw-channels/src/gmail_push.rs:699— crates/zeroclaw-channels/src/gmail_push.rs:699-703 | crates/zeroclaw-channels/src/gmail_push.rs:709-713 | crates/zeroclaw-channels/src/notion.rs:69-73 | crates/zeroclaw-channels/src/wechat.rs:483-487 | crates/zeroclaw-channels/src/wechat.rs:507-511 | crates/zeroclaw-channels/src/wechat.rs:532-536 | crates/zeroclaw-channels/src/wechat.rs:542-546 | crates/zeroclaw-providers/src/azure_openai.rs:120-124 | crates/zeroclaw-providers/src/openai.rs:151-155 | crates/zeroclaw-runtime/src/security/vulnerability.rs:73-77 | crates/zeroclaw-tools/src/notion_tool.rs:38-42 | crates/zeroclaw-tools/src/pipeline.rs:354-358 — 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 17 separate duplicated blocks between them, totalling at least 226 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/gmail_push.rs:699` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 10) crates/zeroclaw-channels/src/slack.rs:1289— crates/zeroclaw-channels/src/slack.rs:1289-1294 | crates/zeroclaw-channels/src/slack.rs:1345-1350 | crates/zeroclaw-channels/src/slack.rs:1595-1600 | crates/zeroclaw-channels/src/slack.rs:2199-2204 | crates/zeroclaw-channels/src/slack.rs:2679-2684 | crates/zeroclaw-channels/src/slack.rs:3970-3975 | crates/zeroclaw-channels/src/slack.rs:4202-4207 | crates/zeroclaw-channels/src/slack.rs:5398-5403 | crates/zeroclaw-channels/src/slack.rs:5749-5754 | crates/zeroclaw-channels/src/slack.rs:5794-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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:1289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (2–5 lines × 3) crates/zeroclaw-channels/src/discord/mod.rs:2187— crates/zeroclaw-channels/src/discord/mod.rs:2187-2188 | crates/zeroclaw-channels/src/discord/mod.rs:2405-2409 | 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 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/discord/mod.rs:2405` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–20 lines × 2) crates/zeroclaw-channels/src/orchestrator/mod.rs:7905— crates/zeroclaw-channels/src/orchestrator/mod.rs:7905-7914 | crates/zeroclaw-channels/src/orchestrator/mod.rs:8000-8019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/wechat.rs:491` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/wechat.rs:518` calls `try_from`, `as_slice`, `map_err` and `crates/zeroclaw-channels/src/wechat.rs:491` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (3–5 lines × 3) crates/zeroclaw-gateway/src/api_sections.rs:346— crates/zeroclaw-gateway/src/api_sections.rs:346-350 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:12012-12014 | xtask/src/cmd/mdbook/versions.rs:273-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-gateway/src/api_sections.rs:346` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 22) 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/matrix.rs:2164-2174 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11294-11302 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14882-14890 | 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:2915-2923 | crates/zeroclaw-runtime/src/tools/mod.rs:2612-2620 | crates/zeroclaw-runtime/src/tools/mod.rs:2721-2729 | crates/zeroclaw-runtime/src/tools/mod.rs:2761-2769 | crates/zeroclaw-runtime/src/tools/mod.rs:2809-2817 | crates/zeroclaw-runtime/src/tools/mod.rs:2888-2896 | crates/zeroclaw-runtime/src/tools/mod.rs:2914-2922 | crates/zeroclaw-runtime/src/tools/mod.rs:3401-3409 | crates/zeroclaw-runtime/src/tools/mod.rs:3902-3910 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:628` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/orchestrator/mqtt.rs:90` calls `mark_component_error`, `to_string` and `crates/zeroclaw-channels/src/imessage.rs:322` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 36) 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:2164-2174 | 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:4494-4503 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11294-11301 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14882-14889 | 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-channels/src/wechat.rs:1222-1229 | crates/zeroclaw-channels/src/wechat.rs:1261-1268 | 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:2915-2922 | crates/zeroclaw-runtime/src/tools/mod.rs:2612-2619 | crates/zeroclaw-runtime/src/tools/mod.rs:2721-2728 | crates/zeroclaw-runtime/src/tools/mod.rs:2761-2768 | crates/zeroclaw-runtime/src/tools/mod.rs:2809-2816 | crates/zeroclaw-runtime/src/tools/mod.rs:2888-2895 | crates/zeroclaw-runtime/src/tools/mod.rs:2914-2921 | crates/zeroclaw-runtime/src/tools/mod.rs:3401-3408 | crates/zeroclaw-runtime/src/tools/mod.rs:3902-3909 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:230-237 | crates/zeroclaw-tools/src/linkedin.rs:287-297 | crates/zeroclaw-tools/src/microsoft365/auth.rs:356-363 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:628` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/mochat.rs:281` calls `sleep` and `crates/zeroclaw-channels/src/bluesky.rs:636` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (4–6 lines × 55) 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:2164-2173 | 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:4129-4135 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4460-4463 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4494-4502 | crates/zeroclaw-channels/src/orchestrator/mod.rs:4693-4699 | crates/zeroclaw-channels/src/orchestrator/mod.rs:5587-5591 | crates/zeroclaw-channels/src/orchestrator/mod.rs:9499-9505 | crates/zeroclaw-channels/src/orchestrator/mod.rs:11294-11300 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14882-14888 | 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:83-88 | crates/zeroclaw-channels/src/voice_wake.rs:476-487 | crates/zeroclaw-channels/src/voice_wake.rs:492-501 | crates/zeroclaw-channels/src/wechat.rs:1222-1228 | crates/zeroclaw-channels/src/wechat.rs:1261-1267 | 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:2544-2553 | crates/zeroclaw-runtime/src/daemon/mod.rs:2868-2877 | crates/zeroclaw-runtime/src/daemon/mod.rs:2915-2921 | 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:733-739 | crates/zeroclaw-runtime/src/sop/dispatch.rs:748-754 | crates/zeroclaw-runtime/src/tools/mod.rs:2612-2618 | crates/zeroclaw-runtime/src/tools/mod.rs:2721-2727 | crates/zeroclaw-runtime/src/tools/mod.rs:2761-2767 | crates/zeroclaw-runtime/src/tools/mod.rs:2809-2815 | crates/zeroclaw-runtime/src/tools/mod.rs:2888-2894 | crates/zeroclaw-runtime/src/tools/mod.rs:2914-2920 | crates/zeroclaw-runtime/src/tools/mod.rs:3401-3407 | crates/zeroclaw-runtime/src/tools/mod.rs:3902-3908 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:219-225 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:230-236 | crates/zeroclaw-runtime/src/tools/sop_execute.rs:159-165 | crates/zeroclaw-tools/src/linkedin.rs:287-296 | crates/zeroclaw-tools/src/microsoft365/auth.rs:356-362 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/bluesky.rs:628` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-channels/src/mochat.rs:281` calls `sleep` and `crates/zeroclaw-channels/src/bluesky.rs:636` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 8) crates/zeroclaw-channels/src/matrix.rs:2681— crates/zeroclaw-channels/src/matrix.rs:2681-2691 | crates/zeroclaw-channels/src/wechat.rs:1231-1238 | crates/zeroclaw-channels/src/wechat.rs:1270-1277 | 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 | crates/zeroclaw-runtime/src/cron/store.rs:677-684 | crates/zeroclaw-runtime/src/cron/store.rs:741-748 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-channels/src/wechat.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 87 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/matrix.rs:2681` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 7) crates/zeroclaw-channels/src/telegram.rs:6750— crates/zeroclaw-channels/src/telegram.rs:6750-6760 | crates/zeroclaw-channels/src/telegram.rs:6794-6804 | crates/zeroclaw-channels/src/telegram.rs:6843-6853 | crates/zeroclaw-channels/src/telegram.rs:6887-6897 | crates/zeroclaw-channels/src/telegram.rs:6936-6946 | crates/zeroclaw-channels/src/telegram.rs:6985-6995 | crates/zeroclaw-channels/src/telegram.rs:7034-7044 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:6750` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-tools/src/jira_tool.rs:122` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 9) crates/zeroclaw-channels/src/whatsapp_web.rs:1323— crates/zeroclaw-channels/src/whatsapp_web.rs:1323-1329 | crates/zeroclaw-config/src/schema.rs:25099-25108 | crates/zeroclaw-runtime/src/tools/schedule.rs:500-506 | crates/zeroclaw-tools/src/browser_delegate.rs:75-81 | crates/zeroclaw-tools/src/git_operations.rs:872-878 | crates/zeroclaw-tools/src/knowledge_tool.rs:208-214 | crates/zeroclaw-tools/src/knowledge_tool.rs:379-385 | crates/zeroclaw-tools/src/model_routing_config.rs:248-257 | src/cron/mod.rs:27-33 — there are 9 copies across 8 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 9 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 23) 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:105-110 | crates/zeroclaw-runtime/src/tools/sop_advance.rs:117-122 | 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: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:175-179 | crates/zeroclaw-tools/src/knowledge_tool.rs:188-195 | 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 23 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 23 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:3770` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `args` to `serde_json::Value` in one and `&serde_json::Value` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-runtime/src/tools/sop_advance.rs:111` calls `with_outcome` and `crates/zeroclaw-tools/src/google_workspace.rs:196` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 10) crates/zeroclaw-channels/src/orchestrator/mod.rs:4061— crates/zeroclaw-channels/src/orchestrator/mod.rs:4061-4070 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16799-16805 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16825-16831 | crates/zeroclaw-channels/src/whatsapp_web.rs:1613-1619 | crates/zeroclaw-gateway/src/ws.rs:652-658 | crates/zeroclaw-gateway/src/ws.rs:1416-1422 | crates/zeroclaw-gateway/src/ws.rs:1507-1513 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5319-5328 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5383-5392 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:14669-14675 — 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 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:4058` calls `Ok` and `crates/zeroclaw-runtime/src/rpc/dispatch.rs:5380` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 7) crates/zeroclaw-channels/src/orchestrator/mod.rs:12212— crates/zeroclaw-channels/src/orchestrator/mod.rs:12212-12218 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15558-15564 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15857-15863 | crates/zeroclaw-plugins/src/host.rs:1157-1163 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5270-5279 | crates/zeroclaw-runtime/src/rpc/dispatch.rs:5289-5298 | crates/zeroclaw-runtime/src/sop/engine.rs:1482-1488 — before extracting anything, compare `crates/zeroclaw-channels/src/orchestrator/mod.rs` and `crates/zeroclaw-runtime/src/rpc/dispatch.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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `crates/zeroclaw-plugins/src/host.rs:1167` calls `Err` and `crates/zeroclaw-channels/src/orchestrator/mod.rs:15867` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 19) crates/zeroclaw-channels/src/email_channel.rs:313— crates/zeroclaw-channels/src/email_channel.rs:313-319 | crates/zeroclaw-channels/src/email_channel.rs:330-336 | crates/zeroclaw-channels/src/email_channel.rs:604-610 | crates/zeroclaw-channels/src/line.rs:1211-1217 | crates/zeroclaw-channels/src/matrix.rs:2208-2214 | crates/zeroclaw-channels/src/matrix.rs:2224-2230 | crates/zeroclaw-channels/src/notion.rs:116-125 | crates/zeroclaw-providers/src/gemini_cli.rs:155-161 | crates/zeroclaw-providers/src/gemini_cli.rs:168-174 | crates/zeroclaw-providers/src/gemini_cli.rs:202-208 | crates/zeroclaw-providers/src/gemini_cli.rs:230-236 | crates/zeroclaw-providers/src/kilocli.rs:152-158 | crates/zeroclaw-providers/src/kilocli.rs:165-171 | crates/zeroclaw-providers/src/kilocli.rs:199-205 | crates/zeroclaw-providers/src/kilocli.rs:227-233 | crates/zeroclaw-providers/src/openai_codex.rs:1067-1073 | crates/zeroclaw-providers/src/openai_codex.rs:1146-1152 | crates/zeroclaw-tools/src/web_fetch.rs:274-280 | crates/zeroclaw-tools/src/web_fetch.rs:302-308 — before extracting anything, compare `crates/zeroclaw-channels/src/matrix.rs` and `crates/zeroclaw-tools/src/web_fetch.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 (7 lines × 11) crates/zeroclaw-config/src/schema/v2.rs:3923— crates/zeroclaw-config/src/schema/v2.rs:3923-3929 | crates/zeroclaw-config/src/schema/v2.rs:3966-3972 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-config/src/schema/v2.rs:3923` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-config/src/schema/v2.rs:3965` calls `query` and `crates/zeroclaw-config/src/schema/v2.rs:3922` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 37) crates/zeroclaw-channels/src/slack.rs:3431— crates/zeroclaw-channels/src/slack.rs:3431-3435 | crates/zeroclaw-channels/src/transcription.rs:78-82 | crates/zeroclaw-config/src/env_overrides.rs:216-221 | crates/zeroclaw-config/src/schema.rs:12476-12481 | crates/zeroclaw-config/src/schema.rs:12563-12568 | crates/zeroclaw-hardware/src/device.rs:471-475 | crates/zeroclaw-hardware/src/device.rs:491-495 | crates/zeroclaw-providers/src/auth/profiles.rs:243-247 | crates/zeroclaw-providers/src/models_dev.rs:79-83 | crates/zeroclaw-providers/src/openrouter.rs:533-537 | crates/zeroclaw-runtime/src/sop/engine.rs:2408-2413 | crates/zeroclaw-runtime/src/sop/engine.rs:2580-2584 | crates/zeroclaw-runtime/src/sop/engine.rs:2891-2895 | crates/zeroclaw-runtime/src/sop/engine.rs:4083-4088 | crates/zeroclaw-runtime/src/sop/engine.rs:4751-4756 | crates/zeroclaw-runtime/src/sop/engine.rs:5085-5089 | crates/zeroclaw-runtime/src/sop/engine.rs:5657-5661 | crates/zeroclaw-runtime/src/sop/engine.rs:6063-6067 | crates/zeroclaw-runtime/src/tools/security_ops.rs:148-153 | crates/zeroclaw-tools/src/browser_open.rs:278-283 | crates/zeroclaw-tools/src/browser_open.rs:290-294 | crates/zeroclaw-tools/src/mcp_client.rs:1260-1264 | crates/zeroclaw-tools/src/model_routing_config.rs:205-209 | crates/zeroclaw-tools/src/model_routing_config.rs:301-306 | crates/zeroclaw-tools/src/model_routing_config.rs:345-350 | crates/zeroclaw-tools/src/model_routing_config.rs:376-380 | crates/zeroclaw-tools/src/model_routing_config.rs:398-402 | crates/zeroclaw-tools/src/model_routing_config.rs:430-434 | crates/zeroclaw-tools/src/model_routing_config.rs:462-466 | crates/zeroclaw-tools/src/model_routing_config.rs:490-494 | crates/zeroclaw-tools/src/proxy_config.rs:107-111 | crates/zeroclaw-tools/src/proxy_config.rs:138-143 | crates/zeroclaw-tools/src/proxy_config.rs:278-282 | src/main.rs:10113-10121 | src/main.rs:12956-12960 | src/skills/mod.rs:1187-1192 | src/sop/mod.rs:137-141 — before extracting anything, compare `crates/zeroclaw-channels/src/slack.rs` and `crates/zeroclaw-channels/src/transcription.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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/slack.rs:3431` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `alias` to `&str` in one and `String` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (6 lines × 21) crates/zeroclaw-channels/src/lark.rs:1821— crates/zeroclaw-channels/src/lark.rs:1821-1828 | crates/zeroclaw-channels/src/lark.rs:3775-3782 | crates/zeroclaw-channels/src/lark.rs:3788-3795 | crates/zeroclaw-channels/src/qq.rs:419-426 | crates/zeroclaw-channels/src/qq.rs:531-538 | crates/zeroclaw-channels/src/twitter.rs:110-117 | crates/zeroclaw-tools/src/browser.rs:1552-1557 | crates/zeroclaw-tools/src/browser.rs:2372-2377 | crates/zeroclaw-tools/src/browser.rs:2399-2406 | crates/zeroclaw-tools/src/browser.rs:2416-2423 | crates/zeroclaw-tools/src/browser.rs:2427-2432 | crates/zeroclaw-tools/src/browser.rs:2443-2450 | crates/zeroclaw-tools/src/browser.rs:2454-2459 | crates/zeroclaw-tools/src/browser.rs:2470-2477 | crates/zeroclaw-tools/src/browser.rs:2534-2539 | crates/zeroclaw-tools/src/browser.rs:2547-2554 | crates/zeroclaw-tools/src/browser.rs:2564-2571 | crates/zeroclaw-tools/src/browser.rs:2585-2592 | crates/zeroclaw-tools/src/browser.rs:2602-2607 | crates/zeroclaw-tools/src/browser.rs:2611-2616 | crates/zeroclaw-tools/src/browser.rs:2621-2628 — there are 21 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 21 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/lark.rs:1821` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/twitter.rs:109` calls `and_then`, `get` and `crates/zeroclaw-channels/src/lark.rs:1820` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (4–6 lines × 20) crates/zeroclaw-channels/src/orchestrator/mod.rs:13212— crates/zeroclaw-channels/src/orchestrator/mod.rs:13212-13215 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13256-13261 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13300-13305 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13348-13353 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13384-13389 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13523-13528 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13548-13553 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13579-13584 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13606-13611 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13676-13681 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13706-13711 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13750-13755 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13794-13799 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13817-13822 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13840-13845 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13872-13877 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13898-13903 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13921-13926 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13940-13945 | crates/zeroclaw-channels/src/orchestrator/mod.rs:13983-13988 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:13212` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `crates/zeroclaw-channels/src/orchestrator/mod.rs:13210` calls `context`, `unwrap_or`, `to_string` and `crates/zeroclaw-channels/src/orchestrator/mod.rs:13256` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 18) crates/zeroclaw-channels/src/orchestrator/mod.rs:14915— crates/zeroclaw-channels/src/orchestrator/mod.rs:14915-14919 | crates/zeroclaw-channels/src/orchestrator/mod.rs:14985-14989 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15130-15134 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15335-15339 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15425-15429 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15450-15454 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15485-15489 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15529-15533 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15594-15598 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15632-15636 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15674-15678 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15724-15728 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15763-15767 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15807-15811 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15842-15846 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15887-15891 | crates/zeroclaw-channels/src/orchestrator/mod.rs:15924-15928 | crates/zeroclaw-channels/src/orchestrator/mod.rs:16021-16025 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/orchestrator/mod.rs:14915` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (1–5 lines × 5) crates/zeroclaw-channels/src/telegram.rs:5236— crates/zeroclaw-channels/src/telegram.rs:5236-5240 | crates/zeroclaw-gateway/src/api_upload.rs:146-150 | crates/zeroclaw-runtime/src/agent/agent.rs:3325-3325 | crates/zeroclaw-runtime/src/agent/agent.rs:3326-3326 | 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. Read the line range as the matched WINDOW rather than a finished unit: at `crates/zeroclaw-channels/src/telegram.rs:5236` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
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.
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-tools/src/notion_tool.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-sop-graph/src/lib.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-tools/src/microsoft365/auth.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-tools/src/microsoft365/graph_client.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/routines/engine.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/sop/binding.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-hardware/src/loader.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/api_personality.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-memory/src/chunker.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-hardware/src/tool_registry.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/rag/mod.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-config/src/schema/v1.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 apps/zerocode/src/color_depth.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-config/src/api_error.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-runtime/src/tools/param_options.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/tunnel/openvpn.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-tools/src/memory_store.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-tools/src/mcp_protocol.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/tunnel/pinggy.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 apps/zerocode/src/clipboard.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.
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/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:204— `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:150— `!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:657— `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:664— `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:8031— `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:4345— `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.
Duplicated predicate apps/zerocode/src/quickstart_pane.rs:284— `col >= r.x && col < r.x + r.width && row >= r.y && row < r.y + r.height` appears character-identically in 2 files — apps/zerocode/src/quickstart_pane.rs, REDACTED. 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.
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:23295— `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:23343— `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:23384— `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:943— `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:988— `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:1217— `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:1235— `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:1642— `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:1694— `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:1752— `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:371— `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:3408— `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.
Silent fallback default on Err crates/zeroclaw-providers/src/openai.rs:1289— `streaming_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.
+ 6 more in this group — see findings.md.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×11
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:15607— `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:3692— `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:3693— `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.
Silent fallback default in catch web/src/pages/AgentChat.tsx:253— `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, 30 significant file(s) lose their only recent owner: apps/zerorelay/src/lib.rs, crates/zeroclaw-runtime/src/relay.rs, crates/zeroclaw-runtime/src/security/auth_provider/enrollment.rs, crates/zeroclaw-runtime/src/rpc/auth.rs, src/relay_cli.rs, apps/zerorelay/src/frontdoor.rs, apps/zerorelay/src/frontdoor_assets.rs, crates/zeroclaw-runtime/src/cron/outbox.rs (+22 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 15 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 (+7 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 15 significant file(s) lose their only recent owner: crates/zeroclaw-runtime/src/hooks/builtin/webhook_audit.rs, crates/zeroclaw-config/src/secrets/windows_key_file.rs, xtask/src/cmd/mdbook/check.rs, crates/zeroclaw-memory/src/sqlite_permissions.rs, crates/zeroclaw-runtime/src/tools/delegate_progress.rs, crates/zeroclaw-gateway/src/nodes/mdns.rs, apps/zerocode/src/text_selection.rs, apps/zerocode/src/chat/transcript_layout.rs (+7 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 5 significant file(s) lose their only recent owner: crates/zeroclaw-tools/src/canvas.rs, xtask/src/cmd/mdbook/themes.rs, crates/zeroclaw-runtime/src/rpc/git.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 (76 single-owned of 869 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; 869 of the 1081 production source files in this repository met that bar). They are anonymized user #6 (2 file(s)), anonymized user #7 (2 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-log/src/log_bridge.rs, crates/zeroclaw-api/src/turn_stop.rs, crates/zeroclaw-hardware/src/manifest.rs, crates/zeroclaw-hardware/src/protocol.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.
D20 · ADR Quality· ADR still proposed, but the code already adopted it · ×1
ADR still proposed, but the code already adopted it docs/book/src/architecture/decisions/ADR-006-runtime-channel-plugins.md:5— docs/book/src/architecture/decisions/ADR-006-runtime-channel-plugins.md:5 says "proposed", but the production code already uses every element its Decision names: `Channel` (apps/zerocode/src/quickstart_pane.rs). A proposal the code has adopted is a decision in force; mark it accepted, or, if the code should not do this, say so.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 9 of 36 project(s) overshoot their size bounds, lowering Project Cohesion to 5.0/10. The most over is `crates/zeroclaw-runtime` (407761 LoC, 900 module-visible types across 40 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.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×1
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×1
REDACTED
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 55 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: crates/zeroclaw-runtime/src/security/playbook.rs, crates/zeroclaw-tools/src/notion_tool.rs, crates/zeroclaw-sop-graph/src/lib.rs, crates/zeroclaw-tools/src/microsoft365/auth.rs, crates/zeroclaw-tools/src/microsoft365/graph_client.rs, crates/zeroclaw-runtime/src/routines/engine.rs, crates/zeroclaw-runtime/src/sop/binding.rs, crates/zeroclaw-runtime/src/security/estop.rs (and 47 more) (68 orphaned of 869 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; 869 of the 1081 production source files in this repository met that bar). 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.
P3 · Security & performance tooling· Dependabot does not watch pip/gitsubmodule · ×1
Dependabot does not watch pip/gitsubmodule .github/dependabot.yml:3— `.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, `gitsubmodule`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list.
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.44 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.11 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: log — `log` is locked at 0.4.34 but 0.4.35 is the current stable release on crates.io, and it already satisfies the `"0.4"` requirement declared in crates/zeroclaw-log/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p log` 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: prost — `prost` is locked at 0.14.4 but 0.14.6 is the current stable release on crates.io, and it already satisfies the `"0.14"` requirement declared in crates/zeroclaw-channels/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p prost` 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: 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: rustls-pki-types — `rustls-pki-types` is locked at 1.15.1 but 1.16.0 is the current stable release on crates.io, and it already satisfies the `"1.14.0"` requirement declared in crates/zeroclaw-channels/Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p rustls-pki-types` 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.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-plugin-single-instance` and commit the updated REDACTED.
Outdated: tauri-plugin-store — `tauri-plugin-store` is locked at 2.4.4 but 2.5.1 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.
+ 10 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.
Run 01a1d894-5431-7f41-9dc9-64c5b474162e · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 98 · Warnings: 4408 · Recommendations: 179 · Info: 35 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 05:42 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.