Public report of Timwood0x10/ARES, published 22 October 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.10.5). Watchdog 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, 22 October 2026, 06:42 UTC · Survey ID cd_cb9beb71fc8f4a96923ad71d4d7643dd

Timwood0x10/ARES

Measured 22 October 2026, 06:36 UTC, at code version 11d7fa3

CAI score 58out of 100 At risk Down 7 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 large codebase: 183,921 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 3.5 person-years · Weakest lens: Maturity, 50

Findings by how serious they are

72 critical 971 serious 121 minor

17 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
22 October 2026, 06:36 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

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. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

66of 70 dimensions measured by tools. The other 4 are advisory notes from an AI model, which explain the code but don't count towards the score.
1139of 1164 findings point to an exact file and line, so you can open each one in the code. The other 25 concern the repository as a whole, such as missing documentation.
70dimensions across 8 lenses, read from 183,921 lines of product code in 2 projects.
Chapters

Executive summary

Timwood0x10/ARES scores 58 out of 100, but it is rated At risk while a critical security finding is open; the score itself is unchanged. The project hasn't declared a stable release yet, so its lenses are rated against a lower bar than a released product's, while the score itself is worked out as for any repository.

The weakest lens counts most in the score, and here that is Maturity, which scores 50 and is rated Adequate. Its Documentation accuracy dimension scores 0 out of 10, and until that reaches 4, Maturity can't be rated higher than Adequate. The first actions are to resolve the 1 No ADRs found finding(s) in ADR Quality and to reconcile the README with reality: README.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists; README.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist; README.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists; README.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists; README_CN.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists, and if Maturity rose to 70, the score would rise from 58 to about 63.

72 findings are critical: 52 in Static Analysis (SAST), nine in Secrets (history), eight in Dependency Vulnerabilities and three in IaC & Container Security.

Watchdog couldn't measure 17 dimensions in this code, among them Code Coverage, Internal API Consistency and Navigability, so they are left out of the score. The product code is 183,921 lines, which would take an estimated 3.5 person-years, around €510,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 for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Maturity 50 · counts for 45%Security and Compliance 51 · counts for 25%Code Health 68 · counts for 14%Accessibility 74 · counts for 8%Production Readiness 83 · counts for 4%Performance 90 · counts for 2%Architecture 92 · counts for 1%Event Sourcing 100 · counts for 1%

If Maturity rose from 50 to 70, the lowest score rated Strong, the score would rise from 58 to about 63.

Code composition: what the lines of code are
Product code 47%Tests 53%
New since the last survey: 160 findings

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

  • Cyclomatic Complexity · Fabric.recordWithExtrasLocked (cyclomatic 29) internal/fabric/task/fabric_events.go
  • Cyclomatic Complexity · actionHandler.handleSubmitTask (cyclomatic 23) cmd/ares/agent_routes_tasks.go
  • Cyclomatic Complexity · ares_bootstrap.wireRetrievers (cyclomatic 22) internal/ares_bootstrap/retriever_wiring.go
  • Cyclomatic Complexity · ares_bootstrap.buildRegressionGate (cyclomatic 21) internal/ares_bootstrap/regression_gate_wiring.go
  • Cyclomatic Complexity · DefaultEntityMatcher.MatchTokens (cyclomatic 21) internal/knowledge/pipeline/normalizer.go
  • Cyclomatic Complexity · Fabric.ReclaimIdle (cyclomatic 20) internal/fabric/agent/reclaim.go
  • Cyclomatic Complexity · main.runLiveChaosInjection (cyclomatic 17) cmd/ares/serve_chaos_domain.go
  • Cyclomatic Complexity · ares_bootstrap.wireLifecycleGates (cyclomatic 17) internal/ares_bootstrap/bootstrap_evolution.go
  • Cyclomatic Complexity · DistillBridge.DistillConversationWithReport (cyclomatic 17) internal/knowledge/adapter/distill.go
  • Cyclomatic Complexity · ares_bootstrap.wireMemory (cyclomatic 16) internal/ares_bootstrap/bootstrap.go
  • Cyclomatic Complexity · answerCognition.ExecuteStep (cyclomatic 16) internal/fabric/agent/l2graph.go
  • Cyclomatic Complexity · LLMArenaScorer.ScoreBatch (cyclomatic 16) internal/runtime/ares_evolution/service/llm_arena_scorer.go
  • Cyclomatic Complexity · eval.ReplayGolden (cyclomatic 16) internal/runtime/eval/replay.go
  • Cyclomatic Complexity · EmbeddingConfig.Validate (cyclomatic 16) internal/storage/postgres/config.go
  • Cognitive Complexity · Fabric.recordWithExtrasLocked (cognitive 53) internal/fabric/task/fabric_events.go
  • Cognitive Complexity · DefaultEntityMatcher.MatchTokens (cognitive 33) internal/knowledge/pipeline/normalizer.go
  • Cognitive Complexity · Fabric.ReclaimIdle (cognitive 30) internal/fabric/agent/reclaim.go
  • Cognitive Complexity · actionHandler.handleSubmitTask (cognitive 29) cmd/ares/agent_routes_tasks.go
  • Cognitive Complexity · eval.ReplayGolden (cognitive 24) internal/runtime/eval/replay.go
  • Cognitive Complexity · LLMArenaScorer.ScoreBatch (cognitive 23) internal/runtime/ares_evolution/service/llm_arena_scorer.go
  • Cognitive Complexity · DistillBridge.DistillConversationWithReport (cognitive 21) internal/knowledge/adapter/distill.go
  • Cognitive Complexity · UngatedPatcher.Evaluate (cognitive 21) internal/runtime/evolution/coordinator/coordinator.go
  • Cognitive Complexity · main.runLiveChaosInjection (cognitive 20) cmd/ares/serve_chaos_domain.go
  • Cognitive Complexity · agentruntime.AwaitSessionResult (cognitive 20) internal/agentruntime/await.go
  • Cognitive Complexity · Fabric.AuditOrphans (cognitive 19) internal/fabric/agent/orphan_audit.go
  • Cognitive Complexity · Fabric.ResumableTasks (cognitive 19) internal/fabric/task/dag.go
  • Cognitive Complexity · memorystore.cloneObject (cognitive 19) internal/knowledge/store/memory/store.go
  • Cognitive Complexity · ares_bootstrap.buildEvalGate (cognitive 18) internal/ares_bootstrap/eval_gate_wiring.go
  • Cognitive Complexity · answerCognition.ExecuteStep (cognitive 18) internal/fabric/agent/l2graph.go
  • Cognitive Complexity · snapshotStore.save (cognitive 18) internal/fabric/agent/snapshot.go
  • Cognitive Complexity · KnowledgeRepository.searchByVectorQuery (cognitive 18) internal/storage/postgres/repositories/knowledge_repository.go
  • Cognitive Complexity · ares_bootstrap.wireMemory (cognitive 17) internal/ares_bootstrap/bootstrap.go
  • Cognitive Complexity · mcpHealthJoin.resolve (cognitive 17) internal/ares_bootstrap/provide_mcp.go
  • Cognitive Complexity · Fabric.ReapRetired (cognitive 17) internal/fabric/agent/reap.go
  • Cognitive Complexity · Store.Query (cognitive 17) internal/knowledge/store/sqlite/store.go
  • Cognitive Complexity · ares_bootstrap.ProvideEvolution (cognitive 16) internal/ares_bootstrap/provide_evolution.go
  • Cognitive Complexity · plannerCognition.advertisedToolSchemas (cognitive 16) internal/fabric/agent/planner_cognition.go
  • Cognitive Complexity · Fabric.cascadeFailureLocked (cognitive 16) internal/fabric/task/dag.go
  • Cognitive Complexity · Fabric.blastRadiusLocked (cognitive 16) internal/fabric/task/fabric_lifecycle.go
  • Cognitive Complexity · DistillBridge.persistAndPromote (cognitive 16) internal/knowledge/adapter/distill.go
  • Cognitive Complexity · pipeline.sourceIDMatch (cognitive 16) internal/knowledge/pipeline/normalizer.go
  • Cognitive Complexity · EvalHarness.runCase (cognitive 16) internal/knowledge/retriever/eval.go
  • Cognitive Complexity · GenomePopulationAdapter.baseRunScorer (cognitive 16) internal/runtime/ares_evolution/genome_wiring_run.go
  • Cognitive Complexity · RuntimeObserver.eventToSample (cognitive 16) internal/runtime/ares_evolution/observer.go
  • Cognitive Complexity · memory.trimToTokenBudget (cognitive 16) internal/runtime/memory/token_budget.go
  • God Classes · FunctionTooLong: main.runKernelRecoveryLoop cmd/ares/kernel_loop.go
  • God Classes · TooManyMethods: actionHandler cmd/ares/agent.go
  • God Classes · FileTooLong: postgres/store.go internal/knowledge/store/postgres/store.go
  • God Classes · FileTooLong: genome/population.go internal/runtime/ares_evolution/genome/population.go
  • Code Duplication · Near-duplicate member pair (32 shared lines) internal/knowledge/store/postgres/store.go
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) internal/fabric/task/fabric_lifecycle.go
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (30 lines × 2) internal/runtime/ares_evolution/scoring/memory_aware_scorer.go
  • Code Duplication · Duplicated block (22 lines × 2) internal/runtime/memory/manager_impl.go
  • Code Duplication · Duplicated block (21 lines × 2) internal/runtime/ares_evolution/scoring/tiered_scorer.go
  • Code Duplication · Duplicated block (19–20 lines × 3) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (19–20 lines × 3) internal/knowledge/store/sqlite/store.go
  • Code Duplication · Duplicated block (20 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (18 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (17 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (16 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (13 lines × 4) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (13 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (12 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (11 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (10 lines × 6) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (10 lines × 2) internal/fabric/agent/planner_cognition.go
  • Code Duplication · Duplicated block (10 lines × 2) internal/fabric/task/checkpoint_schema.go
  • Code Duplication · Duplicated block (9 lines × 3) cmd/ares/agent_routes_interrupts.go
  • Code Duplication · Duplicated block (8 lines × 6) internal/fabric/task/fabric_lifecycle.go
  • Code Duplication · Duplicated block (7 lines × 3) internal/fabric/task/fabric_lifecycle.go
  • Code Duplication · Duplicated block (7 lines × 2) internal/agents/sub/agent.go
  • Code Duplication · Duplicated block (6 lines × 2) internal/fabric/task/fabric_lifecycle.go
  • Code Duplication · Duplicated block (8 lines × 6) internal/fabric/agent/reclaim.go
  • Code Duplication · Duplicated block (11 lines × 2) cmd/ares/knowledge_store.go
  • Code Duplication · Duplicated block (6 lines × 2) internal/storage/postgres/vector_index.go
  • Code Duplication · Duplicated block (7 lines × 6) internal/llm/chat.go
  • Churn × Complexity Hotspots · Hotspot: internal/ares_bootstrap/bootstrap.go internal/ares_bootstrap/bootstrap.go
  • Churn × Complexity Hotspots · Hotspot: internal/agentsyscall/syscall.go internal/agentsyscall/syscall.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/agent/planner_cognition.go internal/fabric/agent/planner_cognition.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/task/restore.go internal/fabric/task/restore.go
  • Churn × Complexity Hotspots · Hotspot: cmd/ares/kernel_loop.go cmd/ares/kernel_loop.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/task/workflow_plan.go internal/fabric/task/workflow_plan.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/agent/l2graph.go internal/fabric/agent/l2graph.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/genome_wiring_run.go internal/runtime/ares_evolution/genome_wiring_run.go
  • Churn × Complexity Hotspots · Hotspot: cmd/ares/agent.go cmd/ares/agent.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/fitness_aggregator.go internal/runtime/ares_evolution/fitness_aggregator.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/task/workflow/graph/patcher.go internal/fabric/task/workflow/graph/patcher.go
  • Churn × Complexity Hotspots · Hotspot: internal/kernel/scheduler_execute.go internal/kernel/scheduler_execute.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/task/fabric_events.go internal/fabric/task/fabric_events.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/task/workflow/engine/reloader.go internal/fabric/task/workflow/engine/reloader.go
  • Churn × Complexity Hotspots · Hotspot: internal/llm/chat.go internal/llm/chat.go
  • Churn × Complexity Hotspots · Hotspot: internal/kernel/orchestrator.go internal/kernel/orchestrator.go
  • Churn × Complexity Hotspots · Hotspot: sdk/agent.go sdk/agent.go
  • Churn × Complexity Hotspots · Hotspot: cmd/ares/serve_peer.go cmd/ares/serve_peer.go
  • Churn × Complexity Hotspots · Hotspot: internal/knowledge/pipeline/normalizer.go internal/knowledge/pipeline/normalizer.go
  • Churn × Complexity Hotspots · Hotspot: internal/tools/resources/builtin/memory/memory_tools.go internal/tools/resources/builtin/memory/memory_tools.go
  • Churn × Complexity Hotspots · Hotspot: internal/introspect/web/panel.html internal/introspect/web/panel.html
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/gate_eval.go internal/runtime/ares_evolution/gate_eval.go
  • Churn × Complexity Hotspots · Hotspot: internal/fabric/task/workflow/engine/dag_patcher.go internal/fabric/task/workflow/engine/dag_patcher.go

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

Fixed since the last survey: 206 findings

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

  • Cyclomatic Complexity · Validator.validateValue (cyclomatic 40) internal/llm/output/validator.go
  • Cyclomatic Complexity · output.scanFixJSON (cyclomatic 33) internal/llm/output/parser.go
  • Cyclomatic Complexity · DreamCycle.deployWinner (cyclomatic 26) internal/runtime/ares_evolution/dream_cycle_evolve.go
  • Cyclomatic Complexity · OpenAIAdapter.GenerateStream (cyclomatic 25) internal/llm/output/openai.go
  • Cyclomatic Complexity · OpenRouterAdapter.GenerateStream (cyclomatic 23) internal/llm/output/openrouter.go
  • Cyclomatic Complexity · OllamaAdapter.GenerateStream (cyclomatic 20) internal/llm/output/ollama.go
  • Cyclomatic Complexity · Runtime.submitThroughL2 (cyclomatic 19) sdk/l2_submit.go
  • Cyclomatic Complexity · main.executeAskViaSession (cyclomatic 18) cmd/ares/evolution.go
  • Cyclomatic Complexity · RetrievalService.GenerateDebugInfo (cyclomatic 17) internal/storage/postgres/services/retrieval_helpers.go
  • Cyclomatic Complexity · RetrievalService.applySourceSignals (cyclomatic 17) internal/storage/postgres/services/retrieval_search.go
  • Cyclomatic Complexity · Fabric.recordLocked (cyclomatic 16) internal/fabric/task/fabric_events.go
  • Cognitive Complexity · Validator.validateValue (cognitive 83) internal/llm/output/validator.go
  • Cognitive Complexity · output.scanFixJSON (cognitive 58) internal/llm/output/parser.go
  • Cognitive Complexity · OpenAIAdapter.GenerateStream (cognitive 31) internal/llm/output/openai.go
  • Cognitive Complexity · Runtime.submitThroughL2 (cognitive 29) sdk/l2_submit.go
  • Cognitive Complexity · OllamaAdapter.GenerateStream (cognitive 28) internal/llm/output/ollama.go
  • Cognitive Complexity · OpenRouterAdapter.GenerateStream (cognitive 28) internal/llm/output/openrouter.go
  • Cognitive Complexity · RetrievalService.applySourceSignals (cognitive 28) internal/storage/postgres/services/retrieval_search.go
  • Cognitive Complexity · main.taskFromPayload (cognitive 26) cmd/ares/kernel_dispatch.go
  • Cognitive Complexity · main.executeAskViaSession (cognitive 25) cmd/ares/evolution.go
  • Cognitive Complexity · main.wireLiveDAGAndCompile (cognitive 25) cmd/ares/serve_peer.go
  • Cognitive Complexity · Fabric.recordLocked (cognitive 22) internal/fabric/task/fabric_events.go
  • Cognitive Complexity · RetrievalService.GenerateDebugInfo (cognitive 20) internal/storage/postgres/services/retrieval_helpers.go
  • Cognitive Complexity · DistillBridge.DistillConversation (cognitive 19) internal/knowledge/adapter/distill.go
  • Cognitive Complexity · KnowledgeRepository.SearchByVector (cognitive 19) internal/storage/postgres/repositories/knowledge_repository.go
  • Cognitive Complexity · output.findMatchingBracket (cognitive 17) internal/llm/output/parser.go
  • Cognitive Complexity · GenomePopulationAdapter.buildRunScorer (cognitive 16) internal/runtime/ares_evolution/genome_wiring_run.go
  • Cognitive Complexity · EvolutionScheduler.shouldEvolve (cognitive 16) internal/runtime/ares_evolution/scheduler.go
  • Cognitive Complexity · RetrievalService.markQueryCached (cognitive 16) internal/storage/postgres/services/retrieval_rewrite.go
  • God Classes · TooManyMethods: RetrievalService internal/storage/postgres/services/retrieval_service.go
  • God Classes · MethodTooLong: Config.setDefaults internal/ares_config/config_defaults.go
  • God Classes · MethodTooLong: DreamCycle.deployWinner internal/runtime/ares_evolution/dream_cycle_evolve.go
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) internal/fabric/task/fabric_lifecycle.go
  • Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) internal/knowledge/store/postgres/store.go
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) internal/storage/postgres/services/retrieval_search.go
  • Code Duplication · Duplicated block (74 lines × 2) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (30 lines × 2) internal/runtime/ares_evolution/scoring/memory_aware_scorer.go
  • Code Duplication · Duplicated block (25–27 lines × 2) internal/runtime/memory/distillation/resolver.go
  • Code Duplication · Duplicated block (20 lines × 2) internal/runtime/ares_evolution/genome/adaptive.go
  • Code Duplication · Duplicated block (15–17 lines × 3) internal/llm/client.go
  • Code Duplication · Duplicated block (15–17 lines × 2) internal/llm/output/parser.go
  • Code Duplication · Duplicated block (16 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (16 lines × 2) internal/runtime/memory/manager_impl.go
  • Code Duplication · Duplicated block (15 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (15 lines × 2) internal/llm/output/parser.go
  • Code Duplication · Duplicated block (14 lines × 2) internal/llm/output/parser.go
  • Code Duplication · Duplicated block (12–13 lines × 6) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (13 lines × 3) internal/llm/output/ollama.go
  • Code Duplication · Duplicated block (13 lines × 3) internal/llm/output/parser.go
  • Code Duplication · Duplicated block (13 lines × 2) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (13 lines × 2) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (13 lines × 2) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (12 lines × 2) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (11 lines × 2) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (10 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (10 lines × 2) internal/storage/postgres/services/retrieval_search.go
  • Code Duplication · Duplicated block (9 lines × 3) internal/llm/output/ollama.go
  • Code Duplication · Duplicated block (9 lines × 3) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (9 lines × 2) internal/knowledge/store/postgres/store.go
  • Code Duplication · Duplicated block (8 lines × 6) internal/fabric/task/fabric_lifecycle.go
  • Code Duplication · Duplicated block (8 lines × 2) internal/llm/output/openrouter.go
  • Code Duplication · Duplicated block (8 lines × 2) internal/storage/postgres/services/retrieval_service.go
  • Code Duplication · Duplicated block (8 lines × 2) internal/storage/postgres/services/simple_retrieval_service.go
  • Code Duplication · Duplicated block (7 lines × 3) internal/llm/client.go
  • Code Duplication · Duplicated block (7 lines × 2) internal/agents/sub/agent.go
  • Code Duplication · Duplicated block (7 lines × 2) internal/llm/output/openrouter.go
  • Code Duplication · Duplicated block (7 lines × 2) internal/storage/postgres/services/retrieval_service.go
  • Code Duplication · Duplicated block (8 lines × 4) internal/kernel/registry.go
  • Code Duplication · Duplicated block (7 lines × 4) internal/llm/output/schema.go
  • Code Duplication · Duplicated block (7 lines × 2) internal/llm/output/timeout.go
  • Code Duplication · Duplicated block (11 lines × 2) internal/storage/postgres/services/retrieval_search.go
  • Code Duplication · Duplicated block (11 lines × 2) internal/llm/output/template.go
  • Code Duplication · Duplicated block (9 lines × 5) internal/storage/postgres/services/retrieval_search.go
  • Code Duplication · Duplicated block (9 lines × 2) cmd/ares/evolution.go
  • Code Duplication · Duplicated block (9 lines × 2) internal/llm/output/openai.go
  • Code Duplication · Duplicated block (9 lines × 3) internal/storage/postgres/services/simple_retrieval_service.go
  • Code Duplication · Duplicated block (9 lines × 3) internal/storage/postgres/services/retrieval_service.go
  • Code Duplication · Duplicated block (7 lines × 3) internal/llm/generate.go
  • Code Duplication · Duplicated block (5 lines × 2) internal/llm/output/ollama.go
  • Cohesion (LCOM4) · Low cohesion: Validator (LCOM4 7) internal/llm/output/validator.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/arena/service.go internal/runtime/arena/service.go
  • Churn × Complexity Hotspots · Hotspot: internal/storage/postgres/repositories/knowledge_repository.go internal/storage/postgres/repositories/knowledge_repository.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/genome/adaptive.go internal/runtime/ares_evolution/genome/adaptive.go
  • Churn × Complexity Hotspots · Hotspot: internal/llm/output/openai.go internal/llm/output/openai.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/arena/regression.go internal/runtime/arena/regression.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/arena/scenario.go internal/runtime/arena/scenario.go
  • Churn × Complexity Hotspots · Hotspot: internal/ares_events/pg_store.go internal/ares_events/pg_store.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/genome/population_guard.go internal/runtime/ares_evolution/genome/population_guard.go
  • Churn × Complexity Hotspots · Hotspot: internal/llm/output/openrouter.go internal/llm/output/openrouter.go
  • Churn × Complexity Hotspots · Hotspot: internal/ares_events/memory_store.go internal/ares_events/memory_store.go
  • Churn × Complexity Hotspots · Hotspot: internal/llm/output/ollama.go internal/llm/output/ollama.go
  • Churn × Complexity Hotspots · Hotspot: cmd/ares/evolution.go cmd/ares/evolution.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/protocol/mcp/transport_sse.go internal/runtime/protocol/mcp/transport_sse.go
  • Churn × Complexity Hotspots · Hotspot: internal/tools/planner/bridge.go internal/tools/planner/bridge.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/report.go internal/runtime/ares_evolution/report.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/mutation/guided_mutator.go internal/runtime/ares_evolution/mutation/guided_mutator.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/ares_evolution/genome/meta_evolution.go internal/runtime/ares_evolution/genome/meta_evolution.go
  • Churn × Complexity Hotspots · Hotspot: internal/tools/planner/planner.go internal/tools/planner/planner.go
  • Churn × Complexity Hotspots · Hotspot: internal/discovery/engine.go internal/discovery/engine.go
  • Churn × Complexity Hotspots · Hotspot: internal/runtime/arena/survival.go internal/runtime/arena/survival.go
Rebuild cost: about €510,000 · Estimate
Cost to rebuild€170,000 to €840,000, for 2,796 to 8,869 hours of work, about 3.5 person-years for 2 to 7 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.8 at a score of 58. 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.
SizeLarge: 183,921 lines of product code

How the estimate is made: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Resolve the 1 No ADRs found finding(s) in ADR Quality.
Raises the score by about 6 points · Low effort · ADR Quality
2
Reconcile the README with reality: README.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists; README.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist; README.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists; README.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists; README_CN.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists.
Raises the score by about 6 points · Medium effort · Documentation accuracy
3
Resolve the 9 REDACTED finding(s) in Secrets (history) — start with REDACTED (6), REDACTED (3).
Raises the score by about 3 points · Low effort · Secrets (history)

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €510,000 to build again, about 3.5 person-years of work. Its weakest lens is Maturity, at 50 (Weak). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 6 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.2 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 610,217 lines over the last 90 days, which is about 2,474,769 lines a year. At that pace, the extra work comes to an estimated 123.7 to 824.9 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

138 modules, with 419 dependencies between them. 2 loops run through 46 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 98 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 com/Timwood0x10/ares/internal/core/models2 com/Timwood0x10/ares/internal/embedding3 com/Timwood0x10/ares/internal/knowledge4 com/Timwood0x10/ares/internal/llmcore5 com/Timwood0x10/ares/internal/runtime/ares_evolution/mutation6 com/Timwood0x10/ares/internal/runtime/evolution/patch7 com/Timwood0x10/ares/internal/agents/base8 com/Timwood0x10/ares/internal/fabric/task9 com/Timwood0x10/ares/internal/knowledge/provider10 com/Timwood0x10/ares/internal/runtime/ares_evolution/genome11 com/Timwood0x10/ares/internal/runtime/memory/context12 com/Timwood0x10/ares/internal/runtime/memory/distillation13 com/Timwood0x10/ares/internal/storage/postgres/repositories14 com/Timwood0x10/ares/internal/tools/resources/core15 com/Timwood0x10/ares/internal/knowledge/runtime16 com/Timwood0x10/ares/internal/runtime/ares_evolution/service17 com/Timwood0x10/ares/internal/runtime/memory18 com/Timwood0x10/ares/internal/runtime/memory/experience19 com/Timwood0x10/ares/internal/knowledge/adapter20 com/Timwood0x10/ares/internal/runtime21 com/Timwood0x10/ares/internal/runtime/evolution22 com/Timwood0x10/ares/internal/fabric/task/workflow/engine23 com/Timwood0x10/ares/internal/fabric/agent24 com/Timwood0x10/ares/internal/runtime/evolution/genome25 com/Timwood0x10/ares/internal/kernel26 com/Timwood0x10/ares/internal/agents/sub27 com/Timwood0x10/ares/internal/introspect28 com/Timwood0x10/ares/internal/agentruntime29 com/Timwood0x10/ares/internal/ares_bootstrap30 com/Timwood0x10/ares/internal/storage/postgres31 com/Timwood0x10/ares/internal/evidence32 com/Timwood0x10/ares/internal/runtime/arena33 com/Timwood0x10/ares/internal/ares_events34 com/Timwood0x10/ares/internal/runtime/ares_evolution35 com/Timwood0x10/ares/internal/runtime/observability36 com/Timwood0x10/ares/internal/llm37 com/Timwood0x10/ares/sdk38 com/Timwood0x10/ares/cmd/ares39 com/Timwood0x10/ares/internal/llmservice40 com/Timwood0x10/ares/api
1 com/Timwood0x10/ares/internal/core/models
2 com/Timwood0x10/ares/internal/embedding
3 com/Timwood0x10/ares/internal/knowledge
4 com/Timwood0x10/ares/internal/llmcore
5 com/Timwood0x10/ares/internal/runtime/ares_evolution/mutation
6 com/Timwood0x10/ares/internal/runtime/evolution/patch
7 com/Timwood0x10/ares/internal/agents/base41
8 com/Timwood0x10/ares/internal/fabric/task6
9 com/Timwood0x10/ares/internal/knowledge/provider3
10 com/Timwood0x10/ares/internal/runtime/ares_evolution/genome17
11 com/Timwood0x10/ares/internal/runtime/memory/context1242
12 com/Timwood0x10/ares/internal/runtime/memory/distillation22
13 com/Timwood0x10/ares/internal/storage/postgres/repositories8
14 com/Timwood0x10/ares/internal/tools/resources/core2
15 com/Timwood0x10/ares/internal/knowledge/runtime18432
16 com/Timwood0x10/ares/internal/runtime/ares_evolution/service3415
17 com/Timwood0x10/ares/internal/runtime/memory2233933
18 com/Timwood0x10/ares/internal/runtime/memory/experience322
19 com/Timwood0x10/ares/internal/knowledge/adapter2162211
20 com/Timwood0x10/ares/internal/runtime82117
21 com/Timwood0x10/ares/internal/runtime/evolution261321
22 com/Timwood0x10/ares/internal/fabric/task/workflow/engine2716
23 com/Timwood0x10/ares/internal/fabric/agent1010334
24 com/Timwood0x10/ares/internal/runtime/evolution/genome24457
25 com/Timwood0x10/ares/internal/kernel77322
26 com/Timwood0x10/ares/internal/agents/sub14355214
27 com/Timwood0x10/ares/internal/introspect2124
28 com/Timwood0x10/ares/internal/agentruntime38212314
29 com/Timwood0x10/ares/internal/ares_bootstrap24210121041663215318113125113622
30 com/Timwood0x10/ares/internal/storage/postgres71
31 com/Timwood0x10/ares/internal/evidence1
32 com/Timwood0x10/ares/internal/runtime/arena1123
33 com/Timwood0x10/ares/internal/ares_events45
34 com/Timwood0x10/ares/internal/runtime/ares_evolution229122438265
35 com/Timwood0x10/ares/internal/runtime/observability1
36 com/Timwood0x10/ares/internal/llm922
37 com/Timwood0x10/ares/sdk235232234135374653116314312
38 com/Timwood0x10/ares/cmd/ares81272113921111973475621
39 com/Timwood0x10/ares/internal/llmservice17121
40 com/Timwood0x10/ares/api1511292
Uses a module listed above itPart of a loopThe module itself
1 com/Timwood0x10/ares/internal/core/models2 com/Timwood0x10/ares/internal/embedding3 com/Timwood0x10/ares/internal/knowledge4 com/Timwood0x10/ares/internal/llmcore5 com/Timwood0x10/ares/internal/runtime/ares_evolution/mutation6 com/Timwood0x10/ares/internal/runtime/evolution/patch7 com/Timwood0x10/ares/internal/agents/base8 com/Timwood0x10/ares/internal/fabric/task9 com/Timwood0x10/ares/internal/knowledge/provider10 com/Timwood0x10/ares/internal/runtime/ares_evolution/genome11 com/Timwood0x10/ares/internal/runtime/memory/context12 com/Timwood0x10/ares/internal/runtime/memory/distillation13 com/Timwood0x10/ares/internal/storage/postgres/repositories14 com/Timwood0x10/ares/internal/tools/resources/core15 com/Timwood0x10/ares/internal/knowledge/runtime16 com/Timwood0x10/ares/internal/runtime/ares_evolution/service17 com/Timwood0x10/ares/internal/runtime/memory18 com/Timwood0x10/ares/internal/runtime/memory/experience19 com/Timwood0x10/ares/internal/knowledge/adapter20 com/Timwood0x10/ares/internal/runtime21 com/Timwood0x10/ares/internal/runtime/evolution22 com/Timwood0x10/ares/internal/fabric/task/workflow/engine23 com/Timwood0x10/ares/internal/fabric/agent24 com/Timwood0x10/ares/internal/runtime/evolution/genome25 com/Timwood0x10/ares/internal/kernel26 com/Timwood0x10/ares/internal/agents/sub27 com/Timwood0x10/ares/internal/introspect28 com/Timwood0x10/ares/internal/agentruntime29 com/Timwood0x10/ares/internal/ares_bootstrap30 com/Timwood0x10/ares/internal/storage/postgres31 com/Timwood0x10/ares/internal/evidence32 com/Timwood0x10/ares/internal/runtime/arena33 com/Timwood0x10/ares/internal/ares_events34 com/Timwood0x10/ares/internal/runtime/ares_evolution35 com/Timwood0x10/ares/internal/runtime/observability36 com/Timwood0x10/ares/internal/llm37 com/Timwood0x10/ares/sdk38 com/Timwood0x10/ares/cmd/ares39 com/Timwood0x10/ares/internal/llmservice40 com/Timwood0x10/ares/apicom/Timwood0x10/ares/internal/core/models1com/Timwood0x10/ares/internal/embedding2com/Timwood0x10/ares/internal/knowledge3com/Timwood0x10/ares/internal/llmcore4com/Timwood0x10/ares/internal/runtime/ares_evolution/mutation5com/Timwood0x10/ares/internal/runtime/evolution/patch6com/Timwood0x10/ares/internal/agents/base7com/Timwood0x10/ares/internal/fabric/task8com/Timwood0x10/ares/internal/knowledge/provider9com/Timwood0x10/ares/internal/runtime/ares_evolution/genome10com/Timwood0x10/ares/internal/runtime/memory/context11com/Timwood0x10/ares/internal/runtime/memory/distillation12com/Timwood0x10/ares/internal/storage/postgres/repositories13com/Timwood0x10/ares/internal/tools/resources/core14com/Timwood0x10/ares/internal/knowledge/runtime15com/Timwood0x10/ares/internal/runtime/ares_evolution/service16com/Timwood0x10/ares/internal/runtime/memory17com/Timwood0x10/ares/internal/runtime/memory/experience18com/Timwood0x10/ares/internal/knowledge/adapter19com/Timwood0x10/ares/internal/runtime20com/Timwood0x10/ares/internal/runtime/evolution21com/Timwood0x10/ares/internal/fabric/task/workflow/engine22com/Timwood0x10/ares/internal/fabric/agent23com/Timwood0x10/ares/internal/runtime/evolution/genome24com/Timwood0x10/ares/internal/kernel25com/Timwood0x10/ares/internal/agents/sub26com/Timwood0x10/ares/internal/introspect27com/Timwood0x10/ares/internal/agentruntime28com/Timwood0x10/ares/internal/ares_bootstrap29com/Timwood0x10/ares/internal/storage/postgres30com/Timwood0x10/ares/internal/evidence31com/Timwood0x10/ares/internal/runtime/arena32com/Timwood0x10/ares/internal/ares_events33com/Timwood0x10/ares/internal/runtime/ares_evolution34com/Timwood0x10/ares/internal/runtime/observability35com/Timwood0x10/ares/internal/llm36com/Timwood0x10/ares/sdk37com/Timwood0x10/ares/cmd/ares38com/Timwood0x10/ares/internal/llmservice39com/Timwood0x10/ares/api404163171242228218432341522339333222162211821172613212716101033424457773221435521421243821231424210121041663215318113125113622711112345229122438265192223523223413537465311631431281272113921111973475621171211511292+98 more modules (most-connected shown)

At a glance — Code Health · 68% · Adequate · gated by D2, X4 ·

At a glance — Architecture · 92% · Adequate · gated by D26 ·

At a glance — Maturity · 50% · Adequate · gated by M4 ·

At a glance — Readiness · 83% · Exemplary ·

At a glance — Security · 51% · Adequate · gated by D28, D29, D30, D36 ·

At a glance — Event Sourcing · 100% · Exemplary ·

At a glance — Accessibility · 74% · Strong ·

At a glance — Performance · 90% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A05:2025 — Injection64High / Critical
A03:2025 — Software Supply Chain Failures21High / Critical
A07:2025 — Authentication Failures10High / Critical
A02:2025 — Security Misconfiguration7High / Critical

Roadmap

First, address the nine historical secrets in server and config files to secure the codebase. Next, resolve the missing architecture decision records by documenting key design choices and their consequences. Then, fix the documentation accuracy by reconciling the README with the actual repository structure and adding a clear section on how to run tests.

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

Do thisHelpsEffortDimension
Resolve the 1 No ADRs found finding(s) in ADR Quality.+6.4 ptsLowADR Quality
Reconcile the README with reality: README.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists; README.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist; README.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists; README.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists; README_CN.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists.+5.9 ptsMediumDocumentation accuracy
Resolve the 9 REDACTED finding(s) in Secrets (history) — start with REDACTED (6), REDACTED (3).+2.5 ptsLowSecrets (history)
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+3.0 ptsMediumArchitecture documentation
Resolve the 2 Documentation finding(s) in Documentation Quality — start with README.md, system-internals.en.md.+1.1 ptsLowDocumentation Quality
Resolve the 18 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (8), REDACTED (3), REDACTED (3).+1.2 ptsMediumStatic Analysis (SAST)
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing.+0.8 ptsLowSupply-chain Provenance & Signing
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing.+0.8 ptsLowSupply-chain Provenance & Signing

File quality

Per-file score 0–10 — a quality signature. Of 322 files carrying findings, judged against the Preview bar: 2% slop · 11% mixed · 87% near-clean.

FileScoreBandWorst signal
REDACTED0.3SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED1.4SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.2SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.4MixedIaC & Container Security: High IaC: REDACTED
REDACTED3.9MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.0MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.1MixedSecrets (history): REDACTED: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedIaC & Container Security: High IaC: REDACTED
REDACTED5.3MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.4MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED5.7MixedStatic Analysis (SAST): Medium: REDACTED

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

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

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

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

Could not be resolved — 17

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 66 of 70 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.9 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 70 dimensions across the health lenses
D1D2D3D4D5D6D9D11D12D13D14D15D17D19D20D21D23D26D28D29D30D31D34D35D36D37D43D44AC3AC6AC7AX10AX2AX3AX4ES1M1M2M3M4P1P10P2P3P4P5P6P7PF1PF2PF3X1X12X13X14X15X17X19X2X21X22X23X24X25X26X27X28X3X30X4

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1139 of 1164 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurementLocal LLM◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a16253-4fb4-7198-838c-d8545f963d68.

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

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.go) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Go module (REDACTED/go.sum), but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its Go dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-contributor repository — bus factor is not applicable (1 contributor(s) across 708 commit(s) sampled, automation and bot accounts excluded). Concentration needs a team to concentrate: with one contributor there is nobody to spread the knowledge to, so there is nothing here for the owner to act on.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (REDACTED). compose up failed (exit 18 — an image could not be pulled) — ollama Pulling ollama Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the earlier `compose pull` step reported: ares-demo Skipped - No image to be pulled ollama Pulling ollama Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the runtime sandbox reaches registries only through the in-fence pull-through mirror, so an image the mirror does not carry cannot be fetched — this is a limit of our sandbox, not of your stack; runtime evidence skipped.
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Go, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Go, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 126 further occurrence(s) are not listed individually; the score already reflects all 166.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 78 further occurrence(s) are not listed individually; the score already reflects all 118.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

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

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D11 Test Reliability: Flakiness is inferred from history/markers — Watchdog runs the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
  • 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.
  • 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 (REDACTED, 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.
  • 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.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (4): D19, D21, D26, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

D1 · Cyclomatic Complexity6.6 / 10Adequate✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

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

147 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was MutableDAG.ReplaceNode at 53. A further 2 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being flight.ClassifyError at 19 — they are counted neither in the figure above nor in this dimension's score. 2 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: internal/runtime/observability/flight/diagnostics.go (flight.ClassifyError at 19), internal/runtime/evolution/patch/patch.go (PatchType.String at 16). 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.

Store.HybridSearch (cyclomatic 20) · ×2internal/knowledge/store/memory/store.go:337
MutableDAG.ReplaceNode (cyclomatic 53)internal/fabric/task/workflow/engine/mutable_dag.go:784
Compactor.buildSummary (cyclomatic 48)internal/ares_events/compactor.go:230
Config.setDefaults (cyclomatic 44)internal/ares_config/config_defaults.go:147
panel.html.renderOverview (cyclomatic 35)internal/introspect/web/panel.html:281

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

What to do

  1. Bring the 6 bodies over 30 down to 30 or less in Cyclomatic Complexity — start with MutableDAG.ReplaceNode (cyclomatic 53), Compactor.buildSummary (cyclomatic 48), Config.setDefaults (cyclomatic 44). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 6 together lifts Cyclomatic Complexity from 6.6 to about 7.2/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity3.0 / 10Weak✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

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

325 method(s) exceeded the cognitive complexity threshold of 15; the worst was MutableDAG.ReplaceNode at 116.

MutableDAG.ReplaceNode (cognitive 116)internal/fabric/task/workflow/engine/mutable_dag.go:784
Compactor.buildSummary (cognitive 106)internal/ares_events/compactor.go:230
FileTools.listFiles (cognitive 69)internal/tools/resources/builtin/file/file_tools.go:418
MCPConfigWatcher.Start (cognitive 60)internal/runtime/protocol/mcp/config_watcher.go:103
evolution.RunIdleEvolution (cognitive 59)internal/runtime/ares_evolution/genome_wiring_idle.go:223

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

What to do

  1. Bring the 3 bodies over 60 down to 60 or less in Cognitive Complexity — start with MutableDAG.ReplaceNode (cognitive 116), Compactor.buildSummary (cognitive 106), FileTools.listFiles (cognitive 69). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cognitive Complexity from 3.0 to about 4.6/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes9.3 / 10Stronggated by 35 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.

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

35 god class(es) detected.

TooManyMethods: Fabric · ×8internal/fabric/task/fabric.go:109
FunctionTooLong: observability.NewPrometheusMetrics · ×8internal/runtime/observability/prometheus.go:75
FileTooLong: service/service.go · ×7internal/runtime/ares_evolution/service/service.go
MethodTooLong: Population.doEvolve · ×6internal/runtime/ares_evolution/genome/population.go:272
ClassTooLong: MutableDAG · ×4internal/fabric/task/workflow/engine/mutable_dag.go:34

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

What to do

  1. Resolve the 8 TooManyMethods finding(s) in God Classes — start with fabric.go (2), scheduler.go, population.go. — One of this dimension's main actionable groups (8 warning-level).
  2. Resolve the 8 FunctionTooLong finding(s) in God Classes — start with prometheus.go, kernel_loop.go, scenario.go. — One of this dimension's main actionable groups (8 warning-level).
  3. Resolve the 7 FileTooLong finding(s) in God Classes — start with service.go, serve_arena.go, manager_impl.go. — One of this dimension's main actionable groups (7 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.4 / 10Stronggated by 243 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

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

238 duplicated block group(s) detected. A further 5 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.

Duplicated block (9 lines × 2) · ×22internal/ares_bootstrap/knowledge_akg.go:128
Duplicated block (10 lines × 2) · ×17cmd/ares/agent_kernel.go:222
Duplicated block (7 lines × 2) · ×17internal/agents/sub/agent.go:438
Duplicated block (8 lines × 2) · ×13internal/ares_events/memory_summary_repo.go:163
Duplicated block (6 lines × 2) · ×13internal/agents/sub/agent.go:466

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

What to do

  1. Resolve the 22 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with client.go (3), guided_mutator.go (2), genealogy.go (2). — One of this dimension's main actionable groups (22 warning-level).
  2. Resolve the 17 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with fabric_lifecycle.go (2), agent_kernel.go, lease.go. — One of this dimension's main actionable groups (17 warning-level).
  3. Resolve the 17 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with agent.go (2), chat.go (2), filesystem.go. — One of this dimension's main actionable groups (17 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

2 production modules (Go+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence.

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

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

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

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

4 of 394 classes have LCOM4 above 3.

Low cohesion: PrometheusMetrics (LCOM4 21) · ×4internal/runtime/observability/prometheus.go:23

What to do

  1. Resolve the 4 Low cohesion finding(s) in Cohesion (LCOM4) — start with prometheus.go, http.go, sse.go. — One of this dimension's main actionable groups (4 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

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

6998 test methods: 6637 unit, 316 integration, 0 BDD, 45 e2e. The Python suite contributes 4 test function(s) across 1 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only. The Go suite contributes 6994 test case(s) across 923 `_test.go` file(s) declaring at least one — every `func Test…(t *testing.T)` that `go test` would collect, plus the suite methods a testify-style runner reaches; a table-driven case list counts once, so this is a floor. Its tier split is INFERRED from file names, paths and build constraints, not declared: 24 of those file(s) use Go's external test package (`package x_test`), which is a visibility boundary rather than a pyramid tier and was not read as one.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

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

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

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

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

0 flaky across 1 measured tier(s). Go (github.com/Timwood0x10/ares): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D12 · Dependency Hygiene9.3 8.9 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 8.9 / 10 · rule-coverage 96% · ceiling Verified

14 outdated, 0 author-deprecated direct Go module(s), 0 pinning or checksum defect(s). 23 of 23 direct requirement(s) were graded against proxy.golang.org (0 not served there, 1 publishing no tagged release to be behind). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from REDACTED and go.sum there.

Outdated: github.com/jackc/pgx/v5 · ×14

What to do

  1. Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

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

REDACTED scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

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.

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

0 of 29 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 6 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (23 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares a Go module (REDACTED/go.sum), 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.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.9 / 10Stronggated by 105 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

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

Top hotspots: internal/fabric/task/workflow/engine/mutable_dag.go (18×53=954); internal/ares_config/config_defaults.go (20×44=880); internal/ares_bootstrap/bootstrap.go (50×16=800) Repeated repair below the complexity floor: REDACTED (8 of 12 changes were fixes); internal/tools/resources/builtin/execution/code_runner.go (8 of 11 changes were fixes); internal/storage/postgres/migrate_storage.go (7 of 13 changes were fixes)

Hotspot: internal/fabric/task/workflow/engine/mutable_dag.go · ×86internal/fabric/task/workflow/engine/mutable_dag.go:784
Repeated repair: REDACTED · ×19REDACTED:164

What to do

  1. Resolve the 86 Hotspot finding(s) in Churn × Complexity Hotspots — start with store.go (3), agent.go (2), provider.go (2). — One of this dimension's main actionable groups (86 warning-level).
  2. Resolve the 19 Repeated repair finding(s) in Churn × Complexity Hotspots — start with REDACTED, code_runner.go, migrate_storage.go. — One of this dimension's main actionable groups (19 warning-level).

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

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

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

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

35 deducted task-comment markers across 183921 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 · ×35cmd/ares/serve_wiring.go:340

What to do

  1. Resolve the 35 TodoComment finding(s) in Explicit Debt — start with agent.go (2), provide_new_evolution.go (2), task.go (2). — One of this dimension's main actionable groups (35 warning-level).
  2. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D19 · Documentation QualityExemplary◐ Sampled · advisory

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.

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

This repository is a well-structured documentation suite: the root README gives an honest limits status table and explains what ARES is (runtime kernel plus GA evolution), while docs/README.md documents the framework's release notes, languages, quick links, coding standards, and a detailed Quick Start for the current architecture. The examples directory adds audience-specific internal docs, and the system-internals reference covers 15 core modules with Mermaid diagrams and source-file references. A strong overview plus complete architecture/design documentation (system-internals) makes this an excellent reference guide. 这是个高度结构化的系统文档集合:7篇 README 文件涵盖运行时内部机制速览、框架横向对比报告、收敛基线清单、20行聊天/编码/GitHub Cookbook,加上缺陷总索引(P0/P1/P2)和认知持久化专项。内容完整且导航清晰——每个文档都开一个标题段落概述其定位,并附目录;架构类文档如 freeze-manifest.txt 和 ARES 系统内部机制速览(v0.3.x)的 Mermaid 图与源码引用; Cookbook 用代码块展示典型场景,配关键要点。结构上没有缺失项:每个 README 都有标题段落说明项目是什么、如何使用,并且文档本身足够清晰以判断是否缺少某部分内容。 (4 of 25 sampled documents could not be assessed: 1 of 3 evaluation groups failed.)

Documentation: no project overview · ×2docs/README.md

✓ On the Gold path — maintain.

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

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — One of this dimension's main actionable groups (1 recommendation-level).

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

D21 · Naming ConsistencyExemplary◐ Sampled · advisory

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.

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

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D23 · Boundary Type-Coupling9.9 / 10Stronggated by 10 serious findings✓ Tool-verified

What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.

Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.

Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.

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

10 domain type(s) cross context boundaries across 8 contexts.

Cross-context type TaskResult (core → agents) · ×4internal/agents/outputguard/guard.go:45
Cross-context type MutableDAG (fabric → runtime) · ×3REDACTED:88
Cross-context type TaskResult (core → runtime) · ×2internal/runtime/protocol/ahp/message.go:81
Cross-context type TaskResult (core → fabric)internal/fabric/agent/executor.go:48

What to do

  1. Resolve the 4 Cross-context type TaskResult (core → agents) finding(s) in Boundary Type-Coupling — start with agent.go (3), guard.go. — One of this dimension's main actionable groups (4 warning-level).
  2. Resolve the 3 Cross-context type MutableDAG (fabric → runtime) finding(s) in Boundary Type-Coupling — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 2 Cross-context type TaskResult (core → runtime) finding(s) in Boundary Type-Coupling — start with message.go (2). — One of this dimension's main actionable groups (2 warning-level).
  4. Enforce Boundary Type-Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D26 · Project Cohesion0.0 / 10Critical✓ Tool-verified

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

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

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

1 of 2 build units (Go, Python) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

D28 · Secrets (history)1.0 / 10Critical✓ Tool-verified

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

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

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

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

REDACTED
REDACTED

What to do

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

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

D29 · Static Analysis (SAST)0.0 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

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

64 finding(s): 0 critical, 52 high, 11 medium, 1 low. 19 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 2 file(s) — `configs/synonyms.yaml`, `scripts/check_doc_anchors.sh` (lines 47–192) — 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.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

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

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

D30 · Dependency Vulnerabilities1.4 / 10Critical✓ Tool-verified

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.

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

17 finding(s): 3 critical, 5 high, 9 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 4 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
  2. Resolve the 2 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

D31 · IaC & Container Security8.7 / 10Adequategated by 3 critical findings✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

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

7 finding(s): 0 critical, 3 high, 3 medium, 1 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 3 High IaC finding(s) in IaC & Container Security — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 3 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

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

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

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

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

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

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

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

No strong hidden change-coupling between production files.

✓ On the Gold path — maintain.

Detailed fixes: d35_recommendation.md.

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ Tool-verified

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.

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

0/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).

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

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

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.

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

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.

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

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

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.

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

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 6 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.

Frontend & cross-cutting dimensions

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

AC3 · Page structure10.0 / 10Exemplary○ Nothing flagged

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.

AC6 · Visual & motion safety10.0 / 10Exemplary○ Nothing flagged

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.

AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.

  • No accessibility enforcement found — no automated accessibility check runs over the HTML your app renders. Assert the accessibility invariants over that HTML in the test suite you already have (parse the output and assert, or drive a browser), and gate that test in CI so a regression blocks the merge. What was searched, so you can tell an absence from a miss: the 1 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.

What to do

  • Enforce accessibility in the test suite you already have: assert the accessibility invariants over the HTML your app renders — parse the rendered output in an existing test, or drive a real browser from one — and gate that test in CI so a regression blocks the merge.
AX10 · Code composition9.5 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX2 · Stateful singletons10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.

Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.

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

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

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

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

ES1 · Fold determinism10.0 / 10Exemplary✓ Tool-verified

Other · Event Sourcing — Whether Apply/When folds reconstruct state purely from the event (no DateTime.Now, Guid.NewGuid, Random or IO) so replay is reproducible.

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.

M1 · Documentation (README)7.3 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add a README to the 1 of 1 project(s) that lack one — worth up to 2 pts.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy0.0 / 10Critical◐ Sampled · advisory

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

  • README.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README.md:331
  • README.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README.md:536
  • README.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README.md:618
  • README.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README.md:620
  • README_CN.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README_CN.md:160
  • README_CN.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README_CN.md:288
  • README_CN.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README_CN.md:290
  • README_CN.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — README_CN.md:315
  • docs/README.md links to `../ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:28
  • docs/README.md links to `./reference/framework-comparison-langchain-crewai-agentscope-goagent-zh.md`, but `docs/reference/framework-comparison-langchain-crewai-agentscope-goagent-zh.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/README.md:29
  • docs/system-internals.en.md names `ARCHITECTURE.md`, but no file or folder `ARCHITECTURE.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/system-internals.en.md:20
  • docs/system-internals.zh.md names `ARCHITECTURE.md`, but no file or folder `ARCHITECTURE.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/system-internals.zh.md:17
  • docs/system-internals.zh.md names `internal/storage/postgres/services/`, but no file or folder `internal/storage/postgres/services` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/system-internals.zh.md:1881
  • docs/defects/00-INDEX.md names `postgres/services`, but no file or folder `postgres/services` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:329
  • docs/defects/00-INDEX.md names `zh/02`, but no file or folder `zh/02` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:500
  • docs/defects/00-INDEX.md names `en/23-quant-trading`, but no file or folder `en/23-quant-trading` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:515
  • docs/defects/00-INDEX.md names `en/24.3`, but no file or folder `en/24.3` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:516
  • docs/defects/00-INDEX.md names `zh/24.3`, but no file or folder `zh/24.3` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:516
  • docs/defects/00-INDEX.md names `zh/00-goagentx-intro`, but no file or folder `zh/00-goagentx-intro` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:517
  • docs/defects/00-INDEX.md names `zh/11-autonomous-evolution`, but no file or folder `zh/11-autonomous-evolution` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:518
  • docs/defects/00-INDEX.md names `en/13`, but no file or folder `en/13` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:520
  • docs/defects/00-INDEX.md names `en/05`, but no file or folder `en/05` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:520
  • docs/defects/00-INDEX.md names `en/16`, but no file or folder `en/16` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:520
  • docs/defects/00-INDEX.md names `en/22`, but no file or folder `en/22` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:522
  • docs/defects/00-INDEX.md names `en/06`, but no file or folder `en/06` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:522
  • docs/defects/00-INDEX.md names `en/12`, but no file or folder `en/12` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:522
  • docs/defects/00-INDEX.md names `internal/storage/postgres/services/`, but no file or folder `internal/storage/postgres/services` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:736
  • docs/defects/00-INDEX.md names `services/simple_rerank.go`, but no file or folder `services/simple_rerank.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/00-INDEX.md:823
  • docs/defects/disposable-agent.md names `internal/fabric/agent/recovery.go`, but no file or folder `internal/fabric/agent/recovery.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/disposable-agent.md:7
  • docs/defects/dynamic-dag-and-quantum.md names `internal/metrics`, but no file or folder `internal/metrics` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/dynamic-dag-and-quantum.md:75
  • docs/defects/genetic-algorithm.md names `.en.md`, but no file or folder `.en.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/genetic-algorithm.md:331
  • docs/defects/retrieval-and-storage.md names `retrieval_search.go`, but no file or folder `retrieval_search.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/retrieval-and-storage.md:108
  • docs/defects/retrieval-and-storage.md names `services/simple_rerank.go`, but no file or folder `services/simple_rerank.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/retrieval-and-storage.md:117
  • docs/defects/retrieval-and-storage.md names `simple_rerank_test.go`, but no file or folder `simple_rerank_test.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/retrieval-and-storage.md:139
  • docs/defects/retrieval-and-storage.md names `retrieval_rewrite.go`, but no file or folder `retrieval_rewrite.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/retrieval-and-storage.md:169
  • docs/defects/retrieval-and-storage.md names `simple_rerank.go`, but no file or folder `simple_rerank.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/retrieval-and-storage.md:170
  • docs/defects/retrieval-and-storage.md names `internal/storage/postgres/services/`, but no file or folder `internal/storage/postgres/services` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/defects/retrieval-and-storage.md:187
  • docs/operator/README.en.md runs `docker compose logs -f ares-demo`, but `ares-demo` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/operator/README.en.md:31
  • docs/operator/README.en.md documents the setting `autopilot`, but no code or configuration file names `autopilot`. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/operator/README.en.md:45
  • docs/operator/README.en.md names `docs/design/versioning.md`, but no file or folder `docs/design/versioning.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/operator/README.en.md:148

What to do

  • Reconcile the README with reality: README.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists; README.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist; README.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists; README.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists; README_CN.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists.
P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

  • `echo "Code not formatted. Run 'goimports -w .'"` invokes goimports in the mode that REWRITES the files it reformats and exits 0 whatever it changed. The rewrite happens inside the runner's throwaway checkout and is then discarded, so the step passes on a badly-formatted change exactly as it passes on a clean one — it enforces nothing, and no other step in this file reads the result. `-l` is the flag that turns the same invocation into a gate: it leaves the files alone and exits non-zero when anything would have been reformatted. — REDACTED:51

What to do

  • Add `-l` to the goimports step in `REDACTED` so a change that is not formatted fails CI, instead of being silently reformatted into a checkout that is thrown away — or, if reformatting the branch is the intent, commit the result back so the fix reaches the repository.
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

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

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

P2 · Observability10.0 / 10Exemplary○ Nothing flagged

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

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

P3 · Security & performance tooling9.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

What to do

  • Dependabot is configured but does not watch `github-actions`, `pip` — add those `package-ecosystem` entries to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback8.0 / 10Strong✓ Tool-verified

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

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

  • Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.

What to do

  • Add an approval/environment gate (required reviewers / protection rules) before production promotion.
P5 · DR & Backup6.0 / 10Adequate✓ 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

  • Codify backups + geo-recovery in IaC (snapshot/replication/geo-redundant) to back the DR plan.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

P7 · Outbound HTTP resilience10.0 / 10Exemplary○ Nothing flagged

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.

PF1 · Benchmark discipline10.0 / 10Exemplary✓ Tool-verified

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.

PF2 · Allocation hygiene7.7 / 10Strong✓ Tool-verified

Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.

Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.

What to do

  • Raise allocation-aware density on the hot paths — currently 635 use(s) across 191,135 production line(s) (~3.3/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
  • Go: on hot paths, reuse buffers and objects through sync.Pool, preallocate slices and maps with make([]T, 0, n) / make(map[K]V, n), size builders with Grow, append with strconv.Append*, and reslice with buf[:0] instead of allocating anew.
PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. 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 `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

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

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

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X2 · Cancellation propagation9.8 / 10Exemplary✓ Tool-verified

Other · Code Health — Whether functions that make a cancellable request accept or pass on a context.Context (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. 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 question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

  • Only 30/31 functions that make a cancellable request (net/http, net.Dial) accept a context.Context or pass one on, so a request keeps running after whatever wanted it has given up — a cancelled request, a shutdown, an expired deadline. Take `ctx context.Context` as the first parameter and build the request with it (`http.NewRequestWithContext`, `DialContext`); where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
  • `validateRemote` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — cmd/ares/serve_arena.go:496

What to do

  • Thread a context.Context through functions that make requests, so the work stops when its caller gives up.
X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

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

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

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

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

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.

X3 · Exception handling6.9 / 10Strong✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • `if _, err := os.Stat(candidate); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — cmd/ares/status.go:245
  • `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×28) — cmd/ares/serve_chaos_domain.go:556, cmd/ares/serve_arena.go:209, cmd/ares/serve_arena.go:636, …
  • `if err := json.NewDecoder(resp.Body).Decode(&result); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — cmd/ares/serve_arena.go:647
  • `if fErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — cmd/ares/evolution.go:144
  • `if sErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — cmd/ares/evolution.go:161
  • `if dErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — cmd/ares/evolution.go:167
  • `if err := json.Unmarshal(ev.Payload, &fe); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/ares_bootstrap/bootstrap_fitness.go:107
  • `if err := json.Unmarshal([]byte(argsJSON), &m); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/ares_events/tool_events.go:80
  • `if err := cmd.Run(); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/discovery/providers/binary.go:198
  • `if err := json.Unmarshal([]byte(s), &names); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/fabric/agent/planner_tagger.go:80
  • `if err := json.Unmarshal([]byte(tc.Function.Arguments), &args); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/fabric/agent/planner_rationale.go:125
  • `if err := json.Unmarshal([]byte(call.Function.Arguments), &args); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/fabric/agent/planner_need_tools.go:98
  • `if err := t.transition(StateReady); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/fabric/task/fabric_lifecycle.go:630

What to do

  • Swallowed exception (caught, then discarded)
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.

X4 · Structured logging3.6 / 10Weak✓ Tool-verified

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.

  • `info` at line 155 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:155
  • `info` at line 163 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:163
  • `warning` at line 172 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:172
  • `error` at line 177 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:177
  • `warning` at line 235 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:235
  • `warning` at line 263 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:263
  • `warning` at line 314 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:314
  • `warning` at line 343 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:343
  • `info` at line 429 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — REDACTED:429

What to do

  • Interpolated log message defeats structured logging

WCAG coverage — what static analysis assessed

Statically assessed 8 of 55 WCAG 2.2 Level A/AA success criteria (15%; ≈16% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 47 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).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 47 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.1.1, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.1, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.2, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health68%Adequate — gated by D2, X4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture92%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity50%Adequate — gated by M4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness83%ExemplarySolid.
Security51%Adequate — gated by D28, D29, D30, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Event Sourcing100%ExemplaryStrongest area.
Accessibility74%StrongSolid.
Performance90%ExemplarySolid.
Unscored — 3 check(s) recorded observations but carry no score

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

  • X10 Duplicated predicate — 24 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 19 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
Not included — 47 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
  • AC2 Forms & labels — No form control/button found in the parsed markup — AC2 not applicable here.
  • AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
  • AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
  • AX1 Captive dependencies — Not applicable: this repository's Go imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — compose up failed (exit 18 — an image could not be pulled) — ollama Pulling ollama Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the earlier `compose pull` step reported: ares-demo Skipped - No image to be pulled ollama Pulling ollama Error Get "https://registry-1.docker.io/v2/": Forbidden Error response from daemon: Get "https://registry-1.docker.io/v2/": Forbidden; the runtime sandbox reaches registries only through the in-fence pull-through mirror, so an image the mirror does not carry cannot be fetched — this is a limit of our sandbox, not of your stack; 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.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~204979 lines of test source are present (.go) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D16 Bus Factor — single-contributor repository — bus factor is not applicable
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D24 Comment Value — No inline comments to assess — comment value is not applicable here.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.go), 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.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — applicable but not scored (3 signals for this style, 2 needed — the count is met but a required primary signal is absent): 18 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 4 domain repository interface(s) (*Repository over an in-repo domain type); an application service wired to a domain repository port (hexagonal use-case dependency inversion); a top-level examples/ tree: a library or framework whose examples are its consumers — these types are building blocks, not a domain
  • ED1 Event-Driven — not scored — this repository shows only 1 of the 3 signals this lens looks for (18 event-sourced shape(s) (event folds / event-recording aggregates))
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES2 Immutable events — no persisted event types detected — immutability check not applicable
  • ES3 PII in the event store — no persisted event types detected — PII-in-events 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 — no coverage report found on disk — produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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
  • 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
  • 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.
  • X29 Per-element action decided by a fixed element — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • 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
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 72 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×9
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · High IaC · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical vulnerability · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · High vulnerability · ×1
  • REDACTED
Serious — 971 finding(s)
D15 · Churn × Complexity Hotspots · Hotspot · ×86
  • Hotspot: internal/fabric/task/workflow/engine/mutable_dag.go internal/fabric/task/workflow/engine/mutable_dag.go:784 — internal/fabric/task/workflow/engine/mutable_dag.go changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in MutableDAG.ReplaceNode at line 784. 5 of those changes were fix/bug commits, and the other 13 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/fabric/task/workflow/engine/mutable_dag.go`: 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: internal/ares_config/config_defaults.go internal/ares_config/config_defaults.go:147 — internal/ares_config/config_defaults.go changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in Config.setDefaults at line 147. 5 of those changes were fix/bug commits, and the other 15 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/ares_config/config_defaults.go`: 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: internal/ares_bootstrap/bootstrap.go internal/ares_bootstrap/bootstrap.go:319 — internal/ares_bootstrap/bootstrap.go changed 50 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in ares_bootstrap.wireMemory at line 319. 11 of those changes were fix/bug commits, and the other 39 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/ares_bootstrap/bootstrap.go`: 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: internal/ares_bootstrap/provide_new_evolution.go internal/ares_bootstrap/provide_new_evolution.go:135 — internal/ares_bootstrap/provide_new_evolution.go changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in ares_bootstrap.ProvideNewEvolution at line 135. 9 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/ares_bootstrap/provide_new_evolution.go`: 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: internal/agentsyscall/syscall.go internal/agentsyscall/syscall.go:806 — internal/agentsyscall/syscall.go changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in agentsyscall.BindTools at line 806. 10 of those changes were fix/bug commits, and the other 15 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/agentsyscall/syscall.go`: 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: internal/fabric/agent/planner_cognition.go internal/fabric/agent/planner_cognition.go:494 — internal/fabric/agent/planner_cognition.go changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in plannerCognition.ExecuteStep at line 494. 11 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/fabric/agent/planner_cognition.go`: 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: cmd/ares/agent_routes_tasks.go cmd/ares/agent_routes_tasks.go:593 — cmd/ares/agent_routes_tasks.go changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in main.runCollabGraph at line 593. 6 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- cmd/ares/agent_routes_tasks.go`: 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: sdk/config.go sdk/config.go:365 — sdk/config.go changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in ConfigFile.ToOptions at line 365. 5 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- sdk/config.go`: 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: internal/fabric/task/restore.go internal/fabric/task/restore.go:244 — internal/fabric/task/restore.go changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in Fabric.foldRestoreEvent at line 244. 8 of those changes were fix/bug commits, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/fabric/task/restore.go`: 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: internal/runtime/memory/manager_impl.go internal/runtime/memory/manager_impl.go:582 — internal/runtime/memory/manager_impl.go changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in memoryManager.BuildContext at line 582. 8 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/memory/manager_impl.go`: 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: cmd/ares/kernel_loop.go cmd/ares/kernel_loop.go:389 — cmd/ares/kernel_loop.go changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in main.runKernelRecoveryLoop at line 389. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- cmd/ares/kernel_loop.go`: 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: internal/runtime/ares_evolution/service/service.go internal/runtime/ares_evolution/service/service.go:134 — internal/runtime/ares_evolution/service/service.go changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in Service.CreateWiredSystem at line 134. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/ares_evolution/service/service.go`: 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: internal/fabric/task/workflow_plan.go internal/fabric/task/workflow_plan.go:121 — internal/fabric/task/workflow_plan.go changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in Fabric.CompilePlan at line 121. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/fabric/task/workflow_plan.go`: 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: internal/runtime/ares_evolution/genome/population.go internal/runtime/ares_evolution/genome/population.go:272 — internal/runtime/ares_evolution/genome/population.go changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in Population.doEvolve at line 272. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/ares_evolution/genome/population.go`: 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: internal/fabric/agent/l2graph.go internal/fabric/agent/l2graph.go:653 — internal/fabric/agent/l2graph.go changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in answerCognition.ExecuteStep at line 653. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/fabric/agent/l2graph.go`: 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: internal/runtime/memory/memory_patcher.go internal/runtime/memory/memory_patcher.go:131 — internal/runtime/memory/memory_patcher.go changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in MemoryPatchExecutor.Apply at line 131. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/memory/memory_patcher.go`: 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: internal/llm/client.go internal/llm/client.go:360 — internal/llm/client.go changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in Client.GenerateStream at line 360. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/llm/client.go`: 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: internal/llm/failover.go internal/llm/failover.go:317 — internal/llm/failover.go changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in FailoverClient.GenerateStream at line 317. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/llm/failover.go`: 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: internal/ares_events/compactable_store.go internal/ares_events/compactable_store.go:684 — internal/ares_events/compactable_store.go changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in CompactableEventStore.archivePendingRoundsOnce at line 684. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/ares_events/compactable_store.go`: 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: internal/ares_bootstrap/retriever_wiring.go internal/ares_bootstrap/retriever_wiring.go:72 — internal/ares_bootstrap/retriever_wiring.go changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in ares_bootstrap.wireRetrievers at line 72. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/ares_bootstrap/retriever_wiring.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:133 — REDACTED changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in KnowledgeRuntime.Execute at line 133. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/runtime/ares_evolution/genome_wiring_run.go internal/runtime/ares_evolution/genome_wiring_run.go:128 — internal/runtime/ares_evolution/genome_wiring_run.go changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in GenomePopulationAdapter.Run at line 128. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/ares_evolution/genome_wiring_run.go`: 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: internal/ares_events/compactor.go internal/ares_events/compactor.go:230 — internal/ares_events/compactor.go changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in Compactor.buildSummary at line 230. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/ares_events/compactor.go`: 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: cmd/ares/agent.go cmd/ares/agent.go:208 — cmd/ares/agent.go changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in actionHandler.checkAuthRead at line 208. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- cmd/ares/agent.go`: 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: internal/runtime/observability/flight/collector.go internal/runtime/observability/flight/collector.go:253 — internal/runtime/observability/flight/collector.go changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in Collector.processEvent at line 253. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/observability/flight/collector.go`: 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.
  • + 61 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×40
  • Swallowed exception (caught, then discarded) cmd/ares/status.go:245 — `if _, err := os.Stat(candidate); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/serve_chaos_domain.go:556 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/serve_arena.go:209 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/serve_arena.go:636 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/serve_arena.go:641 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/serve_arena.go:647 — `if err := json.NewDecoder(resp.Body).Decode(&result); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/serve.go:389 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/serve.go:393 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/main.go:377 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/flight.go:123 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/evolution.go:125 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/evolution.go:144 — `if fErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/evolution.go:161 — `if sErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/evolution.go:167 — `if dErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:187 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/agent_routes_tasks.go:552 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/agent_routes_tasks.go:791 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/agent_routes_task_read.go:75 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) cmd/ares/agent.go:282 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/agentruntime/session.go:219 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/agentruntime/await.go:252 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/ares_bootstrap/bootstrap_fitness.go:96 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/ares_bootstrap/bootstrap_fitness.go:107 — `if err := json.Unmarshal(ev.Payload, &fe); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/ares_events/tool_events.go:80 — `if err := json.Unmarshal([]byte(argsJSON), &m); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/ares_security/audit.go:46 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • + 15 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×35
  • TodoComment cmd/ares/serve_wiring.go:340 — // TODO(tech-debt) partially resolved: PG mode consciously keeps dropping 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 cmd/ares/serve_peer.go:334 — // TODO(tech-debt): no production agent exposes the SendMessage surface any — 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 cmd/ares/serve.go:126 — // TODO(tech-debt): the separate output.LLMAdapter assembly — 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 cmd/ares/kernel.go:39 — // TODO(tech-debt): agentipc records undeliverable/timed-out requests in a — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:220 — // TODO(tech-debt): the DDL itself stays in migrate_storage.go for existing — 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 cmd/ares/agent_kernel.go:374 — // TODO(tech-debt): peer direct messaging (the sub.Agent message queue / — 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 examples/_internal/runtime_evolution/basic/main.go:103 — // TODO(evolution-dim): the scheduler dimension was retired — 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 internal/agentipc/primitives.go:39 — // TODO(tech-debt): authenticate `from` (capability token per agent or a — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment internal/agents/sub/agent.go:138 — // TODO(tech-debt): the msgQueue parameter (and the SendMessage/ — 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 internal/ares_bootstrap/tool_deps.go:29 — // with the repository (TODO(tech-debt) trace left in RUNTIME.md #9).
  • TodoComment internal/ares_bootstrap/provide_new_evolution.go:165 — // TODO(tech-debt): the scheduler genome dimension was retired — 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 internal/ares_bootstrap/provide_new_evolution.go:169 — // TODO(evolution-dim): candidate successor dimension — a concurrency — 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 internal/ares_bootstrap/provide_llm.go:44 — // TODO(tech-debt): the compat.RegisterLLM block was removed (M5 — 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 internal/core/models/task.go:19 — // TODO(tech-debt): collapse to one field with both JSON keys served at — 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 internal/core/models/recommend.go:41 — // TODO(tech-debt): unify the serialization name across the schema, 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 internal/evoapi/genome_wiring_view.go:9 — // TODO(tech-debt): coordinator patch decisions are NOT exposed here — 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 internal/fabric/agent/executor_test.go:128 — // the L2 router; TODO(tech-debt) trace left in sub_cognition.go's removal). — 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 internal/fabric/task/events.go:33 — // TODO(tech-debt): a task that is deleted and then reinstalled via — 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 internal/fabric/task/workflow/graph/scheduler.go:3 — // TODO(tech-debt): the priority / short-job / round-robin / weighted-fair — 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 internal/introspect/intel.go:11 — // {"count":0}. The endpoint now reports 501 not-implemented. TODO(tech-debt): — 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 internal/kernel/scheduler_dispatch.go:39 — // TODO(tech-debt): the per-agent local ready-queue design — 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 internal/knowledge/pipeline/normalizer.go:311 — // TODO(tech-debt): the caller merges on this at Confidence 1.0, which is — 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 internal/knowledge/retriever/eval.go:88 — // TODO(tech-debt): EvalHarness is unwired — no production caller. The raw — 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 internal/runtime/arena/scenario.go:338 — // TODO(tech-debt): remove RunScenario together with its scenario_test.go — 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 internal/runtime/ares_evolution/lifecycle_evidence.go:330 — // TODO(tech-debt): decision records share KindFitness with runtime fitness — 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.
  • + 10 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×22
  • Duplicated block (9 lines × 2) internal/ares_bootstrap/knowledge_akg.go:128 — internal/ares_bootstrap/knowledge_akg.go:128-136 | sdk/memory_wiring.go:348-356 — 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. Check import visibility before settling on that home: `internal/ares_bootstrap/knowledge_akg.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (9 lines × 2) internal/fabric/task/workflow/graph/graph.go:61 — internal/fabric/task/workflow/graph/graph.go:61-69 | internal/fabric/task/workflow/graph/graph.go:83-91 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/fabric/task/workflow/graph/graph.go:61` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/knowledge/mcp/mcp.go:189 — internal/knowledge/mcp/mcp.go:189-197 | internal/knowledge/mcp/mcp.go:381-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/mcp/mcp.go: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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) internal/knowledge/store/postgres/store.go:724 — internal/knowledge/store/postgres/store.go:724-732 | internal/knowledge/store/sqlite/store.go:703-711 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:724` it does not close everything it opens, so those exact lines 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) internal/llm/client.go:558 — internal/llm/client.go:558-566 | internal/llm/client.go:768-776 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/llm/client.go:558` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) internal/runtime/arena/regression.go:738 — internal/runtime/arena/regression.go:738-746 | internal/runtime/arena/regression.go:750-758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) internal/runtime/ares_evolution/genome/adaptive.go:599 — internal/runtime/ares_evolution/genome/adaptive.go:599-607 | internal/runtime/ares_evolution/genome/population_guard.go:89-97 — 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 `internal/runtime/ares_evolution/genome/adaptive.go:599` it does not close everything it opens, so those exact lines 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) internal/runtime/ares_evolution/mutation/guided_mutator.go:260 — internal/runtime/ares_evolution/mutation/guided_mutator.go:260-268 | internal/runtime/ares_evolution/mutation/guided_mutator.go:309-317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/mutation/guided_mutator.go:260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/runtime/eval/agent_runner.go:142 — internal/runtime/eval/agent_runner.go:142-150 | internal/runtime/eval/report.go:196-204 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/eval/agent_runner.go:142` it does not close everything it opens, so those exact lines 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) internal/runtime/eval/dimension_judge.go:241 — internal/runtime/eval/dimension_judge.go:241-249 | internal/runtime/eval/llm_judge.go:377-386 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/tools/envcap/envcap.go:80 — internal/tools/envcap/envcap.go:80-88 | internal/tools/toolsource/toolsource.go:55-63 — 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 `internal/tools/toolsource/toolsource.go:55` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) internal/fabric/task/workflow/engine/registry.go:73 — internal/fabric/task/workflow/engine/registry.go:73-83 | internal/tools/resources/core/factory.go:137-145 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) internal/runtime/observability/flight/genealogy.go:313 — internal/runtime/observability/flight/genealogy.go:313-321 | internal/runtime/observability/flight/graph.go:170-178 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) internal/runtime/observability/flight/genealogy.go:324 — internal/runtime/observability/flight/genealogy.go:324-332 | internal/runtime/observability/flight/graph.go:204-212 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) internal/knowledge/compiler/compiler.go:229 — internal/knowledge/compiler/compiler.go:229-238 | internal/knowledge/compiler/compiler.go:336-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/compiler/compiler.go:229` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/fabric/task/workflow/graph/patcher.go:162 — internal/fabric/task/workflow/graph/patcher.go:162-171 | internal/fabric/task/workflow/graph/patcher.go:288-296 — both copies are in the same file, so extract the block into 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) internal/runtime/ares_evolution/mutation/guided_mutator.go:649 — internal/runtime/ares_evolution/mutation/guided_mutator.go:649-657 | internal/runtime/ares_evolution/mutation/guided_mutator.go:660-668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/mutation/guided_mutator.go:649` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) internal/llm/client.go:654 — internal/llm/client.go:654-662 | internal/llm/client.go:770-778 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/llm/client.go:654` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) internal/storage/postgres/embedding/client.go:269 — internal/storage/postgres/embedding/client.go:269-277 | internal/storage/postgres/embedding/client.go:319-327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/runtime/memory/experienceadapters/adapters.go:82 — internal/runtime/memory/experienceadapters/adapters.go:82-90 | internal/runtime/memory/experienceadapters/adapters.go:135-143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/memory/experienceadapters/adapters.go:82` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/evoapi/genome/genome.go:159 — internal/evoapi/genome/genome.go:159-167 | internal/evoapi/genome/genome.go:201-209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/evoapi/genome/genome.go:159` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) REDACTED:136 — REDACTED:136-144 | REDACTED:145-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:136` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D15 · Churn × Complexity Hotspots · Repeated repair · ×19
  • Repeated repair: REDACTED REDACTED:164 — REDACTED changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is VectorSearcher.AddEmbedding at line 164), 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(storage): Implement tenant-isolated cleanup and correct embedded queue identifiers.”; “fix(storage,serve,sdk,knowledge): close review defect batch, tenant-backfill core tables, drop inert RLS”; “fix(knowledge,mcp,storage,control): tenant-isolate distillation, bound transports, extend write deadlines”; “fix(security,durability): close proxy auth bypass, tombstone deletes, refuse unsupported human-input”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: internal/tools/resources/builtin/execution/code_runner.go internal/tools/resources/builtin/execution/code_runner.go:172 — internal/tools/resources/builtin/execution/code_runner.go 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 14 (its worst body is CodeRunner.Execute at line 172), 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(hardening): signal restart race, ask_agent detach, review P2 batch, SSE Host gate”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”; “fix(critical): resolve 9 CRITICAL defects from deep code review + MEDIUM batch”; “fix(kernel/fabric): M2 hardening batch — retry, admission, drain limit, security”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/tools/resources/builtin/execution/code_runner.go`: 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: internal/storage/postgres/migrate_storage.go internal/storage/postgres/migrate_storage.go:469 — internal/storage/postgres/migrate_storage.go changed 13 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is postgres.MigrateStorage at line 469), 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(arena, ci, docs): Fix the issue where regression scorer errors were being suppressed; integrate a gatekeeper check for document anchor drift.”; “fix(storage,serve,sdk,knowledge): close review defect batch, tenant-backfill core tables, drop inert RLS”; “fix(tenancy): thread a request-scoped tenant through the execution path”; “fix(hardening): correctness, concurrency and resource-leak batch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/storage/postgres/migrate_storage.go`: 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: internal/runtime/memory/distillation/distiller_admin.go internal/runtime/memory/distillation/distiller_admin.go:239 — internal/runtime/memory/distillation/distiller_admin.go changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is distillation.extractEvidenceFromMessages at line 239), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent-runtime,events): fix deadlock and implement the write-back path (0.3.2)”; “fix(agent-runtime): close trust-root, stall-wait and retrieval gaps (0.3.2)”; “ fix(runtime,evolution,memory,mcp,knowledge): close 0.3.1 release-blocking defects”; “fix(knowledge): enforce tenant ownership at the store layer”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/memory/distillation/distiller_admin.go`: 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: internal/storage/postgres/repositories/experience_repository.go internal/storage/postgres/repositories/experience_repository.go:139 — internal/storage/postgres/repositories/experience_repository.go changed 10 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 11 (its worst body is ExperienceRepository.GetByID at line 139), 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(storage): Implement tenant-isolated cleanup and correct embedded queue identifiers.”; “fix(storage,serve,sdk,knowledge): close review defect batch, tenant-backfill core tables, drop inert RLS”; “fix(security,durability): close proxy auth bypass, tombstone deletes, refuse unsupported human-input”; “Fix: Resolved orphan plugin leaks and the loss of XP metadata constraints during batch startup.”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/storage/postgres/repositories/experience_repository.go`: 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: internal/knowledge/relation_extract.go internal/knowledge/relation_extract.go:275 — internal/knowledge/relation_extract.go 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 8 (its worst body is knowledge.FindRelationConflicts at line 275), 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(hardening): signal restart race, ask_agent detach, review P2 batch, SSE Host gate”; “fix(review-followup): deep-review defect batch — provenance, races, data loss, MCP”; “fix(hardening): correctness, concurrency and resource-leak batch”; “fix(events+cleanup): composite (created_at,id) cursor; evoapi surface mirrors; retire review doc”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/knowledge/relation_extract.go`: 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: internal/storage/postgres/pool.go internal/storage/postgres/pool.go:275 — internal/storage/postgres/pool.go 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 8 (its worst body is Pool.Query at line 275), 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(storage,serve,sdk,knowledge): close review defect batch, tenant-backfill core tables, drop inert RLS”; “fix(tenancy): thread a request-scoped tenant through the execution path”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”; “fix(fabric/agentipc): M2-b review follow-up batch — assertions, nilnil contracts, dead dispatch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/storage/postgres/pool.go`: 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:62 — REDACTED changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is repositories.createTestTables at line 62), 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(storage): Implement tenant-isolated cleanup and correct embedded queue identifiers.”; “fix(storage,serve,sdk,knowledge): close review defect batch, tenant-backfill core tables, drop inert RLS”; “Fix: Resolved orphan plugin leaks and the loss of XP metadata constraints during batch startup.”; “fix(tooling): Replace goimports with gci”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: internal/mcpclient/sse.go internal/mcpclient/sse.go:34 — internal/mcpclient/sse.go changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is mcpclient.ConnectSSE at line 34), 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(knowledge): enforce tenant ownership at the store layer”; “fix(knowledge,mcp,storage,control): tenant-isolate distillation, bound transports, extend write deadlines”; “fix(review-followup): deep-review defect batch — provenance, races, data loss, MCP”; “fix(hardening): correctness, concurrency and resource-leak batch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/mcpclient/sse.go`: 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: cmd/ares/agent_routes_tools.go cmd/ares/agent_routes_tools.go:74 — cmd/ares/agent_routes_tools.go 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 6 (its worst body is actionHandler.handleCallTool at line 74), 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,evolution,memory,mcp,knowledge): close 0.3.1 release-blocking defects”; “fix(storage,serve,sdk,knowledge): close review defect batch, tenant-backfill core tables, drop inert RLS”; “fix(knowledge,mcp,storage,control): tenant-isolate distillation, bound transports, extend write deadlines”; “fix(planprojection,security,sdk): close F-21 drop-compensation stalls and review defect batch :”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- cmd/ares/agent_routes_tools.go`: 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: internal/tools/discovery/discover.go internal/tools/discovery/discover.go:100 — internal/tools/discovery/discover.go 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 8 (its worst body is discovery.NewDiscoverer at line 100), 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(hardening): signal restart race, ask_agent detach, review P2 batch, SSE Host gate”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”; “fix(critical): resolve 9 CRITICAL defects from deep code review + MEDIUM batch”; “fix: Fixed a NullPointerException in the cost dashboard route and resolved multiple stability issues.”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/tools/discovery/discover.go`: 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: cmd/ares/agent_routes_task_read.go cmd/ares/agent_routes_task_read.go:152 — cmd/ares/agent_routes_task_read.go changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is main.waitForTaskResult at line 152), 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(agent-runtime,events): fix deadlock and implement the write-back path (0.3.2)”; “fix(evolution,agent-runtime): revert ask_agent to fire-and-forget, add E5 diagnostics (0.3.2)”; “fix(agent-runtime): close trust-root, stall-wait and retrieval gaps (0.3.2)”; “fix(api): Task retrieval endpoint now returns session answers and failure reasons.”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- cmd/ares/agent_routes_task_read.go`: 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: internal/runtime/memory/context/task.go internal/runtime/memory/context/task.go:105 — internal/runtime/memory/context/task.go changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is TaskMemory.cleanupLoop at line 105), 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(kernel,runtime,memory,mcp,postgres): close phase-2 deep-review defects”; “fix(hardening): signal restart race, ask_agent detach, review P2 batch, SSE Host gate”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”; “fix(critical): resolve 9 CRITICAL defects from deep code review + MEDIUM batch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/memory/context/task.go`: 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: internal/tools/resources/builtin/network/ssrf.go internal/tools/resources/builtin/network/ssrf.go:88 — internal/tools/resources/builtin/network/ssrf.go changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is builtin.isBlockedIP at line 88), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “chore(release): Release 0.3.2; fix scheduler patch validation, SSRF diagnostics, and tests.”; “fix(critical): resolve 9 CRITICAL defects from deep code review + MEDIUM batch”; “refactor(network): add SSRF defense transport, fix import allowlist tests”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/tools/resources/builtin/network/ssrf.go`: 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: internal/runtime/memory/push/service.go internal/runtime/memory/push/service.go:248 — internal/runtime/memory/push/service.go changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is push.matchesCriteria at line 248), 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(bootstrap,runtime,serving): self-healing background workers and write-deadline propagation”; “fix(hardening): correctness, concurrency and resource-leak batch”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/runtime/memory/push/service.go`: 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: internal/fabric/task/quantum.go internal/fabric/task/quantum.go:72 — internal/fabric/task/quantum.go changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is Fabric.RunQuantum at line 72), 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(api): Task retrieval endpoint now returns session answers and failure reasons.”; “fix(security,durability): close proxy auth bypass, tombstone deletes, refuse unsupported human-input”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/fabric/task/quantum.go`: 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: internal/logger/logger.go internal/logger/logger.go:80 — internal/logger/logger.go changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is Logger.slog at line 80), 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(events+cleanup): composite (created_at,id) cursor; evoapi surface mirrors; retire review doc”; “refactor(cleanup): consolidate ares_ctxutil/runtime, move ares_integration, fix token/load-key/l2graph”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/logger/logger.go`: 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: internal/storage/postgres/repositories/experience_repository_memory.go internal/storage/postgres/repositories/experience_repository_memory.go:248 — internal/storage/postgres/repositories/experience_repository_memory.go changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is memoryExperienceRepository.SearchByKeyword at line 248), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”; “fix(critical): resolve 9 CRITICAL defects from deep code review + MEDIUM batch”; “fix(fabric/agentipc): M2-b review follow-up batch — assertions, nilnil contracts, dead dispatch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/storage/postgres/repositories/experience_repository_memory.go`: 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: internal/storage/postgres/session.go internal/storage/postgres/session.go:192 — internal/storage/postgres/session.go changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is SessionRepository.ListByUserID at line 192), 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(storage,serve,sdk,knowledge): close review defect batch, tenant-backfill core tables, drop inert RLS”; “fix(review-hardening): deep-review defect batch + 2 critical P1 fixes”; “fix(critical): resolve 9 CRITICAL defects from deep code review + MEDIUM batch”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 16:44:29 +08:00' --until='2026-10-20 16:44:29 +08:00' --full-history --no-merges -- internal/storage/postgres/session.go`: 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.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×17
  • Duplicated block (10 lines × 2) cmd/ares/agent_kernel.go:222 — cmd/ares/agent_kernel.go:222-231 | sdk/syscall.go:112-121 — 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 `cmd/ares/agent_kernel.go:222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `sdk/syscall.go:110` calls `Errorf` and `cmd/ares/agent_kernel.go:214` 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) internal/agents/lease/lease.go:86 — internal/agents/lease/lease.go:86-95 | internal/agents/lease/lease.go:109-118 — both copies are in the same file, so extract the 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 2) internal/ares_bootstrap/provide_mcp.go:191 — internal/ares_bootstrap/provide_mcp.go:191-200 | internal/runtime/protocol/mcp/config_watcher.go:259-268 — 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 `internal/ares_bootstrap/provide_mcp.go:191` 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 (10 lines × 2) internal/aresrecovery/evolution_execution_feedback.go:224 — internal/aresrecovery/evolution_execution_feedback.go:224-233 | internal/aresrecovery/evolution_execution_feedback.go:247-256 — both copies are in the same file, so extract the block into 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) internal/fabric/agent/planner_cognition.go:348 — internal/fabric/agent/planner_cognition.go:348-357 | internal/fabric/agent/planner_context.go:143-152 — 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 `internal/fabric/agent/planner_cognition.go:348` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/fabric/task/checkpoint_schema.go:198 — internal/fabric/task/checkpoint_schema.go:198-207 | internal/fabric/task/checkpoint_schema.go:283-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.
  • Duplicated block (10 lines × 2) internal/fabric/task/fabric_lifecycle.go:341 — internal/fabric/task/fabric_lifecycle.go:341-350 | internal/fabric/task/fabric_lifecycle.go:370-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 2) internal/fabric/task/fabric_lifecycle.go:582 — internal/fabric/task/fabric_lifecycle.go:582-591 | internal/fabric/task/fabric_schedule.go:83-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 2) internal/llm/client.go:388 — internal/llm/client.go:388-397 | internal/llm/client.go:420-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/llm/client.go:388` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) internal/runtime/memory/memory_patcher.go:105 — internal/runtime/memory/memory_patcher.go:105-114 | internal/runtime/memory/memory_patcher.go:132-142 — both copies are in the same file, so extract the 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 2) internal/storage/postgres/pool.go:279 — internal/storage/postgres/pool.go:279-288 | internal/storage/postgres/pool.go:372-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/pool.go:279` it does not close everything it opens, so those exact lines 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) internal/storage/postgres/session.go:116 — internal/storage/postgres/session.go:116-125 | internal/storage/postgres/session.go:227-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. The matched lines also transfer control out of the body holding them, 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) internal/tools/resources/builtin/text/log_analyzer.go:206 — internal/tools/resources/builtin/text/log_analyzer.go:206-215 | internal/tools/resources/builtin/text/log_analyzer.go:232-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 `internal/tools/resources/builtin/text/log_analyzer.go:206` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/knowledge/store/postgres/store.go:559 — internal/knowledge/store/postgres/store.go:559-568 | internal/knowledge/store/sqlite/store.go:674-683 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10 lines × 2) internal/agentsyscall/syscall.go:356 — internal/agentsyscall/syscall.go:356-365 | internal/agentsyscall/syscall.go:487-497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/agentsyscall/syscall.go:356` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/tools/resources/builtin/math/calculator.go:410 — internal/tools/resources/builtin/math/calculator.go:410-419 | internal/tools/resources/builtin/math/calculator.go:429-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 `internal/tools/resources/builtin/math/calculator.go:410` it does not close everything it opens, so those exact lines 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) internal/runtime/ares_evolution/genome_wiring_run.go:430 — internal/runtime/ares_evolution/genome_wiring_run.go:430-439 | internal/runtime/ares_evolution/genome_wiring_run.go:473-482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/genome_wiring_run.go:430` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×17
  • Duplicated block (7 lines × 2) internal/agents/sub/agent.go:438 — internal/agents/sub/agent.go:438-444 | internal/agents/sub/agent.go:456-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/agents/sub/agent.go:438` 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) internal/agents/sub/agent.go:433 — internal/agents/sub/agent.go:433-439 | internal/agents/sub/agent.go:592-598 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/agents/sub/agent.go:433` it does not close everything it opens, so those exact lines 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) internal/discovery/providers/filesystem.go:158 — internal/discovery/providers/filesystem.go:158-164 | internal/discovery/providers/filesystem.go:188-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 `internal/discovery/providers/filesystem.go:158` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) internal/fabric/task/workflow/engine/mutable_dag.go:112 — internal/fabric/task/workflow/engine/mutable_dag.go:112-118 | internal/fabric/task/workflow/engine/types.go:221-227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/fabric/task/workflow/engine/mutable_dag.go:112` it does not close everything it opens, so those 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, `internal/fabric/task/workflow/engine/types.go:219` calls `TrimSpace` and `internal/fabric/task/workflow/engine/mutable_dag.go:109` 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 × 2) internal/runtime/archive/reader.go:111 — internal/runtime/archive/reader.go:111-117 | internal/runtime/archive/reader.go:171-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.
  • Duplicated block (7 lines × 2) internal/runtime/bus.go:443 — internal/runtime/bus.go:443-449 | internal/runtime/bus.go:467-473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/bus.go: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.
  • Duplicated block (7 lines × 2) REDACTED:420 — REDACTED:420-426 | REDACTED:427-433 — both copies are in the same file, so extract the block into 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) sdk/graph_run.go:275 — sdk/graph_run.go:275-281 | sdk/graph_run.go:441-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 `sdk/graph_run.go:275` 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) internal/fabric/agent/context.go:251 — internal/fabric/agent/context.go:251-257 | sdk/graph_run.go:452-458 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Check import visibility before settling on that home: `internal/fabric/agent/context.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (7 lines × 2) internal/knowledge/adapter/distill.go:534 — internal/knowledge/adapter/distill.go:534-540 | internal/knowledge/provider/store/provider.go:208-214 — 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) internal/runtime/evolution/diff/workflow_differ.go:130 — internal/runtime/evolution/diff/workflow_differ.go:130-136 | internal/tools/resources/builtin/execution/code_runner.go:163-169 — 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) internal/llm/chat.go:272 — internal/llm/chat.go:272-278 | internal/llm/client.go:743-750 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/llm/chat.go:280` calls `decodeOpenAIChatResponse` and `internal/llm/client.go:752` 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 × 2) internal/llm/chat.go:470 — internal/llm/chat.go:470-476 | internal/llm/client.go:627-634 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/llm/chat.go:478` calls `decodeAnthropicChatResponse` and `internal/llm/client.go: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 (7 lines × 2) internal/ares_events/compactor.go:288 — internal/ares_events/compactor.go:288-294 | internal/ares_events/compactor.go:304-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/ares_events/compactor.go:288` it begins part-way through the construct above it, so those exact lines 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) internal/runtime/evolution/patch/patch.go:274 — internal/runtime/evolution/patch/patch.go:274-280 | internal/runtime/evolution/patch/patch.go:288-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/evolution/patch/patch.go:274` it begins part-way through the construct above it, so those exact lines 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) internal/runtime/ares_evolution/genome/selection.go:165 — internal/runtime/ares_evolution/genome/selection.go:165-171 | internal/runtime/ares_evolution/genome/selection.go:730-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 `internal/runtime/ares_evolution/genome/selection.go: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. The matched lines also transfer control out of the body holding them, 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) internal/storage/postgres/repositories/experience_repository.go:691 — internal/storage/postgres/repositories/experience_repository.go:691-697 | REDACTED:683-689 — 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 `internal/storage/postgres/repositories/experience_repository.go:691` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×13
  • Duplicated block (8 lines × 2) internal/ares_events/memory_summary_repo.go:163 — internal/ares_events/memory_summary_repo.go:163-171 | internal/ares_events/memory_summary_repo.go:187-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) internal/fabric/task/fabric.go:463 — internal/fabric/task/fabric.go:463-470 | internal/fabric/task/fabric.go:523-530 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/fabric/task/fabric.go:463` 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 × 2) internal/kernel/executor_registry.go:154 — internal/kernel/executor_registry.go:154-161 | internal/kernel/scheduler_execute.go:95-102 — 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 `internal/kernel/executor_registry.go:154` it begins part-way through the construct above it, so those 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 `string` to `s *Scheduler) UnregisterExecutor(agentID` in one and `s *Scheduler) logFailure(taskID` 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 × 2) internal/knowledge/store/postgres/store.go:424 — internal/knowledge/store/postgres/store.go:424-431 | internal/knowledge/store/sqlite/store.go:534-542 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 2) internal/runtime/ares_evolution/dream_cycle_winner.go:141 — internal/runtime/ares_evolution/dream_cycle_winner.go:141-148 | internal/runtime/ares_evolution/dream_cycle_winner.go:206-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/dream_cycle_winner.go: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 (8 lines × 2) internal/storage/postgres/recommend.go:117 — internal/storage/postgres/recommend.go:117-124 | internal/storage/postgres/recommend.go:194-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/recommend.go:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) sdk/bootstrap_runtime.go:32 — sdk/bootstrap_runtime.go:32-41 | sdk/memory_wiring.go:275-282 — 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. 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) internal/ares_bootstrap/provide_distillation.go:310 — internal/ares_bootstrap/provide_distillation.go:310-317 | sdk/distill_events.go:199-206 — 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. Check import visibility before settling on that home: `internal/ares_bootstrap/provide_distillation.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (8 lines × 2) internal/knowledge/compiler/compiler.go:200 — internal/knowledge/compiler/compiler.go:200-207 | internal/knowledge/compiler/compiler.go:360-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/compiler/compiler.go:200` it does not close everything it opens, so those 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, `internal/knowledge/compiler/compiler.go:355` calls `WriteString` and `internal/knowledge/compiler/compiler.go:195` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) internal/knowledge/store/postgres/store.go:733 — internal/knowledge/store/postgres/store.go:733-740 | internal/knowledge/store/postgres/store.go:784-791 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/store/postgres/store.go:733` it begins part-way through the construct above it, so those exact lines 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) internal/runtime/observability/flight/collector.go:310 — internal/runtime/observability/flight/collector.go:310-317 | internal/runtime/observability/flight/collector.go:329-336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/observability/flight/collector.go:310` it begins part-way through the construct above it, so those exact lines 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) cmd/ares/serve_arena.go:75 — cmd/ares/serve_arena.go:75-82 | cmd/ares/serve_arena.go:351-358 — both copies are in the same file, so extract the 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 2) cmd/ares/agent_kernel.go:329 — cmd/ares/agent_kernel.go:329-336 | sdk/syscall.go:109-116 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×13
  • Duplicated block (6 lines × 2) internal/agents/sub/agent.go:466 — internal/agents/sub/agent.go:466-471 | internal/agents/sub/agent.go:613-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/agents/sub/agent.go:466` it does not close everything it opens, so those exact lines 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) internal/fabric/task/fabric_lifecycle.go:749 — internal/fabric/task/fabric_lifecycle.go:749-754 | internal/fabric/task/fabric_lifecycle.go:922-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 `internal/fabric/task/fabric_lifecycle.go:749` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 2) internal/kernel/orchestrator.go:158 — internal/kernel/orchestrator.go:158-165 | internal/kernel/orchestrator.go:496-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/kernel/orchestrator.go: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.
  • Duplicated block (6 lines × 2) REDACTED:408 — REDACTED:408-413 | REDACTED:415-420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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: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 (6 lines × 2) internal/storage/postgres/session.go:234 — internal/storage/postgres/session.go:234-241 | REDACTED:151-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/session.go:234` it begins part-way through the construct above it, so those exact lines 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) internal/tools/resources/builtin/embedding/embedding.go:185 — internal/tools/resources/builtin/embedding/embedding.go:185-190 | internal/tools/resources/builtin/embedding/embedding.go:245-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/tools/resources/builtin/embedding/embedding.go:185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/knowledge/store/sqlite/store.go:147 — internal/knowledge/store/sqlite/store.go:147-152 | internal/storage/postgres/query_utils.go:8-13 — 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) internal/storage/postgres/vector_index.go:409 — internal/storage/postgres/vector_index.go:409-416 | internal/storage/postgres/vector_index.go:451-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/vector_index.go: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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/storage/postgres/vector_index.go:409` is reached only past a guard at line 390 that tests `idx.Method` and leaves the function early, and `internal/storage/postgres/vector_index.go:451` reads `idx.Method` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (6 lines × 2) REDACTED:237 — REDACTED:237-242 | REDACTED:184-190 — 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 `REDACTED:237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/ares_bootstrap/bootstrap_evolution.go:956 — internal/ares_bootstrap/bootstrap_evolution.go:956-962 | internal/ares_bootstrap/knowledge_akg.go:79-84 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 2) REDACTED:231 — REDACTED:231-236 | REDACTED:178-183 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) REDACTED:71 — REDACTED:71-76 | REDACTED:105-110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) REDACTED:107 — REDACTED:107-112 | REDACTED:138-143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×12
  • Duplicated block (11 lines × 2) internal/discovery/providers/filesystem.go:166 — internal/discovery/providers/filesystem.go:166-176 | internal/discovery/providers/filesystem.go:196-206 — both copies are in the same file, so extract the block into 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) internal/fabric/task/fabric_lifecycle.go:146 — internal/fabric/task/fabric_lifecycle.go:146-164 | internal/fabric/task/fabric_lifecycle.go:1142-1152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/fabric/task/fabric_lifecycle.go: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 (11 lines × 2) internal/knowledge/store/postgres/store.go:407 — internal/knowledge/store/postgres/store.go:407-417 | internal/knowledge/store/sqlite/store.go:515-525 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:407` 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) internal/runtime/ares_evolution/service/report_hook.go:32 — internal/runtime/ares_evolution/service/report_hook.go:32-42 | internal/runtime/ares_evolution/service/service.go:272-285 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) internal/runtime/observability/flight/genealogy.go:274 — internal/runtime/observability/flight/genealogy.go:274-284 | internal/runtime/observability/flight/graph.go:151-161 — 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 `internal/runtime/observability/flight/genealogy.go:274` it does not close everything it opens, so those exact lines 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) internal/tools/resources/builtin/file/file_tools.go:511 — internal/tools/resources/builtin/file/file_tools.go:511-521 | internal/tools/resources/builtin/file/file_tools.go:560-570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/tools/resources/builtin/file/file_tools.go:511` it begins part-way through the construct above it, so those 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, `internal/tools/resources/builtin/file/file_tools.go:510` calls `Name` and `internal/tools/resources/builtin/file/file_tools.go:559` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) REDACTED:51 — REDACTED:51-61 | internal/tools/resources/builtin/stringutils/stringutils.go:73-83 — 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:51` it does not close everything it opens, so those exact lines 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) internal/tools/resources/builtin/planning/task_planner.go:462 — internal/tools/resources/builtin/planning/task_planner.go:462-472 | REDACTED:271-281 — 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 (11 lines × 2) internal/runtime/evolution/diff/workflow_differ.go:117 — internal/runtime/evolution/diff/workflow_differ.go:117-127 | internal/runtime/protocol/mcp/manager.go:760-770 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) cmd/ares/knowledge_store.go:234 — cmd/ares/knowledge_store.go:234-245 | internal/ares_bootstrap/knowledge_akg.go:84-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Check import visibility before settling on that home: `internal/ares_bootstrap/knowledge_akg.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (11 lines × 2) internal/storage/postgres/repositories/experience_repository.go:662 — internal/storage/postgres/repositories/experience_repository.go:662-672 | internal/storage/postgres/repositories/secret_repository.go:299-309 — 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 `internal/storage/postgres/repositories/experience_repository.go:662` 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 (11 lines × 2) internal/runtime/eval/process_verifier.go:81 — internal/runtime/eval/process_verifier.go:81-91 | internal/runtime/eval/result_verifier.go:103-113 — 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 `internal/runtime/eval/process_verifier.go:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×11
  • Duplicated block (15 lines × 2) internal/discovery/engine.go:219 — internal/discovery/engine.go:219-233 | REDACTED:567-581 — 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 `internal/discovery/engine.go:219` 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 (15 lines × 2) internal/evoapi/genome/genome.go:142 — internal/evoapi/genome/genome.go:142-156 | internal/evoapi/genome/genome.go:184-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/evoapi/genome/genome.go:142` it begins part-way through the construct above it, so those exact lines 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) internal/llm/client.go:540 — internal/llm/client.go:540-554 | internal/llm/client.go:750-764 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/llm/client.go:540` it does not close everything it opens, so those 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, `internal/llm/client.go:747` calls `Set` and `internal/llm/client.go:537` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) internal/runtime/ares_evolution/genome_wiring_idle.go:176 — internal/runtime/ares_evolution/genome_wiring_idle.go:176-190 | internal/runtime/ares_evolution/service/service_bridge.go:23-37 — 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 `internal/runtime/ares_evolution/genome_wiring_idle.go:176` 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 (15 lines × 2) internal/runtime/manager.go:292 — internal/runtime/manager.go:292-306 | internal/runtime/manager_chaos.go:79-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. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/manager.go:292` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (15 lines × 2) REDACTED:476 — REDACTED:476-490 | REDACTED:564-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:476` it begins part-way through the construct above it, so those exact lines 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) internal/tools/resources/builtin/knowledge/knowledge_base.go:261 — internal/tools/resources/builtin/knowledge/knowledge_base.go:261-275 | internal/tools/resources/builtin/knowledge/knowledge_base.go:356-370 — both copies are in the same file, so extract the block into 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) internal/runtime/memory/context/session.go:411 — internal/runtime/memory/context/session.go:411-425 | internal/runtime/memory/context/task.go:339-353 — 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) internal/runtime/ares_evolution/guardrails.go:325 — internal/runtime/ares_evolution/guardrails.go:325-341 | internal/runtime/ares_evolution/guardrails.go:448-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/guardrails.go: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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (15 lines × 2) internal/storage/postgres/embedding_queue.go:92 — internal/storage/postgres/embedding_queue.go:92-106 | internal/storage/postgres/embedding_queue.go:161-175 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/embedding_queue.go:92` 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 (15 lines × 2) internal/llm/failover.go:267 — internal/llm/failover.go:267-281 | internal/llm/failover.go:343-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/llm/failover.go: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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×9
  • Duplicated block (12 lines × 2) cmd/ares/main.go:854 — cmd/ares/main.go:854-865 | cmd/ares/main.go:894-905 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/ares_security/sanitizer.go:266 — internal/ares_security/sanitizer.go:266-277 | internal/ares_security/sanitizer.go:324-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/fabric/task/workflow/graph/graph.go:130 — internal/fabric/task/workflow/graph/graph.go:130-141 | internal/fabric/task/workflow/graph/graph.go:195-206 — both copies are in the same file, so extract the 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (12 lines × 2) internal/knowledge/store/postgres/store.go:583 — internal/knowledge/store/postgres/store.go:583-594 | internal/knowledge/store/sqlite/store.go:572-583 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go: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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (12 lines × 2) internal/runtime/ares_evolution/experience/normalizer.go:286 — internal/runtime/ares_evolution/experience/normalizer.go:286-297 | internal/runtime/ares_evolution/experience/normalizer.go:374-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 `internal/runtime/ares_evolution/experience/normalizer.go:286` it does not close everything it opens, so those 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, `internal/runtime/ares_evolution/experience/normalizer.go:299` calls `ParseDuration`, `Seconds` and `internal/runtime/ares_evolution/experience/normalizer.go:386` 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 × 2) internal/runtime/ares_evolution/scheduler.go:389 — internal/runtime/ares_evolution/scheduler.go:389-400 | internal/runtime/ares_evolution/scheduler.go:898-909 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/scheduler.go:389` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) REDACTED:326 — REDACTED:326-337 | REDACTED:428-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:326` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (12 lines × 2) internal/storage/postgres/repositories/knowledge_repository.go:586 — internal/storage/postgres/repositories/knowledge_repository.go:586-601 | internal/storage/postgres/repositories/knowledge_repository.go:679-690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/repositories/knowledge_repository.go:586` it begins part-way through the construct above it, so those exact lines 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) internal/knowledge/runtime/patcher.go:202 — internal/knowledge/runtime/patcher.go:202-213 | internal/knowledge/runtime/patcher.go:223-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/runtime/patcher.go:202` it does not close everything it opens, so those 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.
D3 · God Classes · TooManyMethods · ×8
  • TooManyMethods: Fabric internal/fabric/task/fabric.go:109 — TooManyMethods — 77 methods, declared across 12 files: task/fabric_lifecycle.go (28), task/fabric.go (14), task/fabric_deps.go (8), task/checkpoint_schema.go (7), +8 more file(s). The bar is 30 methods; this is 47 over it, 2.57× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Scheduler internal/kernel/scheduler.go:32 — TooManyMethods — 60 methods, declared across 9 files: kernel/executor_registry.go (15), kernel/scheduler.go (11), kernel/scheduler_execute.go (8), kernel/scheduler_dispatch.go (7), +5 more file(s). The bar is 30 methods; this is 30 over it, 2.00× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Fabric internal/fabric/agent/fabric.go:19 — TooManyMethods — 50 methods, declared across 9 files: agent/fabric.go (12), agent/lifecycle.go (10), agent/context.go (8), agent/governance.go (6), +5 more file(s). The bar is 30 methods; this is 20 over it, 1.67× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Population internal/runtime/ares_evolution/genome/population.go:28 — TooManyMethods — 49 methods, declared across 4 files: genome/population.go (22), genome/adaptive.go (11), genome/population_guard.go (10), genome/population_history.go (6). The bar is 30 methods; this is 19 over it, 1.63× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Manager internal/runtime/manager.go:49 — TooManyMethods — 38 methods, declared across 3 files: runtime/manager.go (18), runtime/manager_chaos.go (14), runtime/manager_lifecycle.go (6). The bar is 30 methods; this is 8 over it, 1.27× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: actionHandler cmd/ares/agent.go:80 — TooManyMethods — 35 methods, declared across 7 files: ares/agent.go (12), ares/agent_routes_tools.go (8), ares/agent_routes_task_read.go (4), ares/agent_routes_tasks.go (4), +3 more file(s). The bar is 30 methods; this is 5 over it, 1.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: memoryManager internal/runtime/memory/manager_impl.go:32 — TooManyMethods — 35 methods, declared across 4 files: memory/manager_impl.go (30), memory/manager_rag.go (3), memory/manager_distill_wire.go (1), memory/manager_status.go (1). The bar is 30 methods; this is 5 over it, 1.17× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Calculator internal/tools/resources/builtin/math/calculator.go:22 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D3 · God Classes · FunctionTooLong · ×8
  • FunctionTooLong: observability.NewPrometheusMetrics internal/runtime/observability/prometheus.go:75 — FunctionTooLong — NewPrometheusMetrics runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: main.runKernelRecoveryLoop cmd/ares/kernel_loop.go:389 — FunctionTooLong — runKernelRecoveryLoop runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× 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: arena.RunScenarioReport internal/runtime/arena/scenario.go:117 — FunctionTooLong — RunScenarioReport runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.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: planner.BuiltinCapabilities internal/tools/planner/capdef.go:33 — FunctionTooLong — BuiltinCapabilities runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: planner.defaultRules internal/tools/planner/analyzer.go:59 — FunctionTooLong — defaultRules runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ares_skills.CatalogTools internal/runtime/protocol/skills/tools.go:58 — FunctionTooLong — CatalogTools runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.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: builtin.RegisterGeneralTools internal/tools/resources/builtin/builtin.go:95 — FunctionTooLong — RegisterGeneralTools runs 108 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 8 over it, 1.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ares_bootstrap.ProvideNewEvolution internal/ares_bootstrap/provide_new_evolution.go:135 — FunctionTooLong — ProvideNewEvolution runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D30 · Dependency Vulnerabilities · Medium CVE · ×8
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · FileTooLong · ×7
  • FileTooLong: service/service.go internal/runtime/ares_evolution/service/service.go — FileTooLong — 579 significant lines (blank, comment-only and punctuation-only lines excluded), about 71% of them inside a single declaration: Service (20 blocks, 43-1078). The bar is 500 significant lines; this is 79 over it, 1.16× 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: ares/serve_arena.go cmd/ares/serve_arena.go — FileTooLong — 564 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 64 over it, 1.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: memory/manager_impl.go internal/runtime/memory/manager_impl.go — FileTooLong — 559 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: memoryManager (31 blocks, 32-1086). The bar is 500 significant lines; this is 59 over it, 1.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: math/calculator.go internal/tools/resources/builtin/math/calculator.go — FileTooLong — 557 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 57 over it, 1.11× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: engine/mutable_dag.go internal/fabric/task/workflow/engine/mutable_dag.go — FileTooLong — 536 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: MutableDAG (30 blocks, 34-990). The bar is 500 significant lines; this is 36 over it, 1.07× 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: postgres/store.go internal/knowledge/store/postgres/store.go — FileTooLong — 515 significant lines (blank, comment-only and punctuation-only lines excluded), about 61% of them inside a single declaration: Store (16 blocks, 25-850). The bar is 500 significant lines; this is 15 over it, 1.03× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: genome/population.go internal/runtime/ares_evolution/genome/population.go — FileTooLong — 503 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: Population (23 blocks, 28-1052). The bar is 500 significant lines; this is 3 over it, 1.01× 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×7
  • Duplicated block (14 lines × 2) internal/fabric/task/workflow/engine/reloader.go:417 — internal/fabric/task/workflow/engine/reloader.go:417-430 | internal/fabric/task/workflow/engine/reloader.go:437-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) internal/knowledge/pipeline/llm_summarizer.go:101 — internal/knowledge/pipeline/llm_summarizer.go:101-114 | internal/knowledge/pipeline/normalizer.go:89-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) internal/knowledge/store/postgres/store.go:596 — internal/knowledge/store/postgres/store.go:596-609 | internal/knowledge/store/sqlite/store.go:585-598 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:596` it begins part-way through the construct above it, so those exact lines 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) internal/runtime/ares_evolution/experience/memory_store.go:165 — internal/runtime/ares_evolution/experience/memory_store.go:165-178 | internal/runtime/ares_evolution/experience/memory_store.go:272-285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/experience/memory_store.go: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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (14 lines × 2) internal/runtime/ares_evolution/genome/population_guard.go:483 — internal/runtime/ares_evolution/genome/population_guard.go:483-496 | internal/runtime/ares_evolution/genome/population_guard.go:539-552 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/genome/population_guard.go:483` it begins part-way through the construct above it, so those exact lines 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) internal/storage/postgres/repositories/experience_repository.go:175 — internal/storage/postgres/repositories/experience_repository.go:175-188 | internal/storage/postgres/repositories/knowledge_repository.go:382-395 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (14 lines × 2) REDACTED:392 — REDACTED:392-405 | REDACTED:489-502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:392` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×7
  • Duplicated block (13 lines × 2) internal/agentipc/primitives.go:78 — internal/agentipc/primitives.go:78-90 | internal/agentipc/primitives.go:169-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/agentipc/primitives.go:78` 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) internal/fabric/task/workflow/engine/mutable_dag.go:244 — internal/fabric/task/workflow/engine/mutable_dag.go:244-256 | internal/fabric/task/workflow/engine/mutable_dag.go:304-316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (13 lines × 2) internal/knowledge/store/postgres/store.go:433 — internal/knowledge/store/postgres/store.go:433-445 | internal/knowledge/store/sqlite/store.go:544-556 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:433` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/runtime/observability/flight/genealogy.go:298 — internal/runtime/observability/flight/genealogy.go:298-310 | internal/runtime/observability/flight/graph.go:219-231 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `g *Genealogy) RecordPromotion(agentID` in one and `g *Graph) UpdateNodeStatus(id` 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 (13 lines × 2) internal/runtime/protocol/mcp/server.go:472 — internal/runtime/protocol/mcp/server.go:472-484 | internal/runtime/protocol/mcp/server.go:724-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 `internal/runtime/protocol/mcp/server.go:472` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (13 lines × 2) internal/storage/postgres/repositories/secret_repository.go:337 — internal/storage/postgres/repositories/secret_repository.go:337-349 | internal/storage/postgres/repositories/secret_repository.go:836-848 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/repositories/secret_repository.go:337` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) REDACTED:81 — REDACTED:81-93 | REDACTED:112-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D3 · God Classes · MethodTooLong · ×6
  • MethodTooLong: Population.doEvolve internal/runtime/ares_evolution/genome/population.go:272 — MethodTooLong — doEvolve runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.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: Service.CreateWiredSystem internal/runtime/ares_evolution/service/service.go:134 — MethodTooLong — CreateWiredSystem runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MutableDAG.ReplaceNode internal/fabric/task/workflow/engine/mutable_dag.go:784 — MethodTooLong — ReplaceNode runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.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: DreamCycle.findWinner internal/runtime/ares_evolution/dream_cycle_winner.go:84 — MethodTooLong — findWinner runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× 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: Service.Execute internal/runtime/arena/service.go:71 — MethodTooLong — Execute runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.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.
  • MethodTooLong: FileTools.listFiles internal/tools/resources/builtin/file/file_tools.go:418 — MethodTooLong — listFiles runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×6
  • Duplicated block (16 lines × 2) internal/ares_security/sanitizer.go:387 — internal/ares_security/sanitizer.go:387-402 | internal/ares_security/sanitizer.go:407-422 — both copies are in the same file, so extract the 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 (16 lines × 2) internal/aresrecovery/deterministic_scorer.go:61 — internal/aresrecovery/deterministic_scorer.go:61-76 | internal/aresrecovery/deterministic_scorer.go:82-97 — both copies are in the same file, so extract the 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 (16 lines × 2) internal/knowledge/store/postgres/store.go:797 — internal/knowledge/store/postgres/store.go:797-812 | internal/knowledge/store/sqlite/store.go:783-798 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:797` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (16 lines × 2) internal/runtime/archive/extract.go:370 — internal/runtime/archive/extract.go:370-385 | internal/runtime/archive/extract.go:455-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/archive/extract.go:370` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/runtime/ares_evolution/channel_feedback.go:211 — internal/runtime/ares_evolution/channel_feedback.go:211-226 | internal/runtime/ares_evolution/lifecycle.go:665-680 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/runtime/ares_evolution/channel_feedback.go:206` calls `write` and `internal/runtime/ares_evolution/lifecycle.go:660` 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 (16 lines × 2) internal/storage/postgres/repositories/experience_repository.go:225 — internal/storage/postgres/repositories/experience_repository.go:225-240 | REDACTED:263-278 — 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 `internal/storage/postgres/repositories/experience_repository.go:225` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×6
  • Duplicated block (5 lines × 2) internal/ares_events/compactor.go:506 — internal/ares_events/compactor.go:506-510 | internal/ares_events/compactor.go:516-520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/ares_events/compactor.go:506` it does not close everything it opens, so those exact lines 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) internal/storage/postgres/repositories/experience_repository.go:390 — internal/storage/postgres/repositories/experience_repository.go:390-394 | internal/storage/postgres/repositories/knowledge_repository.go:654-658 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (5 lines × 2) internal/storage/postgres/repositories/knowledge_repository.go:566 — internal/storage/postgres/repositories/knowledge_repository.go:566-570 | internal/storage/postgres/repositories/knowledge_repository.go:669-673 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/repositories/knowledge_repository.go:566` it begins part-way through the construct above it, so those 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, `internal/storage/postgres/repositories/knowledge_repository.go:571` calls `Warn` and `internal/storage/postgres/repositories/knowledge_repository.go:674` 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 × 2) internal/runtime/memory/context/retriever.go:128 — internal/runtime/memory/context/retriever.go:128-132 | internal/runtime/memory/distillation/scorer.go:230-234 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) internal/introspect/flight.go:132 — internal/introspect/flight.go:132-136 | internal/introspect/flight.go:160-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) internal/tools/resources/builtin/math/calculator.go:316 — internal/tools/resources/builtin/math/calculator.go:316-320 | internal/tools/resources/builtin/math/calculator.go:331-335 — both copies are in the same file, so extract the 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.
D29 · Static Analysis (SAST) · REDACTED · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×5
  • Duplicated block (17 lines × 2) internal/knowledge/store/memory/store.go:165 — internal/knowledge/store/memory/store.go:165-181 | internal/knowledge/store/memory/store.go:348-364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/store/memory/store.go: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 (17 lines × 2) internal/knowledge/store/postgres/store.go:617 — internal/knowledge/store/postgres/store.go:617-633 | internal/knowledge/store/sqlite/store.go:608-624 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:617` it begins part-way through the construct above it, so those exact lines 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) internal/llm/client.go:491 — internal/llm/client.go:491-507 | internal/llm/generate.go:161-177 — 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) internal/storage/postgres/profile.go:76 — internal/storage/postgres/profile.go:76-92 | internal/storage/postgres/profile.go:203-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/profile.go:76` it does not close everything it opens, so those exact lines 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) internal/storage/postgres/repositories/knowledge_repository.go:109 — internal/storage/postgres/repositories/knowledge_repository.go:109-126 | internal/storage/postgres/repositories/knowledge_repository.go:148-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/repositories/knowledge_repository.go:109` it begins part-way through the construct above it, so those 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.
D23 · Boundary Type-Coupling · Cross-context type TaskResult (core → agents) · ×4
  • Cross-context type TaskResult (core → agents) internal/agents/outputguard/guard.go:45 — TaskResult (context core) is exposed in agents's public surface via Guard.ValidateResult — couples the contexts.
  • Cross-context type TaskResult (core → agents) internal/agents/sub/agent.go:35 — TaskResult (context core) is exposed in agents's public surface via Agent.Execute — couples the contexts.
  • Cross-context type TaskResult (core → agents) internal/agents/sub/agent.go:47 — TaskResult (context core) is exposed in agents's public surface via StepOutcome.Result — couples the contexts.
  • Cross-context type TaskResult (core → agents) internal/agents/sub/agent.go:62 — TaskResult (context core) is exposed in agents's public surface via TaskExecutor.Execute — couples the contexts.
D3 · God Classes · ClassTooLong · ×4
  • ClassTooLong: MutableDAG internal/fabric/task/workflow/engine/mutable_dag.go:34 — ClassTooLong — 480 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods, 30 blocks, lines 34-990. The bar is 400 significant lines; this is 80 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: memoryManager internal/runtime/memory/manager_impl.go:32 — ClassTooLong — 477 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods, 31 blocks, lines 32-1086. The bar is 400 significant lines; this is 77 over it, 1.19× 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: Population internal/runtime/ares_evolution/genome/population.go:28 — ClassTooLong — 447 significant lines (blank, comment-only and punctuation-only lines excluded), 49 methods, 23 blocks, lines 28-1052. The bar is 400 significant lines; this is 47 over it, 1.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Service internal/runtime/ares_evolution/service/service.go:43 — ClassTooLong — 409 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods, 20 blocks, lines 43-1078. The bar is 400 significant lines; this is 9 over it, 1.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×4
  • Duplicated block (10 lines × 3) cmd/ares/serve_wiring.go:360 — cmd/ares/serve_wiring.go:360-369 | internal/ares_bootstrap/bootstrap_builder.go:284-293 | internal/ares_bootstrap/provide_distillation.go:59-68 — 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 `cmd/ares/serve_wiring.go:360` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/ares_bootstrap/bootstrap_builder.go`, `internal/ares_bootstrap/provide_distillation.go` sit under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (10 lines × 3) internal/tools/resources/builtin/embedding/embedding.go:151 — internal/tools/resources/builtin/embedding/embedding.go:151-160 | internal/tools/resources/builtin/embedding/embedding.go:193-202 | internal/tools/resources/builtin/embedding/embedding.go:253-262 — all 3 copies are in the same file, so extract the block into one function there and call 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 3) internal/runtime/memory/context/session.go:151 — internal/runtime/memory/context/session.go:151-160 | internal/runtime/memory/context/task.go:93-102 | internal/runtime/memory/distillation/resolver.go:47-56 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note first that the copies are not typed on the same thing: the declarations holding them bind `int` to `m *SessionMemory) Reconfigure(maxSize` in one and `m *TaskMemory) Reconfigure(maxSize` 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 (10 lines × 3) internal/agents/peer/registry.go:73 — internal/agents/peer/registry.go:73-82 | internal/fabric/agent/fabric.go:191-200 | internal/knowledge/provider/registry.go:61-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×4
  • Duplicated block (9 lines × 3) cmd/ares/agent_routes_interrupts.go:23 — cmd/ares/agent_routes_interrupts.go:23-31 | cmd/ares/agent_routes_interrupts.go:55-63 | cmd/ares/agent_routes_task_read.go:187-195 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) internal/knowledge/compiler/compiler.go:171 — internal/knowledge/compiler/compiler.go:171-180 | internal/knowledge/compiler/compiler.go:229-238 | internal/knowledge/compiler/compiler.go:336-344 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/knowledge/compiler/compiler.go:171` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) internal/runtime/evolution/llm_adapter.go:254 — internal/runtime/evolution/llm_adapter.go:254-262 | internal/runtime/evolution/llm_adapter.go:279-287 | internal/runtime/evolution/llm_adapter.go:304-312 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/runtime/evolution/llm_adapter.go:254` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) REDACTED:324 — REDACTED:324-332 | REDACTED:426-434 | REDACTED:523-531 — all 3 copies are in the same file, so extract the block into one function there and call 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:324` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D6 · Cohesion (LCOM4) · Low cohesion · ×4
  • Low cohesion: PrometheusMetrics (LCOM4 21) internal/runtime/observability/prometheus.go:23 — PrometheusMetrics's methods fall into 21 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 21 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: Handler (LCOM4 5) internal/runtime/arena/http.go:25 — Handler'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: sseTransport (LCOM4 4) internal/mcpclient/sse.go:23 — sseTransport's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Metrics (LCOM4 4) internal/runtime/observability/metrics.go:13 — Metrics'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.
D23 · Boundary Type-Coupling · Cross-context type MutableDAG (fabric → runtime) · ×3
  • Cross-context type MutableDAG (fabric → runtime) REDACTED:88 — MutableDAG (context fabric) is exposed in runtime's public surface via genome.NewWorkflowGenome — couples the contexts.
  • Cross-context type MutableDAG (fabric → runtime) REDACTED:99 — MutableDAG (context fabric) is exposed in runtime's public surface via WorkflowGenome.SetDAG — couples the contexts.
  • Cross-context type MutableDAG (fabric → runtime) REDACTED:110 — MutableDAG (context fabric) is exposed in runtime's public surface via WorkflowGenome.DAG — couples the contexts.
D31 · IaC & Container Security · Medium IaC · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×3
  • Duplicated block (14 lines × 3) internal/storage/postgres/repositories/knowledge_repository.go:672 — internal/storage/postgres/repositories/knowledge_repository.go:672-685 | internal/storage/postgres/repositories/knowledge_repository.go:735-748 | internal/storage/postgres/repositories/knowledge_repository.go:810-823 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/storage/postgres/repositories/knowledge_repository.go:672` it begins part-way through the construct above it, so those exact lines 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) internal/storage/postgres/repositories/experience_repository.go:164 — internal/storage/postgres/repositories/experience_repository.go:164-177 | internal/storage/postgres/repositories/knowledge_repository.go:369-384 | REDACTED:174-187 — 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 `internal/storage/postgres/repositories/experience_repository.go:164` it begins part-way through the construct above it, so those exact lines 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) internal/llm/failover.go:239 — internal/llm/failover.go:239-252 | internal/llm/failover.go:318-331 | internal/llm/failover.go:490-503 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/llm/failover.go:239` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×3
  • Duplicated block (12–13 lines × 2) internal/ares_events/memory_summary_repo.go:43 — internal/ares_events/memory_summary_repo.go:43-54 | internal/ares_events/memory_summary_repo.go:64-76 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/ares_events/memory_summary_repo.go:64` it begins part-way through the construct above it, so those 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) internal/ares_ratelimit/sliding_window.go:107 — internal/ares_ratelimit/sliding_window.go:107-119 | internal/ares_ratelimit/sliding_window.go:148-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/ares_ratelimit/sliding_window.go:107` 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 × 2) internal/storage/postgres/repositories/secret_repository.go:379 — internal/storage/postgres/repositories/secret_repository.go:379-391 | internal/storage/postgres/repositories/secret_repository.go:644-655 — both copies are in the same file, so extract the 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×3
  • Duplicated block (7 lines × 3) internal/fabric/task/fabric_lifecycle.go:613 — internal/fabric/task/fabric_lifecycle.go:613-619 | internal/fabric/task/fabric_lifecycle.go:667-673 | internal/fabric/task/fabric_lifecycle.go:1020-1026 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/fabric/task/fabric_lifecycle.go:613` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 3) REDACTED:132 — REDACTED:132-138 | REDACTED:122-128 | REDACTED:181-187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) internal/llm/generate.go:218 — internal/llm/generate.go:218-224 | internal/llm/generate.go:303-309 | internal/llm/generate.go:388-394 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/llm/generate.go:218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/llm/generate.go:215` calls `Set` and `internal/llm/generate.go:300` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×3
  • Duplicated block (8 lines × 3) internal/kernel/registry.go:87 — internal/kernel/registry.go:87-94 | internal/kernel/registry.go:97-104 | internal/runtime/manager.go:331-338 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 3) internal/llm/chat.go:175 — internal/llm/chat.go:175-182 | internal/llm/chat.go:293-300 | internal/llm/chat.go:491-498 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/llm/chat.go:175` it begins part-way through the construct above it, so those 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) internal/llm/client.go:540 — internal/llm/client.go:540-547 | internal/llm/client.go:634-641 | internal/llm/client.go:750-757 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/llm/client.go:540` it does not close everything it opens, so those 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, `internal/llm/client.go:631` calls `Set` and `internal/llm/client.go:537` 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.
D1 · Cyclomatic Complexity · Store.HybridSearch (cyclomatic 20) · ×2
  • Store.HybridSearch (cyclomatic 20) internal/knowledge/store/memory/store.go:337 — Store.HybridSearch 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.
  • Store.HybridSearch (cyclomatic 20) internal/knowledge/store/sqlite/store.go:566 — Store.HybridSearch 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.
D23 · Boundary Type-Coupling · Cross-context type TaskResult (core → runtime) · ×2
  • Cross-context type TaskResult (core → runtime) internal/runtime/protocol/ahp/message.go:81 — TaskResult (context core) is exposed in runtime's public surface via ahp.NewResultMessage — couples the contexts.
  • Cross-context type TaskResult (core → runtime) internal/runtime/protocol/ahp/message.go:129 — TaskResult (context core) is exposed in runtime's public surface via AHPMessage.GetResult — couples the contexts.
D3 · God Classes · TooManyFields · ×2
  • TooManyFields: Runtime sdk/sdk.go:117 — TooManyFields — 40 stored fields beside 24 methods. The bar is 30 stored fields; this is 10 over it, 1.33× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: SystemConfig internal/runtime/ares_evolution/service/types.go:291 — TooManyFields — 34 stored fields. 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.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (6 members, 50+ identical tokens) internal/fabric/task/fabric_lifecycle.go:291 — internal/fabric/task/fabric_lifecycle.go:291-305 | internal/fabric/task/fabric_lifecycle.go:311-334 | internal/fabric/task/fabric_lifecycle.go:339-353 | internal/fabric/task/fabric_lifecycle.go:368-383 | internal/fabric/task/fabric_lifecycle.go:580-604 | internal/fabric/task/fabric_schedule.go:81-101 — 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) internal/knowledge/store/postgres/store.go:271 — internal/knowledge/store/postgres/store.go:271-335 | internal/knowledge/store/postgres/store.go:352-384 | internal/knowledge/store/postgres/store.go:773-821 | internal/knowledge/store/sqlite/store.go:259-326 | internal/knowledge/store/sqlite/store.go:343-375 | internal/knowledge/store/sqlite/store.go:763-807 — 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 · Duplicated block (28 lines × 2) · ×2
  • Duplicated block (28 lines × 2) internal/knowledge/mcp/mcp.go:160 — internal/knowledge/mcp/mcp.go:160-187 | internal/knowledge/mcp/mcp.go:202-229 — both copies are in the same file, so extract the 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 (28 lines × 2) internal/tools/resources/builtin/execution/code_runner.go:75 — internal/tools/resources/builtin/execution/code_runner.go:75-102 | internal/tools/resources/builtin/execution/code_runner.go:121-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/tools/resources/builtin/execution/code_runner.go:75` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–26 lines × 2) · ×2
  • Duplicated block (24–26 lines × 2) internal/runtime/ares_evolution/experience/memory_store.go:219 — internal/runtime/ares_evolution/experience/memory_store.go:219-244 | internal/runtime/ares_evolution/experience/memory_store.go:336-359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (24–26 lines × 2) REDACTED:36 — REDACTED:36-59 | REDACTED:224-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19–21 lines × 2) · ×2
  • Duplicated block (19–21 lines × 2) internal/runtime/ares_evolution/experience/types.go:241 — internal/runtime/ares_evolution/experience/types.go:241-261 | internal/runtime/ares_evolution/experience/types.go:326-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/experience/types.go: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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19–21 lines × 2) internal/runtime/ares_evolution/genome_wiring_builders.go:237 — internal/runtime/ares_evolution/genome_wiring_builders.go:237-255 | internal/runtime/ares_evolution/rollback_policy.go:584-604 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (19–20 lines × 3) · ×2
  • Duplicated block (19–20 lines × 3) internal/knowledge/store/postgres/store.go:316 — internal/knowledge/store/postgres/store.go:316-335 | internal/knowledge/store/postgres/store.go:365-384 | internal/knowledge/store/postgres/store.go:803-821 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/knowledge/store/postgres/store.go:316` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (19–20 lines × 3) internal/knowledge/store/sqlite/store.go:307 — internal/knowledge/store/sqlite/store.go:307-326 | internal/knowledge/store/sqlite/store.go:356-375 | internal/knowledge/store/sqlite/store.go:789-807 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/knowledge/store/sqlite/store.go:307` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×2
  • Duplicated block (18 lines × 2) internal/discovery/providers/filesystem.go:135 — internal/discovery/providers/filesystem.go:135-152 | internal/discovery/providers/filesystem.go:196-213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/discovery/providers/filesystem.go:135` it begins part-way through the construct above it, so those 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 (18 lines × 2) internal/knowledge/store/postgres/store.go:493 — internal/knowledge/store/postgres/store.go:493-510 | internal/knowledge/store/sqlite/store.go:414-431 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:493` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×2
  • Duplicated block (17–18 lines × 2) internal/knowledge/store/postgres/store.go:272 — internal/knowledge/store/postgres/store.go:272-289 | internal/knowledge/store/postgres/store.go:707-723 — both copies are in the same file, so extract the block into 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) internal/llm/generate.go:218 — internal/llm/generate.go:218-234 | internal/llm/generate.go:303-320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/llm/generate.go:218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. 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, `internal/llm/generate.go:215` calls `Set` and `internal/llm/generate.go:300` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) internal/evidence/evidence.go:186 — internal/evidence/evidence.go:186-202 | internal/evidence/postgres_store.go:242-257 — 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 (16–17 lines × 2) internal/runtime/ares_evolution/report.go:272 — internal/runtime/ares_evolution/report.go:272-288 | internal/runtime/ares_evolution/report.go:313-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) internal/knowledge/provider/postgres/provider.go:106 — internal/knowledge/provider/postgres/provider.go:106-120 | internal/knowledge/provider/vector/provider.go:137-152 — 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–16 lines × 2) internal/tools/planner/evidence.go:138 — internal/tools/planner/evidence.go:138-152 | internal/tools/planner/scorer.go:56-71 — 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 `internal/tools/planner/evidence.go:138` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×2
  • Duplicated block (15 lines × 3) internal/knowledge/provider/code/provider.go:172 — internal/knowledge/provider/code/provider.go:172-186 | internal/knowledge/provider/memory/provider.go:88-102 | internal/knowledge/provider/store/provider.go:134-148 — 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 `internal/knowledge/provider/code/provider.go:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (15 lines × 3) internal/runtime/ares_evolution/genome/selection.go:336 — internal/runtime/ares_evolution/genome/selection.go:336-350 | internal/runtime/ares_evolution/genome/selection.go:597-611 | internal/runtime/ares_evolution/genome/selection.go:735-749 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/runtime/ares_evolution/genome/selection.go:336` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×2
  • Duplicated block (10–11 lines × 2) internal/evoapi/genome/genome.go:213 — internal/evoapi/genome/genome.go:213-222 | internal/runtime/ares_evolution/genome/crossover.go:508-518 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–11 lines × 2) REDACTED:127 — REDACTED:127-136 | REDACTED:156-166 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:127` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×2
  • Duplicated block (8 lines × 6) internal/fabric/task/fabric_lifecycle.go:292 — internal/fabric/task/fabric_lifecycle.go:292-299 | internal/fabric/task/fabric_lifecycle.go:312-319 | internal/fabric/task/fabric_lifecycle.go:340-347 | internal/fabric/task/fabric_lifecycle.go:369-376 | internal/fabric/task/fabric_lifecycle.go:581-588 | internal/fabric/task/fabric_schedule.go:82-89 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 6) internal/fabric/agent/reclaim.go:306 — internal/fabric/agent/reclaim.go:306-313 | internal/kernel/registry.go:256-263 | internal/runtime/ares_evolution/experiment_record.go:187-194 | internal/runtime/ares_evolution/mutation/guided_mutator.go:405-412 | internal/runtime/memory/report/formatter.go:170-177 | internal/runtime/memory/report/formatter.go:180-187 — there are 6 copies across 5 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.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×2
  • Duplicated block (6 lines × 3) internal/agents/sub/agent.go:434 — internal/agents/sub/agent.go:434-439 | internal/agents/sub/agent.go:452-457 | internal/agents/sub/agent.go:593-598 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/agents/sub/agent.go:434` it does not close everything it opens, so those exact lines 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) internal/storage/postgres/repositories/knowledge_repository.go:664 — internal/storage/postgres/repositories/knowledge_repository.go:664-669 | internal/storage/postgres/repositories/knowledge_repository.go:727-732 | internal/storage/postgres/repositories/knowledge_repository.go:802-807 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/storage/postgres/repositories/knowledge_repository.go: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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×2
  • Duplicated block (5 lines × 3) internal/storage/postgres/repositories/knowledge_repository.go:365 — internal/storage/postgres/repositories/knowledge_repository.go:365-369 | internal/storage/postgres/repositories/knowledge_repository.go:731-735 | internal/storage/postgres/repositories/knowledge_repository.go:806-810 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/storage/postgres/repositories/knowledge_repository.go:365` 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) internal/llm/client.go:548 — internal/llm/client.go:548-552 | internal/llm/client.go:642-646 | internal/llm/client.go:758-762 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/llm/client.go:548` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) internal/apitools/tools.go:141 — internal/apitools/tools.go:141-146 | internal/runtime/protocol/mcp/client.go:272-277 | internal/tools/resources/core/factory.go:118-123 | internal/tools/resources/core/registry.go:91-97 — 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 4) internal/storage/postgres/repositories/experience_repository.go:296 — internal/storage/postgres/repositories/experience_repository.go:296-301 | internal/storage/postgres/repositories/experience_repository.go:391-396 | internal/storage/postgres/repositories/experience_repository.go:448-453 | internal/storage/postgres/repositories/experience_repository.go:564-569 — 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung — No accessibility enforcement found — no automated accessibility check runs over the HTML your app renders. Assert the accessibility invariants over that HTML in the test suite you already have (parse the output and assert, or drive a browser), and gate that test in CI so a regression blocks the merge. What was searched, so you can tell an absence from a miss: the 1 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D1 · Cyclomatic Complexity · MutableDAG.ReplaceNode (cyclomatic 53) · ×1
  • MutableDAG.ReplaceNode (cyclomatic 53) internal/fabric/task/workflow/engine/mutable_dag.go:784 — MutableDAG.ReplaceNode has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Compactor.buildSummary (cyclomatic 48) · ×1
  • Compactor.buildSummary (cyclomatic 48) internal/ares_events/compactor.go:230 — Compactor.buildSummary 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.
D1 · Cyclomatic Complexity · Config.setDefaults (cyclomatic 44) · ×1
  • Config.setDefaults (cyclomatic 44) internal/ares_config/config_defaults.go:147 — Config.setDefaults has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · panel.html.renderOverview (cyclomatic 35) · ×1
  • panel.html.renderOverview (cyclomatic 35) internal/introspect/web/panel.html:281 — panel.html.renderOverview has cyclomatic complexity 35 (threshold 15). Of this number, 33 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.CreateWiredSystem (cyclomatic 33) · ×1
  • Service.CreateWiredSystem (cyclomatic 33) internal/runtime/ares_evolution/service/service.go:134 — Service.CreateWiredSystem has cyclomatic complexity 33 (threshold 15). Of this number, 25 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FileTools.listFiles (cyclomatic 31) · ×1
  • FileTools.listFiles (cyclomatic 31) internal/tools/resources/builtin/file/file_tools.go:418 — FileTools.listFiles has cyclomatic complexity 31 (threshold 15). Of this number, 20 points are the body's own statements and 11 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ares_events.DefaultSummarizer (cyclomatic 30) · ×1
  • ares_events.DefaultSummarizer (cyclomatic 30) internal/ares_events/compactor.go:415 — ares_events.DefaultSummarizer 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.
D1 · Cyclomatic Complexity · ConfigFile.ToOptions (cyclomatic 30) · ×1
  • ConfigFile.ToOptions (cyclomatic 30) sdk/config.go:365 — ConfigFile.ToOptions 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.
D1 · Cyclomatic Complexity · main.runCollabGraph (cyclomatic 29) · ×1
  • main.runCollabGraph (cyclomatic 29) cmd/ares/agent_routes_tasks.go:593 — main.runCollabGraph has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.runKernelRecoveryLoop (cyclomatic 29) · ×1
  • main.runKernelRecoveryLoop (cyclomatic 29) cmd/ares/kernel_loop.go:389 — main.runKernelRecoveryLoop has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 11 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 430, 522, 572). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Fabric.recordWithExtrasLocked (cyclomatic 29) · ×1
  • Fabric.recordWithExtrasLocked (cyclomatic 29) internal/fabric/task/fabric_events.go:74 — Fabric.recordWithExtrasLocked 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.
D1 · Cyclomatic Complexity · FileWatcher.scanAndLoad (cyclomatic 29) · ×1
  • FileWatcher.scanAndLoad (cyclomatic 29) internal/fabric/task/workflow/engine/reloader.go:226 — FileWatcher.scanAndLoad 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.
D1 · Cyclomatic Complexity · evolution.RunIdleEvolution (cyclomatic 29) · ×1
  • evolution.RunIdleEvolution (cyclomatic 29) internal/runtime/ares_evolution/genome_wiring_idle.go:223 — evolution.RunIdleEvolution 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.
D1 · Cyclomatic Complexity · Manager.executePhase (cyclomatic 28) · ×1
  • Manager.executePhase (cyclomatic 28) internal/ares_shutdown/manager.go:148 — Manager.executePhase has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Fabric.foldRestoreEvent (cyclomatic 28) · ×1
  • Fabric.foldRestoreEvent (cyclomatic 28) internal/fabric/task/restore.go:244 — Fabric.foldRestoreEvent has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Scheduler.executeWithCandidates (cyclomatic 28) · ×1
  • Scheduler.executeWithCandidates (cyclomatic 28) internal/kernel/scheduler_execute.go:239 — Scheduler.executeWithCandidates has cyclomatic complexity 28 (threshold 15). Of this number, 23 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.Execute (cyclomatic 28) · ×1
  • Service.Execute (cyclomatic 28) internal/runtime/arena/service.go:71 — Service.Execute has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MemoryPatchExecutor.Apply (cyclomatic 28) · ×1
  • MemoryPatchExecutor.Apply (cyclomatic 28) internal/runtime/memory/memory_patcher.go:131 — MemoryPatchExecutor.Apply has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvolutionProvider.Stream (cyclomatic 27) · ×1
  • EvolutionProvider.Stream (cyclomatic 27) internal/knowledge/provider/evolution/provider.go:93 — EvolutionProvider.Stream has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to one function literal inside it that branches (line 101). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · arena.ValidateAction (cyclomatic 27) · ×1
  • arena.ValidateAction (cyclomatic 27) internal/runtime/arena/http.go:607 — arena.ValidateAction 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.
D1 · Cyclomatic Complexity · Population.doEvolve (cyclomatic 27) · ×1
  • Population.doEvolve (cyclomatic 27) internal/runtime/ares_evolution/genome/population.go:272 — Population.doEvolve has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Store.HybridSearch (cyclomatic 26) · ×1
  • Store.HybridSearch (cyclomatic 26) internal/knowledge/store/postgres/store.go:577 — Store.HybridSearch 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.
D1 · Cyclomatic Complexity · arena.RunScenarioReport (cyclomatic 26) · ×1
  • arena.RunScenarioReport (cyclomatic 26) internal/runtime/arena/scenario.go:117 — arena.RunScenarioReport 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.
D1 · Cyclomatic Complexity · ExperienceExtractor.parseUserProfile (cyclomatic 26) · ×1
  • ExperienceExtractor.parseUserProfile (cyclomatic 26) internal/runtime/memory/distillation/extractor.go:419 — ExperienceExtractor.parseUserProfile 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.
D1 · Cyclomatic Complexity · HTTPRequest.Execute (cyclomatic 26) · ×1
  • HTTPRequest.Execute (cyclomatic 26) REDACTED:70 — HTTPRequest.Execute has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · plannerCognition.ExecuteStep (cyclomatic 25) · ×1
  • plannerCognition.ExecuteStep (cyclomatic 25) internal/fabric/agent/planner_cognition.go:494 — plannerCognition.ExecuteStep has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ControlServer.ServeHTTP (cyclomatic 25) · ×1
  • ControlServer.ServeHTTP (cyclomatic 25) internal/introspect/control.go:173 — ControlServer.ServeHTTP 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.
D1 · Cyclomatic Complexity · DreamCycle.findWinner (cyclomatic 25) · ×1
  • DreamCycle.findWinner (cyclomatic 25) internal/runtime/ares_evolution/dream_cycle_winner.go:84 — DreamCycle.findWinner has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExperienceGuidedMutator.chooseGuidedMutationType (cyclomatic 25) · ×1
  • ExperienceGuidedMutator.chooseGuidedMutationType (cyclomatic 25) internal/runtime/ares_evolution/mutation/guided_mutator.go:459 — ExperienceGuidedMutator.chooseGuidedMutationType has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KnowledgePipeline.Process (cyclomatic 24) · ×1
  • KnowledgePipeline.Process (cyclomatic 24) internal/knowledge/pipeline.go:177 — KnowledgePipeline.Process has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodeProvider.Stream (cyclomatic 24) · ×1
  • CodeProvider.Stream (cyclomatic 24) internal/knowledge/provider/code/provider.go:171 — CodeProvider.Stream has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 179). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · KnowledgeRepository.CreateBatch (cyclomatic 24) · ×1
  • KnowledgeRepository.CreateBatch (cyclomatic 24) internal/storage/postgres/repositories/knowledge_repository.go:195 — KnowledgeRepository.CreateBatch has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StringUtils.Execute (cyclomatic 24) · ×1
  • StringUtils.Execute (cyclomatic 24) internal/tools/resources/builtin/stringutils/stringutils.go:72 — StringUtils.Execute has cyclomatic complexity 24 (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.
D1 · Cyclomatic Complexity · main.runEvolutionCycle (cyclomatic 23) · ×1
  • main.runEvolutionCycle (cyclomatic 23) cmd/ares/evolution.go:92 — main.runEvolutionCycle has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · actionHandler.handleChaos (cyclomatic 23) · ×1
  • actionHandler.handleChaos (cyclomatic 23) REDACTED:27 — actionHandler.handleChaos has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · actionHandler.handleSubmitTask (cyclomatic 23) · ×1
  • actionHandler.handleSubmitTask (cyclomatic 23) cmd/ares/agent_routes_tasks.go:176 — actionHandler.handleSubmitTask has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agentsyscall.BindTools (cyclomatic 23) · ×1
  • agentsyscall.BindTools (cyclomatic 23) internal/agentsyscall/syscall.go:806 — agentsyscall.BindTools has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 810, 837, 873, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PostgresEventStore.Append (cyclomatic 23) · ×1
  • PostgresEventStore.Append (cyclomatic 23) internal/ares_events/pg_store.go:118 — PostgresEventStore.Append has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Fabric.CompilePlan (cyclomatic 23) · ×1
  • Fabric.CompilePlan (cyclomatic 23) internal/fabric/task/workflow_plan.go:121 — Fabric.CompilePlan has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DefaultReducer.Reduce (cyclomatic 23) · ×1
  • DefaultReducer.Reduce (cyclomatic 23) internal/knowledge/runtime/components.go:108 — DefaultReducer.Reduce has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Client.GenerateStream (cyclomatic 23) · ×1
  • Client.GenerateStream (cyclomatic 23) internal/llm/client.go:360 — Client.GenerateStream has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 440, 406). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Client.streamAnthropic (cyclomatic 23) · ×1
  • Client.streamAnthropic (cyclomatic 23) internal/llm/client.go:601 — Client.streamAnthropic has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 654). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SecretRepository.Import (cyclomatic 23) · ×1
  • SecretRepository.Import (cyclomatic 23) internal/storage/postgres/repositories/secret_repository.go:615 — SecretRepository.Import has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.setupPeerRegistry (cyclomatic 22) · ×1
  • main.setupPeerRegistry (cyclomatic 22) cmd/ares/serve_peer.go:356 — main.setupPeerRegistry has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 378, 441, 501). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ares_bootstrap.wireRetrievers (cyclomatic 22) · ×1
  • ares_bootstrap.wireRetrievers (cyclomatic 22) internal/ares_bootstrap/retriever_wiring.go:72 — ares_bootstrap.wireRetrievers has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DAGPatchExecutor.Apply (cyclomatic 22) · ×1
  • DAGPatchExecutor.Apply (cyclomatic 22) internal/fabric/task/workflow/engine/dag_patcher.go:140 — DAGPatchExecutor.Apply has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DateTime.Execute (cyclomatic 22) · ×1
  • DateTime.Execute (cyclomatic 22) internal/tools/resources/builtin/math/calculator.go:594 — DateTime.Execute has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WebSearch.Execute (cyclomatic 22) · ×1
  • WebSearch.Execute (cyclomatic 22) internal/tools/resources/builtin/network/web_search.go:151 — WebSearch.Execute has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ares_bootstrap.ProvideNewEvolution (cyclomatic 21) · ×1
  • ares_bootstrap.ProvideNewEvolution (cyclomatic 21) internal/ares_bootstrap/provide_new_evolution.go:135 — ares_bootstrap.ProvideNewEvolution has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ares_bootstrap.buildRegressionGate (cyclomatic 21) · ×1
  • ares_bootstrap.buildRegressionGate (cyclomatic 21) internal/ares_bootstrap/regression_gate_wiring.go:75 — ares_bootstrap.buildRegressionGate has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CompactableEventStore.archivePendingRoundsOnce (cyclomatic 21) · ×1
  • CompactableEventStore.archivePendingRoundsOnce (cyclomatic 21) internal/ares_events/compactable_store.go:684 — CompactableEventStore.archivePendingRoundsOnce has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GraphPatchExecutor.CanApply (cyclomatic 21) · ×1
  • GraphPatchExecutor.CanApply (cyclomatic 21) internal/fabric/task/workflow/graph/patcher.go:98 — GraphPatchExecutor.CanApply has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DefaultEntityMatcher.MatchTokens (cyclomatic 21) · ×1
  • DefaultEntityMatcher.MatchTokens (cyclomatic 21) internal/knowledge/pipeline/normalizer.go:163 — DefaultEntityMatcher.MatchTokens has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Client.streamOpenRouter (cyclomatic 21) · ×1
  • Client.streamOpenRouter (cyclomatic 21) internal/llm/client.go:716 — Client.streamOpenRouter has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 770). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · RuntimeFitnessAggregator.querySourceMeanScopedAt (cyclomatic 21) · ×1
  • RuntimeFitnessAggregator.querySourceMeanScopedAt (cyclomatic 21) internal/runtime/ares_evolution/fitness_aggregator.go:440 — RuntimeFitnessAggregator.querySourceMeanScopedAt has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mutation.valuesEqual (cyclomatic 21) · ×1
  • mutation.valuesEqual (cyclomatic 21) internal/runtime/ares_evolution/mutation/mutator.go:576 — mutation.valuesEqual 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 taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
D1 · Cyclomatic Complexity · Collector.processEvent (cyclomatic 21) · ×1
  • Collector.processEvent (cyclomatic 21) internal/runtime/observability/flight/collector.go:253 — Collector.processEvent has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MCPConfigWatcher.Start (cyclomatic 21) · ×1
  • MCPConfigWatcher.Start (cyclomatic 21) internal/runtime/protocol/mcp/config_watcher.go:103 — MCPConfigWatcher.Start has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UserProfile.Execute (cyclomatic 21) · ×1
  • UserProfile.Execute (cyclomatic 21) internal/tools/resources/builtin/memory/memory_tools.go:174 — UserProfile.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.
D1 · Cyclomatic Complexity · ConfigStore.Watch (cyclomatic 20) · ×1
  • ConfigStore.Watch (cyclomatic 20) internal/ares_config/store.go:115 — ConfigStore.Watch has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Engine.DiscoverNow (cyclomatic 20) · ×1
  • Engine.DiscoverNow (cyclomatic 20) internal/discovery/engine.go:50 — Engine.DiscoverNow has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Fabric.ReclaimIdle (cyclomatic 20) · ×1
  • Fabric.ReclaimIdle (cyclomatic 20) internal/fabric/agent/reclaim.go:137 — Fabric.ReclaimIdle has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · plannerCognition.growToolNodes (cyclomatic 20) · ×1
  • plannerCognition.growToolNodes (cyclomatic 20) internal/fabric/agent/planner_cognition.go:737 — plannerCognition.growToolNodes has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · llm.withRetry (cyclomatic 20) · ×1
  • llm.withRetry (cyclomatic 20) internal/llm/resilience.go:257 — llm.withRetry has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FailoverClient.GenerateStream (cyclomatic 20) · ×1
  • FailoverClient.GenerateStream (cyclomatic 20) internal/llm/failover.go:317 — FailoverClient.GenerateStream has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RegressionTester.runAdaptive (cyclomatic 20) · ×1
  • RegressionTester.runAdaptive (cyclomatic 20) internal/runtime/arena/regression.go:332 — RegressionTester.runAdaptive has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DefaultNormalizer.Normalize (cyclomatic 20) · ×1
  • DefaultNormalizer.Normalize (cyclomatic 20) internal/runtime/ares_evolution/experience/normalizer.go:59 — DefaultNormalizer.Normalize 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.
D1 · Cyclomatic Complexity · Manager.Stop (cyclomatic 20) · ×1
  • Manager.Stop (cyclomatic 20) internal/runtime/manager_lifecycle.go:114 — Manager.Stop has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.liveChaosLoop (cyclomatic 19) · ×1
  • main.liveChaosLoop (cyclomatic 19) cmd/ares/serve_chaos_domain.go:341 — main.liveChaosLoop has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · providers.scanConfigFile (cyclomatic 19) · ×1
  • providers.scanConfigFile (cyclomatic 19) internal/discovery/providers/filesystem.go:110 — providers.scanConfigFile has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · evolution.ReportString (cyclomatic 19) · ×1
  • evolution.ReportString (cyclomatic 19) internal/runtime/ares_evolution/report.go:357 — evolution.ReportString has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · memoryManager.BuildContext (cyclomatic 19) · ×1
  • memoryManager.BuildContext (cyclomatic 19) internal/runtime/memory/manager_impl.go:582 — memoryManager.BuildContext has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · panel.html.renderExec (cyclomatic 19) · ×1
  • panel.html.renderExec (cyclomatic 19) internal/introspect/web/panel.html:462 — panel.html.renderExec has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Sessions.Admit (cyclomatic 18) · ×1
  • Sessions.Admit (cyclomatic 18) internal/agentruntime/session.go:105 — Sessions.Admit has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ares_bootstrap.applyGATuning (cyclomatic 18) · ×1
  • ares_bootstrap.applyGATuning (cyclomatic 18) internal/ares_bootstrap/bootstrap_evolution.go:699 — ares_bootstrap.applyGATuning has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · taskfabric.DecodeCheckpoint (cyclomatic 18) · ×1
  • taskfabric.DecodeCheckpoint (cyclomatic 18) internal/fabric/task/checkpoint_schema.go:188 — taskfabric.DecodeCheckpoint has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Store.Query (cyclomatic 18) · ×1
  • Store.Query (cyclomatic 18) internal/knowledge/store/memory/store.go:161 — Store.Query has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RegressionTester.runUncached (cyclomatic 18) · ×1
  • RegressionTester.runUncached (cyclomatic 18) internal/runtime/arena/regression.go:250 — RegressionTester.runUncached has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DreamCycle.runESEvolution (cyclomatic 18) · ×1
  • DreamCycle.runESEvolution (cyclomatic 18) internal/runtime/ares_evolution/dream_cycle_evolve.go:48 — DreamCycle.runESEvolution has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MetaController.Tune (cyclomatic 18) · ×1
  • MetaController.Tune (cyclomatic 18) internal/runtime/ares_evolution/genome/meta_evolution.go:102 — MetaController.Tune has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GenomePopulationAdapter.Run (cyclomatic 18) · ×1
  • GenomePopulationAdapter.Run (cyclomatic 18) internal/runtime/ares_evolution/genome_wiring_run.go:128 — GenomePopulationAdapter.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.
D1 · Cyclomatic Complexity · ContextCleaner.CleanWithTurns (cyclomatic 18) · ×1
  • ContextCleaner.CleanWithTurns (cyclomatic 18) internal/runtime/memory/context/cleaner.go:169 — ContextCleaner.CleanWithTurns has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ImportanceScorer.ScoreMemory (cyclomatic 18) · ×1
  • ImportanceScorer.ScoreMemory (cyclomatic 18) internal/runtime/memory/distillation/scorer.go:86 — ImportanceScorer.ScoreMemory has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · memoryManager.StoreDistilledTask (cyclomatic 18) · ×1
  • memoryManager.StoreDistilledTask (cyclomatic 18) internal/runtime/memory/manager_impl.go:764 — memoryManager.StoreDistilledTask has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Graph.AddNode (cyclomatic 18) · ×1
  • Graph.AddNode (cyclomatic 18) internal/runtime/observability/flight/graph.go:70 — Graph.AddNode has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Indexer.indexOne (cyclomatic 18) · ×1
  • Indexer.indexOne (cyclomatic 18) internal/runtime/protocol/skills/indexer.go:69 — Indexer.indexOne has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SecretRepository.RotateKey (cyclomatic 18) · ×1
  • SecretRepository.RotateKey (cyclomatic 18) internal/storage/postgres/repositories/secret_repository.go:373 — SecretRepository.RotateKey has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Agent.composePrompt (cyclomatic 18) · ×1
  • Agent.composePrompt (cyclomatic 18) sdk/agent.go:242 — Agent.composePrompt has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.runLiveChaosInjection (cyclomatic 17) · ×1
  • main.runLiveChaosInjection (cyclomatic 17) cmd/ares/serve_chaos_domain.go:427 — main.runLiveChaosInjection has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.printStatusText (cyclomatic 17) · ×1
  • main.printStatusText (cyclomatic 17) cmd/ares/status.go:449 — main.printStatusText has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · webSearchTool.Execute (cyclomatic 17) · ×1
  • webSearchTool.Execute (cyclomatic 17) internal/apitools/builtin.go:519 — webSearchTool.Execute has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ares_bootstrap.wireLifecycleGates (cyclomatic 17) · ×1
  • ares_bootstrap.wireLifecycleGates (cyclomatic 17) internal/ares_bootstrap/bootstrap_evolution.go:242 — ares_bootstrap.wireLifecycleGates has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NewEvolutionComponents.UpdateLiveDAG (cyclomatic 17) · ×1
  • NewEvolutionComponents.UpdateLiveDAG (cyclomatic 17) internal/ares_bootstrap/provide_new_evolution.go:388 — NewEvolutionComponents.UpdateLiveDAG has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CompactableEventStore.maybeCompact (cyclomatic 17) · ×1
  • CompactableEventStore.maybeCompact (cyclomatic 17) internal/ares_events/compactable_store.go:475 — CompactableEventStore.maybeCompact has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Orchestrator.Adopt (cyclomatic 17) · ×1
  • Orchestrator.Adopt (cyclomatic 17) internal/kernel/orchestrator.go:429 — Orchestrator.Adopt has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Scheduler.PreemptLowerPriority (cyclomatic 17) · ×1
  • Scheduler.PreemptLowerPriority (cyclomatic 17) internal/kernel/scheduler_dispatch.go:185 — Scheduler.PreemptLowerPriority has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DistillBridge.DistillConversationWithReport (cyclomatic 17) · ×1
  • DistillBridge.DistillConversationWithReport (cyclomatic 17) internal/knowledge/adapter/distill.go:192 — DistillBridge.DistillConversationWithReport has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DefaultCompiler.formatMarkdown (cyclomatic 17) · ×1
  • DefaultCompiler.formatMarkdown (cyclomatic 17) internal/knowledge/compiler/compiler.go:222 — DefaultCompiler.formatMarkdown has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KnowledgeRuntime.loadAndProcess (cyclomatic 17) · ×1
  • KnowledgeRuntime.loadAndProcess (cyclomatic 17) REDACTED:243 — KnowledgeRuntime.loadAndProcess has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 263). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · KnowledgeAgent.Process (cyclomatic 17) · ×1
  • KnowledgeAgent.Process (cyclomatic 17) internal/knowledge/workflow/workflow.go:74 — KnowledgeAgent.Process has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Client.streamOllama (cyclomatic 17) · ×1
  • Client.streamOllama (cyclomatic 17) internal/llm/client.go:513 — Client.streamOllama has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 560). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · archive.extractVerdict (cyclomatic 17) · ×1
  • archive.extractVerdict (cyclomatic 17) internal/runtime/archive/extract.go:107 — archive.extractVerdict has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FeedbackRecorder.Register (cyclomatic 17) · ×1
  • FeedbackRecorder.Register (cyclomatic 17) internal/runtime/ares_evolution/feedback_recorder.go:136 — FeedbackRecorder.Register has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EvalGate.Check (cyclomatic 17) · ×1
  • EvalGate.Check (cyclomatic 17) internal/runtime/ares_evolution/gate_eval.go:150 — EvalGate.Check has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StrategyLifecycle.evaluateAndMaybeRollback (cyclomatic 17) · ×1
  • StrategyLifecycle.evaluateAndMaybeRollback (cyclomatic 17) internal/runtime/ares_evolution/lifecycle_evidence.go:16 — StrategyLifecycle.evaluateAndMaybeRollback has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StrategyLifecycle.Submit (cyclomatic 17) · ×1
  • StrategyLifecycle.Submit (cyclomatic 17) internal/runtime/ares_evolution/lifecycle_promotion.go:28 — StrategyLifecycle.Submit has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · evolution.NewService (cyclomatic 17) · ×1
  • evolution.NewService (cyclomatic 17) internal/runtime/ares_evolution/service/service.go:73 — evolution.NewService has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · context.summarizeHTTPRequestResult (cyclomatic 17) · ×1
  • context.summarizeHTTPRequestResult (cyclomatic 17) internal/runtime/memory/context/cleaner.go:379 — context.summarizeHTTPRequestResult has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExperienceExtractor.ExtractExperiences (cyclomatic 17) · ×1
  • ExperienceExtractor.ExtractExperiences (cyclomatic 17) internal/runtime/memory/distillation/extractor.go:60 — ExperienceExtractor.ExtractExperiences has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Pipeline.Run (cyclomatic 17) · ×1
  • Pipeline.Run (cyclomatic 17) internal/runtime/memory/pipeline.go:176 — Pipeline.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.
D1 · Cyclomatic Complexity · MCPManager.ApplyConfig (cyclomatic 17) · ×1
  • MCPManager.ApplyConfig (cyclomatic 17) internal/runtime/protocol/mcp/manager.go:666 — MCPManager.ApplyConfig has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Searcher.Search (cyclomatic 17) · ×1
  • Searcher.Search (cyclomatic 17) internal/tools/envcap/envcap.go:110 — Searcher.Search has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KnowledgeUpdate.Execute (cyclomatic 17) · ×1
  • KnowledgeUpdate.Execute (cyclomatic 17) internal/tools/resources/builtin/knowledge/knowledge_base.go:233 — KnowledgeUpdate.Execute has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DataValidation.validateSchema (cyclomatic 17) · ×1
  • DataValidation.validateSchema (cyclomatic 17) REDACTED:229 — DataValidation.validateSchema has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigFile.validateKnowledge (cyclomatic 17) · ×1
  • ConfigFile.validateKnowledge (cyclomatic 17) sdk/config.go:322 — ConfigFile.validateKnowledge has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · panel.html.renderAgents (cyclomatic 17) · ×1
  • panel.html.renderAgents (cyclomatic 17) internal/introspect/web/panel.html:400 — panel.html.renderAgents has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 405, 403, 404). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · actionHandler.handleSubmitGraph (cyclomatic 16) · ×1
  • actionHandler.handleSubmitGraph (cyclomatic 16) cmd/ares/agent_routes_tasks.go:346 — actionHandler.handleSubmitGraph has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · fileTool.Execute (cyclomatic 16) · ×1
  • fileTool.Execute (cyclomatic 16) internal/apitools/builtin.go:709 — fileTool.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.
D1 · Cyclomatic Complexity · ares_bootstrap.wireMemory (cyclomatic 16) · ×1
  • ares_bootstrap.wireMemory (cyclomatic 16) internal/ares_bootstrap/bootstrap.go:319 — ares_bootstrap.wireMemory has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MemoryStore.Query (cyclomatic 16) · ×1
  • MemoryStore.Query (cyclomatic 16) internal/evidence/evidence.go:146 — MemoryStore.Query has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · answerCognition.ExecuteStep (cyclomatic 16) · ×1
  • answerCognition.ExecuteStep (cyclomatic 16) internal/fabric/agent/l2graph.go:653 — answerCognition.ExecuteStep has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Orchestrator.Shutdown (cyclomatic 16) · ×1
  • Orchestrator.Shutdown (cyclomatic 16) internal/kernel/orchestrator.go:197 — Orchestrator.Shutdown has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Scheduler.freeCapableAgents (cyclomatic 16) · ×1
  • Scheduler.freeCapableAgents (cyclomatic 16) internal/kernel/scheduler_dispatch.go:265 — Scheduler.freeCapableAgents has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DefaultCompiler.formatPrompt (cyclomatic 16) · ×1
  • DefaultCompiler.formatPrompt (cyclomatic 16) internal/knowledge/compiler/compiler.go:164 — DefaultCompiler.formatPrompt has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KnowledgeRuntime.Execute (cyclomatic 16) · ×1
  • KnowledgeRuntime.Execute (cyclomatic 16) REDACTED:133 — KnowledgeRuntime.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.
D1 · Cyclomatic Complexity · evolution.RecordPopulationLineage (cyclomatic 16) · ×1
  • evolution.RecordPopulationLineage (cyclomatic 16) internal/runtime/ares_evolution/genome_wiring_genealogy.go:253 — evolution.RecordPopulationLineage has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · evolution.GenerateReport (cyclomatic 16) · ×1
  • evolution.GenerateReport (cyclomatic 16) internal/runtime/ares_evolution/report.go:153 — evolution.GenerateReport has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Population.measureNumericDiversityLocked (cyclomatic 16) · ×1
  • Population.measureNumericDiversityLocked (cyclomatic 16) internal/runtime/ares_evolution/genome/adaptive.go:154 — Population.measureNumericDiversityLocked has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AdaptiveDistribution.normalizeBoundedLocked (cyclomatic 16) · ×1
  • AdaptiveDistribution.normalizeBoundedLocked (cyclomatic 16) internal/runtime/ares_evolution/mutation/adaptive_distribution.go:423 — AdaptiveDistribution.normalizeBoundedLocked has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LLMArenaScorer.ScoreBatch (cyclomatic 16) · ×1
  • LLMArenaScorer.ScoreBatch (cyclomatic 16) internal/runtime/ares_evolution/service/llm_arena_scorer.go:350 — LLMArenaScorer.ScoreBatch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.createRawComponents (cyclomatic 16) · ×1
  • Service.createRawComponents (cyclomatic 16) internal/runtime/ares_evolution/service/service.go:333 — Service.createRawComponents has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.Evolve (cyclomatic 16) · ×1
  • Service.Evolve (cyclomatic 16) internal/runtime/ares_evolution/service/service.go:441 — Service.Evolve has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · eval.ReplayGolden (cyclomatic 16) · ×1
  • eval.ReplayGolden (cyclomatic 16) internal/runtime/eval/replay.go:83 — eval.ReplayGolden has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ReportGenerator.GenerateMarkdown (cyclomatic 16) · ×1
  • ReportGenerator.GenerateMarkdown (cyclomatic 16) internal/runtime/eval/report.go:22 — ReportGenerator.GenerateMarkdown has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowDiffer.Diff (cyclomatic 16) · ×1
  • WorkflowDiffer.Diff (cyclomatic 16) internal/runtime/evolution/diff/workflow_differ.go:25 — WorkflowDiffer.Diff has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · distillation.IsProblem (cyclomatic 16) · ×1
  • distillation.IsProblem (cyclomatic 16) internal/runtime/memory/distillation/detector.go:19 — distillation.IsProblem has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ares_mcp.safeRequestHost (cyclomatic 16) · ×1
  • ares_mcp.safeRequestHost (cyclomatic 16) internal/runtime/protocol/mcp/transport_server.go:364 — ares_mcp.safeRequestHost has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · MCPToolFactory.Create (cyclomatic 16) · ×1
  • MCPToolFactory.Create (cyclomatic 16) internal/runtime/protocol/mcp/factory.go:38 — MCPToolFactory.Create has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EmbeddingConfig.Validate (cyclomatic 16) · ×1
  • EmbeddingConfig.Validate (cyclomatic 16) internal/storage/postgres/config.go:76 — EmbeddingConfig.Validate has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ToolExecutionBridge.executeMultiStep (cyclomatic 16) · ×1
  • ToolExecutionBridge.executeMultiStep (cyclomatic 16) internal/tools/planner/bridge.go:246 — ToolExecutionBridge.executeMultiStep has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Planner.Plan (cyclomatic 16) · ×1
  • Planner.Plan (cyclomatic 16) internal/tools/planner/planner.go:93 — Planner.Plan has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StoreAdapter.UpdateKnowledge (cyclomatic 16) · ×1
  • StoreAdapter.UpdateKnowledge (cyclomatic 16) internal/tools/resources/builtin/knowledge/store_adapter.go:80 — StoreAdapter.UpdateKnowledge has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PDFTool.extractText (cyclomatic 16) · ×1
  • PDFTool.extractText (cyclomatic 16) internal/tools/resources/builtin/pdf/pdf.go:100 — PDFTool.extractText has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CapabilitySelector.Select (cyclomatic 16) · ×1
  • CapabilitySelector.Select (cyclomatic 16) internal/tools/toolsource/capability_selector.go:174 — CapabilitySelector.Select has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · panel.html.agentRow (cyclomatic 16) · ×1
  • panel.html.agentRow (cyclomatic 16) internal/introspect/web/panel.html:419 — panel.html.agentRow has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MutableDAG.ReplaceNode (cognitive 116) · ×1
  • MutableDAG.ReplaceNode (cognitive 116) internal/fabric/task/workflow/engine/mutable_dag.go:784 — MutableDAG.ReplaceNode has cognitive complexity 116 (threshold 15). Drivers by points: if/else 29 (68 pts), loops 19 (43 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · Compactor.buildSummary (cognitive 106) · ×1
  • Compactor.buildSummary (cognitive 106) internal/ares_events/compactor.go:230 — Compactor.buildSummary has cognitive complexity 106 (threshold 15). Drivers by points: if/else 34 (92 pts), boolean chains 12, loops 1, 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.
D2 · Cognitive Complexity · FileTools.listFiles (cognitive 69) · ×1
  • FileTools.listFiles (cognitive 69) internal/tools/resources/builtin/file/file_tools.go:418 — FileTools.listFiles has cognitive complexity 69 (threshold 15). Drivers by points: if/else 30 (65 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 36). Of this number, 39 points are the body's own statements and 30 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MCPConfigWatcher.Start (cognitive 60) · ×1
  • MCPConfigWatcher.Start (cognitive 60) internal/runtime/protocol/mcp/config_watcher.go:103 — MCPConfigWatcher.Start has cognitive complexity 60 (threshold 15). Drivers by points: if/else 11 (38 pts), match/switch 4 (18 pts), loops 2 (4 pts) (nesting depth added 43). Of this number, 59 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evolution.RunIdleEvolution (cognitive 59) · ×1
  • evolution.RunIdleEvolution (cognitive 59) internal/runtime/ares_evolution/genome_wiring_idle.go:223 — evolution.RunIdleEvolution has cognitive complexity 59 (threshold 15). Drivers by points: if/else 20 (48 pts), loops 2 (5 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Fabric.recordWithExtrasLocked (cognitive 53) · ×1
  • Fabric.recordWithExtrasLocked (cognitive 53) internal/fabric/task/fabric_events.go:74 — Fabric.recordWithExtrasLocked has cognitive complexity 53 (threshold 15). Drivers by points: if/else 26 (50 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · ExperienceExtractor.parseUserProfile (cognitive 53) · ×1
  • ExperienceExtractor.parseUserProfile (cognitive 53) internal/runtime/memory/distillation/extractor.go:419 — ExperienceExtractor.parseUserProfile has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 7 (15 pts), boolean chains 4 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.executePhase (cognitive 52) · ×1
  • Manager.executePhase (cognitive 52) internal/ares_shutdown/manager.go:148 — Manager.executePhase has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 6 (15 pts), loops 5 (9 pts), jumps 2 (nesting depth added 27). Of this number, 39 points are the body's own statements and 13 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvolutionProvider.Stream (cognitive 52) · ×1
  • EvolutionProvider.Stream (cognitive 52) internal/knowledge/provider/evolution/provider.go:93 — EvolutionProvider.Stream has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (34 pts), match/switch 3 (11 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 29). None of this is in the body itself: all 52 points belong to one function literal inside it that branches (line 101). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · KnowledgePipeline.Process (cognitive 51) · ×1
  • KnowledgePipeline.Process (cognitive 51) internal/knowledge/pipeline.go:177 — KnowledgePipeline.Process has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (40 pts), loops 5 (10 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeRepository.CreateBatch (cognitive 50) · ×1
  • KnowledgeRepository.CreateBatch (cognitive 50) internal/storage/postgres/repositories/knowledge_repository.go:195 — KnowledgeRepository.CreateBatch has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (42 pts), loops 5 (8 pts) (nesting depth added 25). Of this number, 47 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Config.setDefaults (cognitive 49) · ×1
  • Config.setDefaults (cognitive 49) internal/ares_config/config_defaults.go:147 — Config.setDefaults has cognitive complexity 49 (threshold 15). Drivers by points: if/else 40 (46 pts), loops 2, boolean chains 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.
D2 · Cognitive Complexity · Service.CreateWiredSystem (cognitive 49) · ×1
  • Service.CreateWiredSystem (cognitive 49) internal/runtime/ares_evolution/service/service.go:134 — Service.CreateWiredSystem has cognitive complexity 49 (threshold 15). Drivers by points: if/else 27 (42 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 16). Of this number, 30 points are the body's own statements and 19 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_events.DefaultSummarizer (cognitive 48) · ×1
  • ares_events.DefaultSummarizer (cognitive 48) internal/ares_events/compactor.go:415 — ares_events.DefaultSummarizer has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 6, loops 1, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.runKernelRecoveryLoop (cognitive 47) · ×1
  • main.runKernelRecoveryLoop (cognitive 47) cmd/ares/kernel_loop.go:389 — main.runKernelRecoveryLoop has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (39 pts), match/switch 4 (5 pts), loops 2, boolean chains 1 (nesting depth added 21). Most of this is not in the body itself: 14 of the 47 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 430, 522, 572). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · main.setupPeerRegistry (cognitive 46) · ×1
  • main.setupPeerRegistry (cognitive 46) cmd/ares/serve_peer.go:356 — main.setupPeerRegistry has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 2 (7 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 26). Most of this is not in the body itself: 12 of the 46 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 378, 441, 501). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Fabric.foldRestoreEvent (cognitive 46) · ×1
  • Fabric.foldRestoreEvent (cognitive 46) internal/fabric/task/restore.go:244 — Fabric.foldRestoreEvent has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (35 pts), match/switch 4 (7 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.runEvolutionCycle (cognitive 45) · ×1
  • main.runEvolutionCycle (cognitive 45) cmd/ares/evolution.go:92 — main.runEvolutionCycle has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 8 (11 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.
D2 · Cognitive Complexity · ares_bootstrap.wireRetrievers (cognitive 45) · ×1
  • ares_bootstrap.wireRetrievers (cognitive 45) internal/ares_bootstrap/retriever_wiring.go:72 — ares_bootstrap.wireRetrievers has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (42 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DreamCycle.findWinner (cognitive 44) · ×1
  • DreamCycle.findWinner (cognitive 44) internal/runtime/ares_evolution/dream_cycle_winner.go:84 — DreamCycle.findWinner has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (34 pts), loops 5 (8 pts), boolean chains 2 (nesting depth added 19). Of this number, 39 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.liveChaosLoop (cognitive 43) · ×1
  • main.liveChaosLoop (cognitive 43) cmd/ares/serve_chaos_domain.go:341 — main.liveChaosLoop has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (39 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (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.
D2 · Cognitive Complexity · ConfigStore.Watch (cognitive 43) · ×1
  • ConfigStore.Watch (cognitive 43) internal/ares_config/store.go:115 — ConfigStore.Watch has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (27 pts), match/switch 3 (11 pts), loops 2 (4 pts), jumps 1 (nesting depth added 25). Of this number, 42 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileWatcher.scanAndLoad (cognitive 43) · ×1
  • FileWatcher.scanAndLoad (cognitive 43) internal/fabric/task/workflow/engine/reloader.go:226 — FileWatcher.scanAndLoad has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (28 pts), loops 9 (12 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.
D2 · Cognitive Complexity · Store.HybridSearch (cognitive 43) · ×1
  • Store.HybridSearch (cognitive 43) internal/knowledge/store/postgres/store.go:577 — Store.HybridSearch has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (31 pts), loops 6 (11 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.
D2 · Cognitive Complexity · AdaptiveDistribution.normalizeBoundedLocked (cognitive 43) · ×1
  • AdaptiveDistribution.normalizeBoundedLocked (cognitive 43) internal/runtime/ares_evolution/mutation/adaptive_distribution.go:423 — AdaptiveDistribution.normalizeBoundedLocked has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 7 (16 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.
D2 · Cognitive Complexity · UserProfile.Execute (cognitive 43) · ×1
  • UserProfile.Execute (cognitive 43) internal/tools/resources/builtin/memory/memory_tools.go:174 — UserProfile.Execute has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (35 pts), loops 2 (5 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.
D2 · Cognitive Complexity · main.runCollabGraph (cognitive 42) · ×1
  • main.runCollabGraph (cognitive 42) cmd/ares/agent_routes_tasks.go:593 — main.runCollabGraph has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 8 (10 pts), match/switch 2 (5 pts), boolean chains 4 (nesting depth added 16). Of this number, 38 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Store.Query (cognitive 42) · ×1
  • Store.Query (cognitive 42) internal/knowledge/store/memory/store.go:161 — Store.Query has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 4 (11 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · actionHandler.handleChaos (cognitive 41) · ×1
  • actionHandler.handleChaos (cognitive 41) REDACTED:27 — actionHandler.handleChaos has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 2 (4 pts), boolean chains 2, match/switch 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.
D2 · Cognitive Complexity · Fabric.CompilePlan (cognitive 41) · ×1
  • Fabric.CompilePlan (cognitive 41) internal/fabric/task/workflow_plan.go:121 — Fabric.CompilePlan has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryPatchExecutor.Apply (cognitive 40) · ×1
  • MemoryPatchExecutor.Apply (cognitive 40) internal/runtime/memory/memory_patcher.go:131 — MemoryPatchExecutor.Apply has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 7, match/switch 1 (nesting depth added 15). Of this number, 39 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_bootstrap.ProvideNewEvolution (cognitive 39) · ×1
  • ares_bootstrap.ProvideNewEvolution (cognitive 39) internal/ares_bootstrap/provide_new_evolution.go:135 — ares_bootstrap.ProvideNewEvolution has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 4 (8 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.
D2 · Cognitive Complexity · KnowledgeRuntime.loadAndProcess (cognitive 39) · ×1
  • KnowledgeRuntime.loadAndProcess (cognitive 39) REDACTED:243 — KnowledgeRuntime.loadAndProcess has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 3 (7 pts), match/switch 2 (5 pts), jumps 2, boolean chains 1 (nesting depth added 22). Most of this is not in the body itself: 7 of the 39 points are its own statements and the rest belongs to one function literal inside it that branches (line 263). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ContextCleaner.CleanWithTurns (cognitive 39) · ×1
  • ContextCleaner.CleanWithTurns (cognitive 39) internal/runtime/memory/context/cleaner.go:169 — ContextCleaner.CleanWithTurns has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 3 (7 pts), match/switch 1 (4 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · evolutionTrajectoryAdapter.EvolutionTrajectory (cognitive 38) · ×1
  • evolutionTrajectoryAdapter.EvolutionTrajectory (cognitive 38) internal/ares_bootstrap/dashboard_observability.go:50 — evolutionTrajectoryAdapter.EvolutionTrajectory has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 4 (10 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.
D2 · Cognitive Complexity · taskfabric.DecodeCheckpoint (cognitive 38) · ×1
  • taskfabric.DecodeCheckpoint (cognitive 38) internal/fabric/task/checkpoint_schema.go:188 — taskfabric.DecodeCheckpoint has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (34 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FailoverClient.GenerateStream (cognitive 38) · ×1
  • FailoverClient.GenerateStream (cognitive 38) internal/llm/failover.go:317 — FailoverClient.GenerateStream has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (28 pts), match/switch 3 (7 pts), loops 2 (3 pts) (nesting depth added 22). Of this number, 31 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExperienceExtractor.ExtractExperiences (cognitive 38) · ×1
  • ExperienceExtractor.ExtractExperiences (cognitive 38) internal/runtime/memory/distillation/extractor.go:60 — ExperienceExtractor.ExtractExperiences has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (31 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ToolExecutionBridge.executeMultiStep (cognitive 38) · ×1
  • ToolExecutionBridge.executeMultiStep (cognitive 38) internal/tools/planner/bridge.go:246 — ToolExecutionBridge.executeMultiStep has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 6 (14 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigFile.ToOptions (cognitive 38) · ×1
  • ConfigFile.ToOptions (cognitive 38) sdk/config.go:365 — ConfigFile.ToOptions has cognitive complexity 38 (threshold 15). Drivers by points: if/else 25 (36 pts), loops 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.Stop (cognitive 36) · ×1
  • Manager.Stop (cognitive 36) internal/runtime/manager_lifecycle.go:114 — Manager.Stop has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 18). Of this number, 29 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · distillation.extractEvidenceFromMessages (cognitive 35) · ×1
  • distillation.extractEvidenceFromMessages (cognitive 35) internal/runtime/memory/distillation/distiller_admin.go:239 — distillation.extractEvidenceFromMessages has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · plannerCognition.ExecuteStep (cognitive 34) · ×1
  • plannerCognition.ExecuteStep (cognitive 34) internal/fabric/agent/planner_cognition.go:494 — plannerCognition.ExecuteStep has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Scheduler.executeWithCandidates (cognitive 34) · ×1
  • Scheduler.executeWithCandidates (cognitive 34) internal/kernel/scheduler_execute.go:239 — Scheduler.executeWithCandidates has cognitive complexity 34 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 7). Of this number, 27 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LogAnalyzer.extractMetrics (cognitive 34) · ×1
  • LogAnalyzer.extractMetrics (cognitive 34) internal/tools/resources/builtin/text/log_analyzer.go:345 — LogAnalyzer.extractMetrics has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 6 (10 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.
D2 · Cognitive Complexity · panel.html.renderOverview (cognitive 34) · ×1
  • panel.html.renderOverview (cognitive 34) internal/introspect/web/panel.html:281 — panel.html.renderOverview has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 17, ternaries 3 (9 pts), if/else 8 (nesting depth added 6). Of this number, 32 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · providers.scanConfigFile (cognitive 33) · ×1
  • providers.scanConfigFile (cognitive 33) internal/discovery/providers/filesystem.go:110 — providers.scanConfigFile has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · plannerCognition.growToolNodes (cognitive 33) · ×1
  • plannerCognition.growToolNodes (cognitive 33) internal/fabric/agent/planner_cognition.go:737 — plannerCognition.growToolNodes has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (30 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.
D2 · Cognitive Complexity · DefaultEntityMatcher.MatchTokens (cognitive 33) · ×1
  • DefaultEntityMatcher.MatchTokens (cognitive 33) internal/knowledge/pipeline/normalizer.go:163 — DefaultEntityMatcher.MatchTokens has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 3 (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.
D2 · Cognitive Complexity · DefaultReducer.Reduce (cognitive 33) · ×1
  • DefaultReducer.Reduce (cognitive 33) internal/knowledge/runtime/components.go:108 — DefaultReducer.Reduce has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 7 (8 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Store.HybridSearch (cognitive 33) · ×1
  • Store.HybridSearch (cognitive 33) internal/knowledge/store/memory/store.go:337 — Store.HybridSearch has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 5 (8 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.
D2 · Cognitive Complexity · arena.RunScenarioReport (cognitive 33) · ×1
  • arena.RunScenarioReport (cognitive 33) internal/runtime/arena/scenario.go:117 — arena.RunScenarioReport has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (22 pts), match/switch 3 (7 pts), loops 3, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RegressionTester.runAdaptive (cognitive 33) · ×1
  • RegressionTester.runAdaptive (cognitive 33) internal/runtime/arena/regression.go:332 — RegressionTester.runAdaptive has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 3, loops 1 (nesting depth added 14). Of this number, 29 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Pipeline.Run (cognitive 33) · ×1
  • Pipeline.Run (cognitive 33) internal/runtime/memory/pipeline.go:176 — Pipeline.Run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (31 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.
D2 · Cognitive Complexity · DateTime.Execute (cognitive 33) · ×1
  • DateTime.Execute (cognitive 33) internal/tools/resources/builtin/math/calculator.go:594 — DateTime.Execute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPRequest.Execute (cognitive 33) · ×1
  • HTTPRequest.Execute (cognitive 33) REDACTED:70 — HTTPRequest.Execute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 8). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JSONTools.extract (cognitive 33) · ×1
  • JSONTools.extract (cognitive 33) REDACTED:109 — JSONTools.extract has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 2, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · llm.withRetry (cognitive 32) · ×1
  • llm.withRetry (cognitive 32) internal/llm/resilience.go:257 — llm.withRetry has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 15). Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPManager.ApplyConfig (cognitive 32) · ×1
  • MCPManager.ApplyConfig (cognitive 32) internal/runtime/protocol/mcp/manager.go:666 — MCPManager.ApplyConfig has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SecretRepository.Import (cognitive 32) · ×1
  • SecretRepository.Import (cognitive 32) internal/storage/postgres/repositories/secret_repository.go:615 — SecretRepository.Import has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (29 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). Of this number, 29 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompactableEventStore.archivePendingRoundsOnce (cognitive 31) · ×1
  • CompactableEventStore.archivePendingRoundsOnce (cognitive 31) internal/ares_events/compactable_store.go:684 — CompactableEventStore.archivePendingRoundsOnce has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · PostgresEventStore.Append (cognitive 31) · ×1
  • PostgresEventStore.Append (cognitive 31) internal/ares_events/pg_store.go:118 — PostgresEventStore.Append has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 4, loops 1 (nesting depth added 9). Of this number, 27 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · discovery.mergeRecords (cognitive 31) · ×1
  • discovery.mergeRecords (cognitive 31) internal/discovery/identity.go:10 — discovery.mergeRecords has cognitive complexity 31 (threshold 15). Drivers by points: loops 8 (17 pts), if/else 5 (13 pts), boolean chains 1 (nesting depth added 17). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · Store.HybridSearch (cognitive 31) · ×1
  • Store.HybridSearch (cognitive 31) internal/knowledge/store/sqlite/store.go:566 — Store.HybridSearch has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 4 (7 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.
D2 · Cognitive Complexity · evolution.GenerateReport (cognitive 31) · ×1
  • evolution.GenerateReport (cognitive 31) internal/runtime/ares_evolution/report.go:153 — evolution.GenerateReport has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 4 (10 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · RuntimeFitnessAggregator.querySourceMeanScopedAt (cognitive 31) · ×1
  • RuntimeFitnessAggregator.querySourceMeanScopedAt (cognitive 31) internal/runtime/ares_evolution/fitness_aggregator.go:440 — RuntimeFitnessAggregator.querySourceMeanScopedAt has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Distiller.resolveConflictsPhase (cognitive 31) · ×1
  • Distiller.resolveConflictsPhase (cognitive 31) internal/runtime/memory/distillation/distiller.go:554 — Distiller.resolveConflictsPhase has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 1 (3 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · EmbeddingClient.EmbedBatch (cognitive 31) · ×1
  • EmbeddingClient.EmbedBatch (cognitive 31) internal/storage/postgres/embedding/client.go:152 — EmbeddingClient.EmbedBatch has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 3 (4 pts) (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.
D2 · Cognitive Complexity · ares_bootstrap.buildRegressionGate (cognitive 30) · ×1
  • ares_bootstrap.buildRegressionGate (cognitive 30) internal/ares_bootstrap/regression_gate_wiring.go:75 — ares_bootstrap.buildRegressionGate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (26 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.
D2 · Cognitive Complexity · Fabric.ReclaimIdle (cognitive 30) · ×1
  • Fabric.ReclaimIdle (cognitive 30) internal/fabric/agent/reclaim.go:137 — Fabric.ReclaimIdle has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 6 (10 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · archive.extractVerdict (cognitive 30) · ×1
  • archive.extractVerdict (cognitive 30) internal/runtime/archive/extract.go:107 — archive.extractVerdict has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · evolution.ReportString (cognitive 30) · ×1
  • evolution.ReportString (cognitive 30) internal/runtime/ares_evolution/report.go:357 — evolution.ReportString has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 4 (9 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.
D2 · Cognitive Complexity · DefaultNormalizer.Normalize (cognitive 30) · ×1
  • DefaultNormalizer.Normalize (cognitive 30) internal/runtime/ares_evolution/experience/normalizer.go:59 — DefaultNormalizer.Normalize has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20 (26 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Population.measureNumericDiversityLocked (cognitive 30) · ×1
  • Population.measureNumericDiversityLocked (cognitive 30) internal/runtime/ares_evolution/genome/adaptive.go:154 — Population.measureNumericDiversityLocked has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 6 (13 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.
D2 · Cognitive Complexity · actionHandler.handleSubmitTask (cognitive 29) · ×1
  • actionHandler.handleSubmitTask (cognitive 29) cmd/ares/agent_routes_tasks.go:176 — actionHandler.handleSubmitTask has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_bootstrap.wireLifecycleGates (cognitive 29) · ×1
  • ares_bootstrap.wireLifecycleGates (cognitive 29) internal/ares_bootstrap/bootstrap_evolution.go:242 — ares_bootstrap.wireLifecycleGates has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeAgent.Process (cognitive 29) · ×1
  • KnowledgeAgent.Process (cognitive 29) internal/knowledge/workflow/workflow.go:74 — KnowledgeAgent.Process has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 1 (3 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.
D2 · Cognitive Complexity · GenomePopulationAdapter.recordOutcomesLocked (cognitive 29) · ×1
  • GenomePopulationAdapter.recordOutcomesLocked (cognitive 29) internal/runtime/ares_evolution/genome_wiring_run.go:571 — GenomePopulationAdapter.recordOutcomesLocked has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 2 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ExperienceGuidedMutator.chooseGuidedMutationType (cognitive 29) · ×1
  • ExperienceGuidedMutator.chooseGuidedMutationType (cognitive 29) internal/runtime/ares_evolution/mutation/guided_mutator.go:459 — ExperienceGuidedMutator.chooseGuidedMutationType has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 8, 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.
D2 · Cognitive Complexity · WorkflowGenome.mutateMergeNodes (cognitive 29) · ×1
  • WorkflowGenome.mutateMergeNodes (cognitive 29) REDACTED:473 — WorkflowGenome.mutateMergeNodes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 3 (7 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.
D2 · Cognitive Complexity · Searcher.Search (cognitive 29) · ×1
  • Searcher.Search (cognitive 29) internal/tools/envcap/envcap.go:110 — Searcher.Search has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 13). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agentsyscall.BindTools (cognitive 28) · ×1
  • agentsyscall.BindTools (cognitive 28) internal/agentsyscall/syscall.go:806 — agentsyscall.BindTools has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18 (22 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 810, 837, 873, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · NewEvolutionComponents.UpdateLiveDAG (cognitive 28) · ×1
  • NewEvolutionComponents.UpdateLiveDAG (cognitive 28) internal/ares_bootstrap/provide_new_evolution.go:388 — NewEvolutionComponents.UpdateLiveDAG has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (24 pts), loops 3 (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.
D2 · Cognitive Complexity · Client.streamAnthropic (cognitive 28) · ×1
  • Client.streamAnthropic (cognitive 28) internal/llm/client.go:601 — Client.streamAnthropic has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 654). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · genome.computeParamRanges (cognitive 28) · ×1
  • genome.computeParamRanges (cognitive 28) internal/runtime/ares_evolution/genome/adaptive.go:379 — genome.computeParamRanges has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Population.doEvolve (cognitive 28) · ×1
  • Population.doEvolve (cognitive 28) internal/runtime/ares_evolution/genome/population.go:272 — Population.doEvolve has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 4). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Population.generateOffspringUnlocked (cognitive 28) · ×1
  • Population.generateOffspringUnlocked (cognitive 28) internal/runtime/ares_evolution/genome/population.go:508 — Population.generateOffspringUnlocked has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), match/switch 2 (5 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.
D2 · Cognitive Complexity · app.embed_batch (cognitive 28) · ×1
  • app.embed_batch (cognitive 28) REDACTED:273 — app.embed_batch has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (7 pts), loops 2 (4 pts), ternaries 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Engine.DiscoverNow (cognitive 27) · ×1
  • Engine.DiscoverNow (cognitive 27) internal/discovery/engine.go:50 — Engine.DiscoverNow has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 9 (10 pts), boolean chains 1 (nesting depth added 8). Of this number, 23 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Client.GenerateStream (cognitive 27) · ×1
  • Client.GenerateStream (cognitive 27) internal/llm/client.go:360 — Client.GenerateStream has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), match/switch 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). Most of this is not in the body itself: 6 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 440, 406). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Client.streamOpenRouter (cognitive 27) · ×1
  • Client.streamOpenRouter (cognitive 27) internal/llm/client.go:716 — Client.streamOpenRouter has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (22 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 9). Most of this is not in the body itself: 10 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 770). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · evolution.generateDiffPatches (cognitive 27) · ×1
  • evolution.generateDiffPatches (cognitive 27) internal/runtime/ares_evolution/genome_wiring_idle.go:361 — evolution.generateDiffPatches has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 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.
D2 · Cognitive Complexity · genome.ApplyHypothesis (cognitive 27) · ×1
  • genome.ApplyHypothesis (cognitive 27) internal/runtime/ares_evolution/genome/hypothesis.go:180 — genome.ApplyHypothesis has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 pts), match/switch 2 (5 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.
D2 · Cognitive Complexity · DistillationService.parseExtractionResponse (cognitive 27) · ×1
  • DistillationService.parseExtractionResponse (cognitive 27) internal/runtime/memory/experience/distillation_service.go:397 — DistillationService.parseExtractionResponse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (21 pts), match/switch 2 (5 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.
D2 · Cognitive Complexity · Graph.AddNode (cognitive 27) · ×1
  • Graph.AddNode (cognitive 27) internal/runtime/observability/flight/graph.go:70 — Graph.AddNode has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · ahp.reconstructTaskResult (cognitive 27) · ×1
  • ahp.reconstructTaskResult (cognitive 27) internal/runtime/protocol/ahp/message.go:151 — ahp.reconstructTaskResult has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_bootstrap.runLLMSuggestions (cognitive 26) · ×1
  • ares_bootstrap.runLLMSuggestions (cognitive 26) internal/ares_bootstrap/bootstrap_evolution.go:518 — ares_bootstrap.runLLMSuggestions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (8 pts), match/switch 1 (4 pts), boolean chains 1 (nesting depth added 18). Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 524). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PhaseExecutor.Execute (cognitive 26) · ×1
  • PhaseExecutor.Execute (cognitive 26) internal/ares_shutdown/phase.go:63 — PhaseExecutor.Execute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 2 (6 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.
D2 · Cognitive Complexity · DAGPatchExecutor.Apply (cognitive 26) · ×1
  • DAGPatchExecutor.Apply (cognitive 26) internal/fabric/task/workflow/engine/dag_patcher.go:140 — DAGPatchExecutor.Apply has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 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.
D2 · Cognitive Complexity · Registry.TopologicalOrder (cognitive 26) · ×1
  • Registry.TopologicalOrder (cognitive 26) internal/kernel/registry.go:177 — Registry.TopologicalOrder has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 8 (11 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefaultCompiler.formatMarkdown (cognitive 26) · ×1
  • DefaultCompiler.formatMarkdown (cognitive 26) internal/knowledge/compiler/compiler.go:222 — DefaultCompiler.formatMarkdown has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · llm.buildAnthropicChatMessages (cognitive 26) · ×1
  • llm.buildAnthropicChatMessages (cognitive 26) internal/llm/chat.go:564 — llm.buildAnthropicChatMessages has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 14). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evolution.RecordPopulationLineage (cognitive 26) · ×1
  • evolution.RecordPopulationLineage (cognitive 26) internal/runtime/ares_evolution/genome_wiring_genealogy.go:253 — evolution.RecordPopulationLineage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DreamCycle.runESEvolution (cognitive 26) · ×1
  • DreamCycle.runESEvolution (cognitive 26) internal/runtime/ares_evolution/dream_cycle_evolve.go:48 — DreamCycle.runESEvolution has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (23 pts), loops 1 (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.
D2 · Cognitive Complexity · MemoryExperienceStore.GetTaskTypeStatistics (cognitive 26) · ×1
  • MemoryExperienceStore.GetTaskTypeStatistics (cognitive 26) internal/runtime/ares_evolution/experience/memory_store.go:335 — MemoryExperienceStore.GetTaskTypeStatistics has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.Evolve (cognitive 26) · ×1
  • Service.Evolve (cognitive 26) internal/runtime/ares_evolution/service/service.go:441 — Service.Evolve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Registry.Apply (cognitive 26) · ×1
  • Registry.Apply (cognitive 26) internal/runtime/evolution/patch/patch.go:499 — Registry.Apply has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (26 pts) (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.
D2 · Cognitive Complexity · Collector.processEvent (cognitive 26) · ×1
  • Collector.processEvent (cognitive 26) internal/runtime/observability/flight/collector.go:253 — Collector.processEvent has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (25 pts), match/switch 1 (nesting depth added 12). Of this number, 15 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Fabric.flushAppends (cognitive 25) · ×1
  • Fabric.flushAppends (cognitive 25) internal/fabric/task/fabric_events.go:294 — Fabric.flushAppends has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 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.
D2 · Cognitive Complexity · DefaultCompiler.formatPrompt (cognitive 25) · ×1
  • DefaultCompiler.formatPrompt (cognitive 25) internal/knowledge/compiler/compiler.go:164 — DefaultCompiler.formatPrompt has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TimelineLinker.Link (cognitive 25) · ×1
  • TimelineLinker.Link (cognitive 25) internal/knowledge/linker/timeline.go:18 — TimelineLinker.Link has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeProvider.Stream (cognitive 25) · ×1
  • CodeProvider.Stream (cognitive 25) internal/knowledge/provider/code/provider.go:171 — CodeProvider.Stream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 7). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 179). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · fileArchiveReader.Search (cognitive 25) · ×1
  • fileArchiveReader.Search (cognitive 25) internal/runtime/archive/reader.go:158 — fileArchiveReader.Search has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (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.
D2 · Cognitive Complexity · arena.ValidateAction (cognitive 25) · ×1
  • arena.ValidateAction (cognitive 25) internal/runtime/arena/http.go:607 — arena.ValidateAction has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FeedbackRecorder.Register (cognitive 25) · ×1
  • FeedbackRecorder.Register (cognitive 25) internal/runtime/ares_evolution/feedback_recorder.go:136 — FeedbackRecorder.Register has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (21 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.
D2 · Cognitive Complexity · MetaController.Tune (cognitive 25) · ×1
  • MetaController.Tune (cognitive 25) internal/runtime/ares_evolution/genome/meta_evolution.go:102 — MetaController.Tune has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReportGenerator.GenerateMarkdown (cognitive 25) · ×1
  • ReportGenerator.GenerateMarkdown (cognitive 25) internal/runtime/eval/report.go:22 — ReportGenerator.GenerateMarkdown has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 8 (10 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.
D2 · Cognitive Complexity · WorkflowDiffer.Diff (cognitive 25) · ×1
  • WorkflowDiffer.Diff (cognitive 25) internal/runtime/evolution/diff/workflow_differ.go:25 — WorkflowDiffer.Diff has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 7 (9 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryManager.BuildContext (cognitive 25) · ×1
  • memoryManager.BuildContext (cognitive 25) internal/runtime/memory/manager_impl.go:582 — memoryManager.BuildContext has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 2 (5 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.
D2 · Cognitive Complexity · ares_mcp.matchURITemplate (cognitive 25) · ×1
  • ares_mcp.matchURITemplate (cognitive 25) internal/runtime/protocol/mcp/server.go:524 — ares_mcp.matchURITemplate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (4 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.
D2 · Cognitive Complexity · TaskResultRepository.ListByType (cognitive 25) · ×1
  • TaskResultRepository.ListByType (cognitive 25) REDACTED:414 — TaskResultRepository.ListByType has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 1 (nesting depth added 11). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Planner.Plan (cognitive 25) · ×1
  • Planner.Plan (cognitive 25) internal/tools/planner/planner.go:93 — Planner.Plan has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 4 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DataValidation.validateSchema (cognitive 25) · ×1
  • DataValidation.validateSchema (cognitive 25) REDACTED:229 — DataValidation.validateSchema has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Sessions.Admit (cognitive 24) · ×1
  • Sessions.Admit (cognitive 24) internal/agentruntime/session.go:105 — Sessions.Admit has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (20 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.
D2 · Cognitive Complexity · ares_bootstrap.wireDistillation (cognitive 24) · ×1
  • ares_bootstrap.wireDistillation (cognitive 24) internal/ares_bootstrap/bootstrap_steps.go:26 — ares_bootstrap.wireDistillation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 1 (nesting depth added 13). Of this number, 21 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Client.streamOllama (cognitive 24) · ×1
  • Client.streamOllama (cognitive 24) internal/llm/client.go:513 — Client.streamOllama has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 10). Most of this is not in the body itself: 9 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 560). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MemoryExperienceStore.Query (cognitive 24) · ×1
  • MemoryExperienceStore.Query (cognitive 24) internal/runtime/ares_evolution/experience/memory_store.go:164 — MemoryExperienceStore.Query has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Population.injectFreshMutantsLocked (cognitive 24) · ×1
  • Population.injectFreshMutantsLocked (cognitive 24) internal/runtime/ares_evolution/genome/population_guard.go:45 — Population.injectFreshMutantsLocked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 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.
D2 · Cognitive Complexity · Population.preservePromptDiversityLocked (cognitive 24) · ×1
  • Population.preservePromptDiversityLocked (cognitive 24) internal/runtime/ares_evolution/genome/population_guard.go:237 — Population.preservePromptDiversityLocked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval.ReplayGolden (cognitive 24) · ×1
  • eval.ReplayGolden (cognitive 24) internal/runtime/eval/replay.go:83 — eval.ReplayGolden has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 1 (3 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Registry.Snapshot (cognitive 24) · ×1
  • Registry.Snapshot (cognitive 24) internal/runtime/evolution/patch/patch.go:260 — Registry.Snapshot has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 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.
D2 · Cognitive Complexity · Genealogy.pruneOldestDeadLeafLocked (cognitive 24) · ×1
  • Genealogy.pruneOldestDeadLeafLocked (cognitive 24) internal/runtime/observability/flight/genealogy.go:221 — Genealogy.pruneOldestDeadLeafLocked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SSETransport.receiveLoop (cognitive 24) · ×1
  • SSETransport.receiveLoop (cognitive 24) internal/runtime/protocol/mcp/transport_sse.go:149 — SSETransport.receiveLoop has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 2 (nesting depth added 10). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SecretRepository.RotateKey (cognitive 24) · ×1
  • SecretRepository.RotateKey (cognitive 24) internal/storage/postgres/repositories/secret_repository.go:373 — SecretRepository.RotateKey has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 2 (nesting depth added 6). Of this number, 20 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TaskResultRepository.SearchByVector (cognitive 24) · ×1
  • TaskResultRepository.SearchByVector (cognitive 24) REDACTED:297 — TaskResultRepository.SearchByVector has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 1 (nesting depth added 10). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TaskResultRepository.ListBySession (cognitive 24) · ×1
  • TaskResultRepository.ListBySession (cognitive 24) REDACTED:511 — TaskResultRepository.ListBySession has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 1 (nesting depth added 11). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StoreAdapter.UpdateKnowledge (cognitive 24) · ×1
  • StoreAdapter.UpdateKnowledge (cognitive 24) internal/tools/resources/builtin/knowledge/store_adapter.go:80 — StoreAdapter.UpdateKnowledge has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (23 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.
D2 · Cognitive Complexity · Agent.composePrompt (cognitive 24) · ×1
  • Agent.composePrompt (cognitive 24) sdk/agent.go:242 — Agent.composePrompt has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GraphPatchExecutor.CanApply (cognitive 23) · ×1
  • GraphPatchExecutor.CanApply (cognitive 23) internal/fabric/task/workflow/graph/patcher.go:98 — GraphPatchExecutor.CanApply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · Scheduler.freeCapableAgents (cognitive 23) · ×1
  • Scheduler.freeCapableAgents (cognitive 23) internal/kernel/scheduler_dispatch.go:265 — Scheduler.freeCapableAgents has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · MetricsCollector.Snapshot (cognitive 23) · ×1
  • MetricsCollector.Snapshot (cognitive 23) internal/runtime/arena/metrics.go:176 — MetricsCollector.Snapshot has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DreamCycle.deployWinner (cognitive 23) · ×1
  • DreamCycle.deployWinner (cognitive 23) internal/runtime/ares_evolution/dream_cycle_evolve.go:157 — DreamCycle.deployWinner has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (23 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvalGate.Check (cognitive 23) · ×1
  • EvalGate.Check (cognitive 23) internal/runtime/ares_evolution/gate_eval.go:150 — EvalGate.Check has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Population.handleStagnationLocked (cognitive 23) · ×1
  • Population.handleStagnationLocked (cognitive 23) internal/runtime/ares_evolution/genome/adaptive.go:547 — Population.handleStagnationLocked has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Population.applyFitnessSharingSampled (cognitive 23) · ×1
  • Population.applyFitnessSharingSampled (cognitive 23) internal/runtime/ares_evolution/genome/population_guard.go:445 — Population.applyFitnessSharingSampled has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (7 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.
D2 · Cognitive Complexity · LLMArenaScorer.ScoreBatch (cognitive 23) · ×1
  • LLMArenaScorer.ScoreBatch (cognitive 23) internal/runtime/ares_evolution/service/llm_arena_scorer.go:350 — LLMArenaScorer.ScoreBatch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.recoverAgentState (cognitive 23) · ×1
  • Manager.recoverAgentState (cognitive 23) internal/runtime/manager.go:544 — Manager.recoverAgentState has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 12). Of this number, 12 points are the body's own statements and 11 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryManager.StoreDistilledTask (cognitive 23) · ×1
  • memoryManager.StoreDistilledTask (cognitive 23) internal/runtime/memory/manager_impl.go:764 — memoryManager.StoreDistilledTask has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 1, loops 1 (nesting depth added 6). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 826). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Timeline.Add (cognitive 23) · ×1
  • Timeline.Add (cognitive 23) internal/runtime/observability/flight/timeline.go:90 — Timeline.Add has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Indexer.indexOne (cognitive 23) · ×1
  • Indexer.indexOne (cognitive 23) internal/runtime/protocol/skills/indexer.go:69 — Indexer.indexOne has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Runtime.runGraphRounds (cognitive 23) · ×1
  • Runtime.runGraphRounds (cognitive 23) sdk/graph_run.go:122 — Runtime.runGraphRounds has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 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.
D2 · Cognitive Complexity · main.printReport (cognitive 22) · ×1
  • main.printReport (cognitive 22) cmd/ares/serve_arena.go:653 — main.printReport has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.printStatusText (cognitive 22) · ×1
  • main.printStatusText (cognitive 22) cmd/ares/status.go:449 — main.printStatusText has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 2 (4 pts) (nesting depth added 6). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Orchestrator.Adopt (cognitive 22) · ×1
  • Orchestrator.Adopt (cognitive 22) internal/kernel/orchestrator.go:429 — Orchestrator.Adopt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), match/switch 3, boolean chains 1, loops 1 (nesting depth added 6). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · llmservice.NewService (cognitive 22) · ×1
  • llmservice.NewService (cognitive 22) internal/llmservice/service.go:63 — llmservice.NewService has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.Execute (cognitive 22) · ×1
  • Service.Execute (cognitive 22) internal/runtime/arena/service.go:71 — Service.Execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · experience.AggregateEvidence (cognitive 22) · ×1
  • experience.AggregateEvidence (cognitive 22) internal/runtime/ares_evolution/experience/types.go:208 — experience.AggregateEvidence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 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.
D2 · Cognitive Complexity · genome.ParetoDominance (cognitive 22) · ×1
  • genome.ParetoDominance (cognitive 22) internal/runtime/ares_evolution/genome/multi_objective.go:50 — genome.ParetoDominance has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EvolutionGuardrails.postEvolveCheckLocked (cognitive 22) · ×1
  • EvolutionGuardrails.postEvolveCheckLocked (cognitive 22) internal/runtime/ares_evolution/guardrails.go:446 — EvolutionGuardrails.postEvolveCheckLocked has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (5 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.
D2 · Cognitive Complexity · mutation.extractOutermostBracket (cognitive 22) · ×1
  • mutation.extractOutermostBracket (cognitive 22) internal/runtime/ares_evolution/mutation/llm_hint_provider.go:264 — mutation.extractOutermostBracket has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Registry.ApplySet (cognitive 22) · ×1
  • Registry.ApplySet (cognitive 22) internal/runtime/evolution/patch/patch.go:547 — Registry.ApplySet has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (nesting depth added 11). Of this number, 17 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.healthCheck (cognitive 22) · ×1
  • Manager.healthCheck (cognitive 22) internal/runtime/manager_lifecycle.go:405 — Manager.healthCheck has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 2, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeRunner.validateCode (cognitive 22) · ×1
  • CodeRunner.validateCode (cognitive 22) internal/tools/resources/builtin/execution/code_runner.go:364 — CodeRunner.validateCode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (8 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebSearch.Execute (cognitive 22) · ×1
  • WebSearch.Execute (cognitive 22) internal/tools/resources/builtin/network/web_search.go:151 — WebSearch.Execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19 (20 pts), boolean chains 1, loops 1 (nesting depth added 1). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · main.runDbMigrate (cognitive 21) · ×1
  • main.runDbMigrate (cognitive 21) REDACTED:56 — main.runDbMigrate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (21 pts) (nesting depth added 7). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryStore.Query (cognitive 21) · ×1
  • MemoryStore.Query (cognitive 21) internal/evidence/evidence.go:146 — MemoryStore.Query has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Scheduler.PreemptLowerPriority (cognitive 21) · ×1
  • Scheduler.PreemptLowerPriority (cognitive 21) internal/kernel/scheduler_dispatch.go:185 — Scheduler.PreemptLowerPriority has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 3 (nesting depth added 5). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DistillBridge.DistillConversationWithReport (cognitive 21) · ×1
  • DistillBridge.DistillConversationWithReport (cognitive 21) internal/knowledge/adapter/distill.go:192 — DistillBridge.DistillConversationWithReport has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryExperienceStore.GetStatistics (cognitive 21) · ×1
  • MemoryExperienceStore.GetStatistics (cognitive 21) internal/runtime/ares_evolution/experience/memory_store.go:271 — MemoryExperienceStore.GetStatistics has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 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.
D2 · Cognitive Complexity · evolution.extractFirstFloat (cognitive 21) · ×1
  • evolution.extractFirstFloat (cognitive 21) internal/runtime/ares_evolution/service/llm_arena_scorer.go:533 — evolution.extractFirstFloat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 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.
D2 · Cognitive Complexity · evolution.extractScoreFromText (cognitive 21) · ×1
  • evolution.extractScoreFromText (cognitive 21) internal/runtime/ares_evolution/service/llm_scorer.go:516 — evolution.extractScoreFromText has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UngatedPatcher.Evaluate (cognitive 21) · ×1
  • UngatedPatcher.Evaluate (cognitive 21) internal/runtime/evolution/coordinator/coordinator.go:476 — UngatedPatcher.Evaluate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (17 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.
D2 · Cognitive Complexity · distillation.IsProblem (cognitive 21) · ×1
  • distillation.IsProblem (cognitive 21) internal/runtime/memory/distillation/detector.go:19 — distillation.IsProblem has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 5 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemorySearch.Execute (cognitive 21) · ×1
  • MemorySearch.Execute (cognitive 21) internal/tools/resources/builtin/memory/memory_tools.go:60 — MemorySearch.Execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StringUtils.Execute (cognitive 21) · ×1
  • StringUtils.Execute (cognitive 21) internal/tools/resources/builtin/stringutils/stringutils.go:72 — StringUtils.Execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (6 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.
D2 · Cognitive Complexity · main.runLiveChaosInjection (cognitive 20) · ×1
  • main.runLiveChaosInjection (cognitive 20) cmd/ares/serve_chaos_domain.go:427 — main.runLiveChaosInjection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, loops 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.setupServeControlPlane (cognitive 20) · ×1
  • main.setupServeControlPlane (cognitive 20) cmd/ares/serve_wiring.go:404 — main.setupServeControlPlane has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 428, 461). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · agentruntime.AwaitSessionResult (cognitive 20) · ×1
  • agentruntime.AwaitSessionResult (cognitive 20) internal/agentruntime/await.go:400 — agentruntime.AwaitSessionResult has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · archive.extractDecisions (cognitive 20) · ×1
  • archive.extractDecisions (cognitive 20) internal/runtime/archive/extract.go:353 — archive.extractDecisions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NondominatedSortingSelection.Select (cognitive 20) · ×1
  • NondominatedSortingSelection.Select (cognitive 20) internal/runtime/ares_evolution/genome/selection.go:831 — NondominatedSortingSelection.Select has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 6 (8 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.
D2 · Cognitive Complexity · GenomePopulationAdapter.Run (cognitive 20) · ×1
  • GenomePopulationAdapter.Run (cognitive 20) internal/runtime/ares_evolution/genome_wiring_run.go:128 — GenomePopulationAdapter.Run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StrategyLifecycle.evaluateAndMaybeRollback (cognitive 20) · ×1
  • StrategyLifecycle.evaluateAndMaybeRollback (cognitive 20) internal/runtime/ares_evolution/lifecycle_evidence.go:16 — StrategyLifecycle.evaluateAndMaybeRollback has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 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.
D2 · Cognitive Complexity · context.summarizeHTTPRequestResult (cognitive 20) · ×1
  • context.summarizeHTTPRequestResult (cognitive 20) internal/runtime/memory/context/cleaner.go:379 — context.summarizeHTTPRequestResult has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Distiller.embedPhase (cognitive 20) · ×1
  • Distiller.embedPhase (cognitive 20) internal/runtime/memory/distillation/distiller.go:446 — Distiller.embedPhase has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 10). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 453). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ImportanceScorer.ScoreMemory (cognitive 20) · ×1
  • ImportanceScorer.ScoreMemory (cognitive 20) internal/runtime/memory/distillation/scorer.go:86 — ImportanceScorer.ScoreMemory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, match/switch 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.
D2 · Cognitive Complexity · EmbeddingCache.Clear (cognitive 20) · ×1
  • EmbeddingCache.Clear (cognitive 20) internal/storage/postgres/embedding/cache.go:162 — EmbeddingCache.Clear has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeUpdate.Execute (cognitive 20) · ×1
  • KnowledgeUpdate.Execute (cognitive 20) internal/tools/resources/builtin/knowledge/knowledge_base.go:233 — KnowledgeUpdate.Execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, loops 1 (2 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.
D2 · Cognitive Complexity · core.ParameterSchemaToMap (cognitive 20) · ×1
  • core.ParameterSchemaToMap (cognitive 20) internal/tools/resources/core/convert.go:26 — core.ParameterSchemaToMap has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.probeStatusRuntime (cognitive 19) · ×1
  • main.probeStatusRuntime (cognitive 19) cmd/ares/status.go:339 — main.probeStatusRuntime has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (19 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · peerAssembly.wireSessionCleanup (cognitive 19) · ×1
  • peerAssembly.wireSessionCleanup (cognitive 19) cmd/ares/peer_assembly.go:381 — peerAssembly.wireSessionCleanup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 427, 400). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · fileTool.validatePath (cognitive 19) · ×1
  • fileTool.validatePath (cognitive 19) internal/apitools/builtin.go:651 — fileTool.validatePath has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_bootstrap.subscribeDistillationEvents (cognitive 19) · ×1
  • ares_bootstrap.subscribeDistillationEvents (cognitive 19) internal/ares_bootstrap/bootstrap_steps.go:129 — ares_bootstrap.subscribeDistillationEvents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 133). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CompactableEventStore.maybeCompact (cognitive 19) · ×1
  • CompactableEventStore.maybeCompact (cognitive 19) internal/ares_events/compactable_store.go:475 — CompactableEventStore.maybeCompact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Fabric.AuditOrphans (cognitive 19) · ×1
  • Fabric.AuditOrphans (cognitive 19) internal/fabric/agent/orphan_audit.go:34 — Fabric.AuditOrphans has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompileCoordinator.CompileDAG (cognitive 19) · ×1
  • CompileCoordinator.CompileDAG (cognitive 19) internal/fabric/planprojection/coordinator.go:95 — CompileCoordinator.CompileDAG has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 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.
D2 · Cognitive Complexity · Fabric.ResumableTasks (cognitive 19) · ×1
  • Fabric.ResumableTasks (cognitive 19) internal/fabric/task/dag.go:73 — Fabric.ResumableTasks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Reaper.Sweep (cognitive 19) · ×1
  • Reaper.Sweep (cognitive 19) internal/fabric/task/reaper.go:156 — Reaper.Sweep has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileWatcher.fsnotifyLoop (cognitive 19) · ×1
  • FileWatcher.fsnotifyLoop (cognitive 19) internal/fabric/task/workflow/engine/reloader.go:138 — FileWatcher.fsnotifyLoop has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArchitectureLinker.Link (cognitive 19) · ×1
  • ArchitectureLinker.Link (cognitive 19) internal/knowledge/linker/architecture.go:18 — ArchitectureLinker.Link has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (4 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.
D2 · Cognitive Complexity · KnowledgePipeline.ProcessStream (cognitive 19) · ×1
  • KnowledgePipeline.ProcessStream (cognitive 19) internal/knowledge/pipeline.go:413 — KnowledgePipeline.ProcessStream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 12). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 420). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · memorystore.cloneObject (cognitive 19) · ×1
  • memorystore.cloneObject (cognitive 19) internal/knowledge/store/memory/store.go:41 — memorystore.cloneObject has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 3 (6 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · archive.extractTODOs (cognitive 19) · ×1
  • archive.extractTODOs (cognitive 19) internal/runtime/archive/extract.go:438 — archive.extractTODOs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 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.
D2 · Cognitive Complexity · RegressionTester.runUncached (cognitive 19) · ×1
  • RegressionTester.runUncached (cognitive 19) internal/runtime/arena/regression.go:250 — RegressionTester.runUncached has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 2 (nesting depth added 2). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · RegressionTester.runStrategy (cognitive 19) · ×1
  • RegressionTester.runStrategy (cognitive 19) internal/runtime/arena/regression.go:438 — RegressionTester.runStrategy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 1 (nesting depth added 6). Of this number, 13 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.randomChaosAction (cognitive 19) · ×1
  • Service.randomChaosAction (cognitive 19) internal/runtime/arena/survival.go:224 — Service.randomChaosAction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (18 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.
D2 · Cognitive Complexity · evolution.attachSchedulerAndLifecycle (cognitive 19) · ×1
  • evolution.attachSchedulerAndLifecycle (cognitive 19) internal/runtime/ares_evolution/genome_wiring_system.go:350 — evolution.attachSchedulerAndLifecycle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MemoryExperienceStore.QueryByTaskType (cognitive 19) · ×1
  • MemoryExperienceStore.QueryByTaskType (cognitive 19) internal/runtime/ares_evolution/experience/memory_store.go:218 — MemoryExperienceStore.QueryByTaskType has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (5 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.
D2 · Cognitive Complexity · Population.applyFitnessSharingExact (cognitive 19) · ×1
  • Population.applyFitnessSharingExact (cognitive 19) internal/runtime/ares_evolution/genome/population_guard.go:388 — Population.applyFitnessSharingExact has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 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.
D2 · Cognitive Complexity · SUSSelection.Select (cognitive 19) · ×1
  • SUSSelection.Select (cognitive 19) internal/runtime/ares_evolution/genome/selection.go:397 — SUSSelection.Select has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 5 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExperienceGuidedMutator.guidedMutateParameter (cognitive 19) · ×1
  • ExperienceGuidedMutator.guidedMutateParameter (cognitive 19) internal/runtime/ares_evolution/mutation/guided_mutator.go:631 — ExperienceGuidedMutator.guidedMutateParameter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evolution.NewService (cognitive 19) · ×1
  • evolution.NewService (cognitive 19) internal/runtime/ares_evolution/service/service.go:73 — evolution.NewService has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 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.
D2 · Cognitive Complexity · eval.findJSONEnd (cognitive 19) · ×1
  • eval.findJSONEnd (cognitive 19) internal/runtime/eval/llm_judge.go:449 — eval.findJSONEnd 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.
D2 · Cognitive Complexity · Manager.scheduleResurrection (cognitive 19) · ×1
  • Manager.scheduleResurrection (cognitive 19) internal/runtime/manager.go:696 — Manager.scheduleResurrection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 11). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 698). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ConflictResolver.DetectConflictGroups (cognitive 19) · ×1
  • ConflictResolver.DetectConflictGroups (cognitive 19) internal/runtime/memory/experience/conflict_resolver.go:35 — ConflictResolver.DetectConflictGroups has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Collector.handleMemoryDistilled (cognitive 19) · ×1
  • Collector.handleMemoryDistilled (cognitive 19) internal/runtime/observability/flight/collector.go:476 — Collector.handleMemoryDistilled has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (3 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.
D2 · Cognitive Complexity · MCPToolFactory.Create (cognitive 19) · ×1
  • MCPToolFactory.Create (cognitive 19) internal/runtime/protocol/mcp/factory.go:38 — MCPToolFactory.Create has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · toolResolver.Resolve (cognitive 19) · ×1
  • toolResolver.Resolve (cognitive 19) internal/tools/planner/resolver.go:108 — toolResolver.Resolve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 5 (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.
D2 · Cognitive Complexity · RegexTool.extract (cognitive 19) · ×1
  • RegexTool.extract (cognitive 19) internal/tools/resources/builtin/text/regex_tool.go:178 — RegexTool.extract has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 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.
D2 · Cognitive Complexity · ConfigFile.validateKnowledge (cognitive 19) · ×1
  • ConfigFile.validateKnowledge (cognitive 19) sdk/config.go:322 — ConfigFile.validateKnowledge has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · main.wireChaos (cognitive 18) · ×1
  • main.wireChaos (cognitive 18) cmd/ares/serve_chaos_domain.go:166 — main.wireChaos has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 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.
D2 · Cognitive Complexity · actionHandler.checkAuthRead (cognitive 18) · ×1
  • actionHandler.checkAuthRead (cognitive 18) cmd/ares/agent.go:208 — actionHandler.checkAuthRead has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fileTool.Execute (cognitive 18) · ×1
  • fileTool.Execute (cognitive 18) internal/apitools/builtin.go:709 — fileTool.Execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (2 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.
D2 · Cognitive Complexity · ares_bootstrap.runEvolutionTicker (cognitive 18) · ×1
  • ares_bootstrap.runEvolutionTicker (cognitive 18) internal/ares_bootstrap/bootstrap_evolution.go:467 — ares_bootstrap.runEvolutionTicker has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 468). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ares_bootstrap.buildEvolutionSuggestionPrompt (cognitive 18) · ×1
  • ares_bootstrap.buildEvolutionSuggestionPrompt (cognitive 18) internal/ares_bootstrap/bootstrap_fitness.go:36 — ares_bootstrap.buildEvolutionSuggestionPrompt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_bootstrap.buildEvalGate (cognitive 18) · ×1
  • ares_bootstrap.buildEvalGate (cognitive 18) internal/ares_bootstrap/eval_gate_wiring.go:153 — ares_bootstrap.buildEvalGate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MemoryEventStore.Read (cognitive 18) · ×1
  • MemoryEventStore.Read (cognitive 18) internal/ares_events/memory_store.go:176 — MemoryEventStore.Read has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 2 (3 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.
D2 · Cognitive Complexity · MemoryEventStore.matchesFilter (cognitive 18) · ×1
  • MemoryEventStore.matchesFilter (cognitive 18) internal/ares_events/memory_store.go:410 — MemoryEventStore.matchesFilter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SlidingWindowLimiter.Wait (cognitive 18) · ×1
  • SlidingWindowLimiter.Wait (cognitive 18) internal/ares_ratelimit/sliding_window.go:49 — SlidingWindowLimiter.Wait has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (7 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_security.maskAPIKey (cognitive 18) · ×1
  • ares_security.maskAPIKey (cognitive 18) internal/ares_security/sanitizer.go:263 — ares_security.maskAPIKey has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ares_security.maskToken) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ares_security.maskToken (cognitive 18) · ×1
  • ares_security.maskToken (cognitive 18) internal/ares_security/sanitizer.go:321 — ares_security.maskToken has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ares_security.maskAPIKey) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · answerCognition.ExecuteStep (cognitive 18) · ×1
  • answerCognition.ExecuteStep (cognitive 18) internal/fabric/agent/l2graph.go:653 — answerCognition.ExecuteStep 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.
D2 · Cognitive Complexity · snapshotStore.save (cognitive 18) · ×1
  • snapshotStore.save (cognitive 18) internal/fabric/agent/snapshot.go:72 — snapshotStore.save has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 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.
D2 · Cognitive Complexity · MutableDAG.AddNode (cognitive 18) · ×1
  • MutableDAG.AddNode (cognitive 18) internal/fabric/task/workflow/engine/mutable_dag.go:77 — MutableDAG.AddNode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (7 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.
D2 · Cognitive Complexity · MutableDAG.RemoveNode (cognitive 18) · ×1
  • MutableDAG.RemoveNode (cognitive 18) internal/fabric/task/workflow/engine/mutable_dag.go:174 — MutableDAG.RemoveNode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Orchestrator.Shutdown (cognitive 18) · ×1
  • Orchestrator.Shutdown (cognitive 18) internal/kernel/orchestrator.go:197 — Orchestrator.Shutdown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2, 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.
D2 · Cognitive Complexity · Scheduler.Capabilities (cognitive 18) · ×1
  • Scheduler.Capabilities (cognitive 18) internal/kernel/executor_registry.go:310 — Scheduler.Capabilities has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 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.
D2 · Cognitive Complexity · Scheduler.Run (cognitive 18) · ×1
  • Scheduler.Run (cognitive 18) internal/kernel/scheduler.go:269 — Scheduler.Run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 pts), loops 2 (nesting depth added 7). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeRetriever.Retrieve (cognitive 18) · ×1
  • KnowledgeRetriever.Retrieve (cognitive 18) internal/knowledge/adapter/context_retriever.go:271 — KnowledgeRetriever.Retrieve has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DefaultCompiler.formatXML (cognitive 18) · ×1
  • DefaultCompiler.formatXML (cognitive 18) internal/knowledge/compiler/compiler.go:330 — DefaultCompiler.formatXML has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VectorProvider.resultToObject (cognitive 18) · ×1
  • VectorProvider.resultToObject (cognitive 18) internal/knowledge/provider/vector/provider.go:229 — VectorProvider.resultToObject has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (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.
D2 · Cognitive Complexity · fileArchiveReader.List (cognitive 18) · ×1
  • fileArchiveReader.List (cognitive 18) internal/runtime/archive/reader.go:104 — fileArchiveReader.List has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evolution.ValidateStrategySize (cognitive 18) · ×1
  • evolution.ValidateStrategySize (cognitive 18) internal/runtime/ares_evolution/validation.go:28 — evolution.ValidateStrategySize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · DreamCycle.runGAEvolution (cognitive 18) · ×1
  • DreamCycle.runGAEvolution (cognitive 18) internal/runtime/ares_evolution/dream_cycle_ga.go:41 — DreamCycle.runGAEvolution has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 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.
D2 · Cognitive Complexity · RuntimeFitnessAggregator.WindowAt (cognitive 18) · ×1
  • RuntimeFitnessAggregator.WindowAt (cognitive 18) internal/runtime/ares_evolution/fitness_aggregator.go:236 — RuntimeFitnessAggregator.WindowAt has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Population.applyFitnessSharingSpatial (cognitive 18) · ×1
  • Population.applyFitnessSharingSpatial (cognitive 18) internal/runtime/ares_evolution/genome/population_guard.go:510 — Population.applyFitnessSharingSpatial has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 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.
D2 · Cognitive Complexity · GenomePopulationAdapter.submitToCoordinator (cognitive 18) · ×1
  • GenomePopulationAdapter.submitToCoordinator (cognitive 18) internal/runtime/ares_evolution/genome_wiring_run.go:687 — GenomePopulationAdapter.submitToCoordinator has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StrategyLifecycle.Submit (cognitive 18) · ×1
  • StrategyLifecycle.Submit (cognitive 18) internal/runtime/ares_evolution/lifecycle_promotion.go:28 — StrategyLifecycle.Submit has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 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.
D2 · Cognitive Complexity · ExperienceGuidedMutator.guidedMutateTool (cognitive 18) · ×1
  • ExperienceGuidedMutator.guidedMutateTool (cognitive 18) internal/runtime/ares_evolution/mutation/guided_mutator.go:579 — ExperienceGuidedMutator.guidedMutateTool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 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.
D2 · Cognitive Complexity · PluginBus.Start (cognitive 18) · ×1
  • PluginBus.Start (cognitive 18) internal/runtime/bus.go:310 — PluginBus.Start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · eval.extractJudgeJSON (cognitive 18) · ×1
  • eval.extractJudgeJSON (cognitive 18) internal/runtime/eval/llm_judge.go:398 — eval.extractJudgeJSON has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 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.
D2 · Cognitive Complexity · Manager.Start (cognitive 18) · ×1
  • Manager.Start (cognitive 18) internal/runtime/manager_lifecycle.go:17 — Manager.Start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 5). Of this number, 13 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Distiller.SubscribeAndDistill (cognitive 18) · ×1
  • Distiller.SubscribeAndDistill (cognitive 18) internal/runtime/memory/distillation/distiller_admin.go:64 — Distiller.SubscribeAndDistill has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 98). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ExperienceExtractor.extractCoreSolution (cognitive 18) · ×1
  • ExperienceExtractor.extractCoreSolution (cognitive 18) internal/runtime/memory/distillation/extractor.go:235 — ExperienceExtractor.extractCoreSolution has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DistillationService.Distill (cognitive 18) · ×1
  • DistillationService.Distill (cognitive 18) internal/runtime/memory/experience/distillation_service.go:111 — DistillationService.Distill has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 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.
D2 · Cognitive Complexity · ares_skills.LoadSkillSources (cognitive 18) · ×1
  • ares_skills.LoadSkillSources (cognitive 18) internal/runtime/protocol/skills/config.go:76 — ares_skills.LoadSkillSources has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeRepository.searchByVectorQuery (cognitive 18) · ×1
  • KnowledgeRepository.searchByVectorQuery (cognitive 18) internal/storage/postgres/repositories/knowledge_repository.go:518 — KnowledgeRepository.searchByVectorQuery has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolExecutionBridge.Execute (cognitive 18) · ×1
  • ToolExecutionBridge.Execute (cognitive 18) internal/tools/planner/bridge.go:81 — ToolExecutionBridge.Execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DAGValidator.detectCycles (cognitive 18) · ×1
  • DAGValidator.detectCycles (cognitive 18) internal/tools/planner/dag.go:91 — DAGValidator.detectCycles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (nesting depth added 8). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 100). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · DataTransform.csvToJSON (cognitive 18) · ×1
  • DataTransform.csvToJSON (cognitive 18) REDACTED:87 — DataTransform.csvToJSON has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (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.
D2 · Cognitive Complexity · DataTransform.jsonToCSV (cognitive 18) · ×1
  • DataTransform.jsonToCSV (cognitive 18) REDACTED:141 — DataTransform.jsonToCSV has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 6 (8 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.
D2 · Cognitive Complexity · CapabilitySelector.Select (cognitive 18) · ×1
  • CapabilitySelector.Select (cognitive 18) internal/tools/toolsource/capability_selector.go:174 — CapabilitySelector.Select has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sdk.wireMemory (cognitive 18) · ×1
  • sdk.wireMemory (cognitive 18) sdk/memory_wiring.go:95 — sdk.wireMemory has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (17 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.
D2 · Cognitive Complexity · graphRun.readySet (cognitive 18) · ×1
  • graphRun.readySet (cognitive 18) sdk/graph_run.go:371 — graphRun.readySet has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.findCycle (cognitive 17) · ×1
  • main.findCycle (cognitive 17) cmd/ares/agent_routes_tasks.go:738 — main.findCycle has cognitive complexity 17 (threshold 15). Drivers by points: loops 7 (9 pts), if/else 4 (8 pts) (nesting depth added 6). 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.
D2 · Cognitive Complexity · ares_bootstrap.wireMemory (cognitive 17) · ×1
  • ares_bootstrap.wireMemory (cognitive 17) internal/ares_bootstrap/bootstrap.go:319 — ares_bootstrap.wireMemory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 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.
D2 · Cognitive Complexity · ares_bootstrap.applyGATuning (cognitive 17) · ×1
  • ares_bootstrap.applyGATuning (cognitive 17) internal/ares_bootstrap/bootstrap_evolution.go:699 — ares_bootstrap.applyGATuning has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 8. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ares_bootstrap.findUnknownPoolTools (cognitive 17) · ×1
  • ares_bootstrap.findUnknownPoolTools (cognitive 17) internal/ares_bootstrap/bootstrap_evolution.go:748 — ares_bootstrap.findUnknownPoolTools has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 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.
D2 · Cognitive Complexity · mcpHealthJoin.resolve (cognitive 17) · ×1
  • mcpHealthJoin.resolve (cognitive 17) internal/ares_bootstrap/provide_mcp.go:97 — mcpHealthJoin.resolve has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_config.Load (cognitive 17) · ×1
  • ares_config.Load (cognitive 17) internal/ares_config/config.go:200 — ares_config.Load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 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.
D2 · Cognitive Complexity · CompactableEventStore.Read (cognitive 17) · ×1
  • CompactableEventStore.Read (cognitive 17) internal/ares_events/compactable_store.go:257 — CompactableEventStore.Read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · MemoryEventStore.ReadAll (cognitive 17) · ×1
  • MemoryEventStore.ReadAll (cognitive 17) internal/ares_events/memory_store.go:230 — MemoryEventStore.ReadAll has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). Of this number, 13 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agentfabric.decodeCognitiveMap (cognitive 17) · ×1
  • agentfabric.decodeCognitiveMap (cognitive 17) internal/fabric/agent/context.go:58 — agentfabric.decodeCognitiveMap has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Fabric.ReapRetired (cognitive 17) · ×1
  • Fabric.ReapRetired (cognitive 17) internal/fabric/agent/reap.go:60 — Fabric.ReapRetired has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (5 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.
D2 · Cognitive Complexity · CompileCoordinator.applyReplaceNode (cognitive 17) · ×1
  • CompileCoordinator.applyReplaceNode (cognitive 17) internal/fabric/planprojection/coordinator.go:617 — CompileCoordinator.applyReplaceNode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CompileCoordinator.SubscribeGraphEvents (cognitive 17) · ×1
  • CompileCoordinator.SubscribeGraphEvents (cognitive 17) internal/fabric/planprojection/coordinator.go:695 — CompileCoordinator.SubscribeGraphEvents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 702). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Fabric.RestoreFromStore (cognitive 17) · ×1
  • Fabric.RestoreFromStore (cognitive 17) internal/fabric/task/restore.go:146 — Fabric.RestoreFromStore has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgePipeline.matchTokenAware (cognitive 17) · ×1
  • KnowledgePipeline.matchTokenAware (cognitive 17) internal/knowledge/pipeline.go:312 — KnowledgePipeline.matchTokenAware has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · code.tokenize (cognitive 17) · ×1
  • code.tokenize (cognitive 17) internal/knowledge/provider/code/provider.go:87 — code.tokenize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 1 (nesting depth added 5). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Store.Query (cognitive 17) · ×1
  • Store.Query (cognitive 17) internal/knowledge/store/sqlite/store.go:259 — Store.Query has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Crossover.segmentCrossParams (cognitive 17) · ×1
  • Crossover.segmentCrossParams (cognitive 17) internal/runtime/ares_evolution/genome/crossover.go:373 — Crossover.segmentCrossParams has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EmbeddingQueue.MarkFailed (cognitive 17) · ×1
  • EmbeddingQueue.MarkFailed (cognitive 17) internal/storage/postgres/embedding_queue.go:488 — EmbeddingQueue.MarkFailed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileTools.readFile (cognitive 17) · ×1
  • FileTools.readFile (cognitive 17) internal/tools/resources/builtin/file/file_tools.go:257 — FileTools.readFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 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.
D2 · Cognitive Complexity · PDFTool.extractText (cognitive 17) · ×1
  • PDFTool.extractText (cognitive 17) internal/tools/resources/builtin/pdf/pdf.go:100 — PDFTool.extractText has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1, loops 1 (nesting depth added 2). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · builtin.extractJSON (cognitive 17) · ×1
  • builtin.extractJSON (cognitive 17) internal/tools/resources/builtin/planning/task_planner.go:394 — builtin.extractJSON has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (3 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.
D2 · Cognitive Complexity · DataTransform.flatten (cognitive 17) · ×1
  • DataTransform.flatten (cognitive 17) REDACTED:247 — DataTransform.flatten has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 2 (6 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.
D2 · Cognitive Complexity · main.loadServeConfig (cognitive 16) · ×1
  • main.loadServeConfig (cognitive 16) cmd/ares/serve.go:255 — main.loadServeConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · webSearchTool.Execute (cognitive 16) · ×1
  • webSearchTool.Execute (cognitive 16) internal/apitools/builtin.go:519 — webSearchTool.Execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, loops 1. Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ares_bootstrap.ProvideEvolution (cognitive 16) · ×1
  • ares_bootstrap.ProvideEvolution (cognitive 16) internal/ares_bootstrap/provide_evolution.go:58 — ares_bootstrap.ProvideEvolution has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ares_bootstrap.BuildKnowledgeRuntime (cognitive 16) · ×1
  • ares_bootstrap.BuildKnowledgeRuntime (cognitive 16) internal/ares_bootstrap/provide_new_evolution.go:556 — ares_bootstrap.BuildKnowledgeRuntime has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 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.
D2 · Cognitive Complexity · PostgresStore.Query (cognitive 16) · ×1
  • PostgresStore.Query (cognitive 16) internal/evidence/postgres_store.go:137 — PostgresStore.Query has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 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.
D2 · Cognitive Complexity · plannerCognition.advertisedToolSchemas (cognitive 16) · ×1
  • plannerCognition.advertisedToolSchemas (cognitive 16) internal/fabric/agent/planner_cognition.go:393 — plannerCognition.advertisedToolSchemas has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · Fabric.cascadeFailureLocked (cognitive 16) · ×1
  • Fabric.cascadeFailureLocked (cognitive 16) internal/fabric/task/dag.go:178 — Fabric.cascadeFailureLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Fabric.blastRadiusLocked (cognitive 16) · ×1
  • Fabric.blastRadiusLocked (cognitive 16) internal/fabric/task/fabric_lifecycle.go:946 — Fabric.blastRadiusLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · engine.NewDAG (cognitive 16) · ×1
  • engine.NewDAG (cognitive 16) internal/fabric/task/workflow/engine/types.go:195 — engine.NewDAG has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 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.
D2 · Cognitive Complexity · RecoveryPatchExecutor.CanApply (cognitive 16) · ×1
  • RecoveryPatchExecutor.CanApply (cognitive 16) internal/fabric/task/workflow/engine/recovery_patcher.go:89 — RecoveryPatchExecutor.CanApply has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Orchestrator.startComponent (cognitive 16) · ×1
  • Orchestrator.startComponent (cognitive 16) internal/kernel/orchestrator.go:126 — Orchestrator.startComponent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (16 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Scheduler.buildQuantumStep (cognitive 16) · ×1
  • Scheduler.buildQuantumStep (cognitive 16) internal/kernel/scheduler_quantum.go:65 — Scheduler.buildQuantumStep has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 3). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 72). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · DistillBridge.persistAndPromote (cognitive 16) · ×1
  • DistillBridge.persistAndPromote (cognitive 16) internal/knowledge/adapter/distill.go:486 — DistillBridge.persistAndPromote has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pipeline.sourceIDMatch (cognitive 16) · ×1
  • pipeline.sourceIDMatch (cognitive 16) internal/knowledge/pipeline/normalizer.go:331 — pipeline.sourceIDMatch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PGProvider.Stream (cognitive 16) · ×1
  • PGProvider.Stream (cognitive 16) internal/knowledge/provider/postgres/provider.go:123 — PGProvider.Stream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 6). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 131). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · RelationExtractor.Extract (cognitive 16) · ×1
  • RelationExtractor.Extract (cognitive 16) internal/knowledge/relation_extract.go:105 — RelationExtractor.Extract has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 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.
D2 · Cognitive Complexity · EvalHarness.runCase (cognitive 16) · ×1
  • EvalHarness.runCase (cognitive 16) internal/knowledge/retriever/eval.go:159 — EvalHarness.runCase has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · Service.GenerateEmbedding (cognitive 16) · ×1
  • Service.GenerateEmbedding (cognitive 16) internal/llmservice/service.go:277 — Service.GenerateEmbedding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fileArchiveReader.Read (cognitive 16) · ×1
  • fileArchiveReader.Read (cognitive 16) internal/runtime/archive/reader.go:60 — fileArchiveReader.Read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · evolution.buildMutator (cognitive 16) · ×1
  • evolution.buildMutator (cognitive 16) internal/runtime/ares_evolution/genome_wiring_builders.go:13 — evolution.buildMutator has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · DefaultNormalizer.normalizeScore (cognitive 16) · ×1
  • DefaultNormalizer.normalizeScore (cognitive 16) internal/runtime/ares_evolution/experience/normalizer.go:211 — DefaultNormalizer.normalizeScore has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 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.
D2 · Cognitive Complexity · genome.ParetoFront (cognitive 16) · ×1
  • genome.ParetoFront (cognitive 16) internal/runtime/ares_evolution/genome/multi_objective.go:92 — genome.ParetoFront has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · genome.selectTopVarDims (cognitive 16) · ×1
  • genome.selectTopVarDims (cognitive 16) internal/runtime/ares_evolution/genome/spatial_index.go:220 — genome.selectTopVarDims has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 5 (7 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.
D2 · Cognitive Complexity · Population.measureCategoricalDiversityLocked (cognitive 16) · ×1
  • Population.measureCategoricalDiversityLocked (cognitive 16) internal/runtime/ares_evolution/genome/adaptive.go:265 — Population.measureCategoricalDiversityLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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.
D2 · Cognitive Complexity · GenomePopulationAdapter.baseRunScorer (cognitive 16) · ×1
  • GenomePopulationAdapter.baseRunScorer (cognitive 16) internal/runtime/ares_evolution/genome_wiring_run.go:333 — GenomePopulationAdapter.baseRunScorer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 7). Of this number, 12 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Strategy.ComputeEvidenceKey (cognitive 16) · ×1
  • Strategy.ComputeEvidenceKey (cognitive 16) internal/runtime/ares_evolution/mutation/types.go:214 — Strategy.ComputeEvidenceKey has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 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.
D2 · Cognitive Complexity · RuntimeObserver.eventToSample (cognitive 16) · ×1
  • RuntimeObserver.eventToSample (cognitive 16) internal/runtime/ares_evolution/observer.go:378 — RuntimeObserver.eventToSample has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · runtime.matchFilter (cognitive 16) · ×1
  • runtime.matchFilter (cognitive 16) internal/runtime/bus.go:633 — runtime.matchFilter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PluginBus.removeLocked (cognitive 16) · ×1
  • PluginBus.removeLocked (cognitive 16) internal/runtime/bus.go:248 — PluginBus.removeLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (5 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.
D2 · Cognitive Complexity · WorkflowGenome.Crossover (cognitive 16) · ×1
  • WorkflowGenome.Crossover (cognitive 16) REDACTED:149 — WorkflowGenome.Crossover has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 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.
D2 · Cognitive Complexity · ExperienceExtractor.extractUserProfile (cognitive 16) · ×1
  • ExperienceExtractor.extractUserProfile (cognitive 16) internal/runtime/memory/distillation/extractor.go:349 — ExperienceExtractor.extractUserProfile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.trimToTokenBudget (cognitive 16) · ×1
  • memory.trimToTokenBudget (cognitive 16) internal/runtime/memory/token_budget.go:106 — memory.trimToTokenBudget has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flight.computeSummary (cognitive 16) · ×1
  • flight.computeSummary (cognitive 16) internal/runtime/observability/flight/timeline.go:186 — flight.computeSummary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Genealogy.RecordResurrection (cognitive 16) · ×1
  • Genealogy.RecordResurrection (cognitive 16) internal/runtime/observability/flight/genealogy.go:92 — Genealogy.RecordResurrection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPClient.call (cognitive 16) · ×1
  • MCPClient.call (cognitive 16) internal/runtime/protocol/mcp/client.go:321 — MCPClient.call has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · SSEServerTransport.handleSSEConnect (cognitive 16) · ×1
  • SSEServerTransport.handleSSEConnect (cognitive 16) internal/runtime/protocol/mcp/transport_server.go:398 — SSEServerTransport.handleSSEConnect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
D2 · Cognitive Complexity · ExperienceRepository.SearchByVector (cognitive 16) · ×1
  • ExperienceRepository.SearchByVector (cognitive 16) internal/storage/postgres/repositories/experience_repository.go:273 — ExperienceRepository.SearchByVector 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.
D2 · Cognitive Complexity · DAGValidator.checkIOCompatibility (cognitive 16) · ×1
  • DAGValidator.checkIOCompatibility (cognitive 16) internal/tools/planner/dag.go:141 — DAGValidator.checkIOCompatibility has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (5 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.
D2 · Cognitive Complexity · memoryEvidenceStore.Aggregate (cognitive 16) · ×1
  • memoryEvidenceStore.Aggregate (cognitive 16) internal/tools/planner/executor.go:187 — memoryEvidenceStore.Aggregate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · core.ValidateParams (cognitive 16) · ×1
  • core.ValidateParams (cognitive 16) internal/tools/resources/core/registry.go:360 — core.ValidateParams has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D23 · Boundary Type-Coupling · Cross-context type TaskResult (core → fabric) · ×1
  • Cross-context type TaskResult (core → fabric) internal/fabric/agent/executor.go:48 — TaskResult (context core) is exposed in fabric's public surface via StepOutcome.Result — couples the contexts.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (3 members, 29 shared lines) · ×1
  • Near-duplicate member family (3 members, 29 shared lines) internal/knowledge/store/memory/store.go:337 — internal/knowledge/store/memory/store.go:337-421 | internal/knowledge/store/postgres/store.go:577-700 | internal/knowledge/store/sqlite/store.go:566-659 — These 3 members are variants of one another: a block of 29 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) REDACTED:297 — REDACTED:297-405 | REDACTED:414-502 — 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.
D4 · Code Duplication · Near-duplicate member pair (32 shared lines) · ×1
  • Near-duplicate member pair (32 shared lines) internal/knowledge/store/postgres/store.go:396 — internal/knowledge/store/postgres/store.go:396-445 | internal/knowledge/store/sqlite/store.go:506-556 — These two members are variants of one another: 32 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Duplicated block (63 lines × 2) · ×1
  • Duplicated block (63 lines × 2) internal/runtime/ares_evolution/mutation/guided_mutator.go:20 — internal/runtime/ares_evolution/mutation/guided_mutator.go:20-82 | internal/runtime/ares_evolution/service/types.go:24-86 — 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 `internal/runtime/ares_evolution/mutation/guided_mutator.go:20` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (61 lines × 3) · ×1
  • Duplicated block (61 lines × 3) internal/runtime/ares_evolution/experience_hints.go:18 — internal/runtime/ares_evolution/experience_hints.go:18-78 | internal/runtime/ares_evolution/mutation/guided_mutator.go:18-78 | internal/runtime/ares_evolution/service/types.go:22-82 — 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 `internal/runtime/ares_evolution/experience_hints.go:18` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) internal/storage/postgres/repositories/knowledge_repository.go:722 — internal/storage/postgres/repositories/knowledge_repository.go:722-759 | internal/storage/postgres/repositories/knowledge_repository.go:797-834 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/repositories/knowledge_repository.go:722` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (33 lines × 3) · ×1
  • Duplicated block (33 lines × 3) internal/storage/postgres/repositories/experience_repository.go:394 — internal/storage/postgres/repositories/experience_repository.go:394-426 | internal/storage/postgres/repositories/experience_repository.go:451-483 | internal/storage/postgres/repositories/experience_repository.go:567-599 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/storage/postgres/repositories/experience_repository.go:394` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (29–30 lines × 3) · ×1
  • Duplicated block (29–30 lines × 3) internal/knowledge/store/memory/store.go:383 — internal/knowledge/store/memory/store.go:383-412 | internal/knowledge/store/postgres/store.go:638-666 | internal/knowledge/store/sqlite/store.go:629-657 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/knowledge/store/memory/store.go:418` calls `cloneObject` and `internal/knowledge/store/sqlite/store.go:658` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) internal/runtime/ares_evolution/scoring/memory_aware_scorer.go:374 — internal/runtime/ares_evolution/scoring/memory_aware_scorer.go:374-403 | internal/runtime/ares_evolution/scoring/memory_aware_scorer.go:457-486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×1
  • Duplicated block (26 lines × 2) internal/storage/postgres/embedding/client.go:280 — internal/storage/postgres/embedding/client.go:280-305 | internal/storage/postgres/embedding/client.go:330-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. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/embedding/client.go:280` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (21–25 lines × 2) · ×1
  • Duplicated block (21–25 lines × 2) internal/agents/sub/agent.go:287 — internal/agents/sub/agent.go:287-311 | internal/agents/sub/agent.go:490-510 — both copies are in the same file, so extract the 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, `internal/agents/sub/agent.go:313` calls `Add`, `Done`, `setStatus` and `internal/agents/sub/agent.go:512` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) internal/ares_security/sanitizer.go:281 — internal/ares_security/sanitizer.go:281-305 | internal/ares_security/sanitizer.go:339-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/ares_security/sanitizer.go:281` 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.
D4 · Code Duplication · Duplicated block (24 lines × 3) · ×1
  • Duplicated block (24 lines × 3) internal/storage/postgres/profile.go:46 — internal/storage/postgres/profile.go:46-69 | internal/storage/postgres/profile.go:157-180 | internal/storage/postgres/profile.go:230-253 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19–24 lines × 2) · ×1
  • Duplicated block (19–24 lines × 2) internal/tools/planner/bridge.go:146 — internal/tools/planner/bridge.go:146-169 | internal/tools/planner/bridge.go:203-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/tools/planner/bridge.go:146` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×1
  • Duplicated block (23 lines × 2) internal/apitools/builtin.go:488 — internal/apitools/builtin.go:488-510 | internal/tools/resources/builtin/network/ssrf.go:89-111 — 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.
D4 · Code Duplication · Duplicated block (16–22 lines × 2) · ×1
  • Duplicated block (16–22 lines × 2) cmd/ares/serve_chaos_domain.go:84 — cmd/ares/serve_chaos_domain.go:84-105 | internal/introspect/chaos.go:206-221 — 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 `cmd/ares/serve_chaos_domain.go:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/introspect/chaos.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) internal/runtime/memory/manager_impl.go:135 — internal/runtime/memory/manager_impl.go:135-156 | internal/runtime/memory/manager_impl.go:183-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) internal/runtime/ares_evolution/scoring/tiered_scorer.go:179 — internal/runtime/ares_evolution/scoring/tiered_scorer.go:179-199 | internal/runtime/ares_evolution/scoring/tiered_scorer.go:250-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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/runtime/ares_evolution/scoring/tiered_scorer.go:201` calls `MakeEntry`, `Put` and `internal/runtime/ares_evolution/scoring/tiered_scorer.go:272` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) REDACTED:361 — REDACTED:361-381 | REDACTED:465-484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift 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:465` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×1
  • Duplicated block (19–20 lines × 2) internal/knowledge/pipeline.go:254 — internal/knowledge/pipeline.go:254-273 | internal/knowledge/pipeline.go:318-336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/pipeline.go: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.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) internal/knowledge/store/postgres/store.go:750 — internal/knowledge/store/postgres/store.go:750-769 | internal/knowledge/store/sqlite/store.go:740-759 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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.
D4 · Code Duplication · Duplicated block (12–19 lines × 2) · ×1
  • Duplicated block (12–19 lines × 2) internal/ares_events/memory_store.go:204 — internal/ares_events/memory_store.go:204-215 | internal/ares_events/memory_store.go:243-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/ares_events/memory_store.go: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.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×1
  • Duplicated block (19 lines × 2) internal/runtime/ares_evolution/genome/crossover.go:340 — internal/runtime/ares_evolution/genome/crossover.go:340-358 | internal/runtime/ares_evolution/genome/crossover.go:405-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/runtime/ares_evolution/genome/crossover.go:340` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) internal/ares_events/summary_repository.go:124 — internal/ares_events/summary_repository.go:124-141 | internal/ares_events/summary_repository.go:169-185 | internal/ares_events/summary_repository.go:213-229 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/ares_events/summary_repository.go:124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) internal/storage/postgres/repositories/knowledge_repository.go:68 — internal/storage/postgres/repositories/knowledge_repository.go:68-83 | internal/storage/postgres/repositories/knowledge_repository.go:415-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) internal/runtime/ares_evolution/genome/selection.go:398 — internal/runtime/ares_evolution/genome/selection.go:398-414 | internal/runtime/ares_evolution/genome/selection.go:707-721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) internal/storage/postgres/repositories/experience_repository.go:333 — internal/storage/postgres/repositories/experience_repository.go:333-346 | REDACTED:377-393 — 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 `internal/storage/postgres/repositories/experience_repository.go:333` it begins part-way through the construct above it, so those 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, `REDACTED:396` calls `Warn` and `internal/storage/postgres/repositories/experience_repository.go:348` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) internal/storage/postgres/repositories/experience_repository.go:627 — internal/storage/postgres/repositories/experience_repository.go:627-642 | internal/storage/postgres/repositories/knowledge_repository.go:864-879 | REDACTED:614-629 — 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 `internal/storage/postgres/repositories/experience_repository.go:627` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) internal/ares_bootstrap/knowledge_akg.go:254 — internal/ares_bootstrap/knowledge_akg.go:254-269 | sdk/distill_events.go:176-188 — 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 `internal/ares_bootstrap/knowledge_akg.go:254` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Check import visibility before settling on that home: `internal/ares_bootstrap/knowledge_akg.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
D4 · Code Duplication · Duplicated block (10–15 lines × 2) · ×1
  • Duplicated block (10–15 lines × 2) internal/kernel/orchestrator.go:306 — internal/kernel/orchestrator.go:306-320 | internal/kernel/orchestrator.go:356-365 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/kernel/orchestrator.go:306` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) internal/knowledge/store/sqlite/store.go:260 — internal/knowledge/store/sqlite/store.go:260-274 | internal/knowledge/store/sqlite/store.go:689-702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10–14 lines × 2) · ×1
  • Duplicated block (10–14 lines × 2) internal/ares_config/store.go:212 — internal/ares_config/store.go:212-221 | internal/runtime/protocol/mcp/config_watcher.go:213-226 — 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 `internal/ares_config/store.go:212` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) internal/knowledge/store/postgres/store.go:313 — internal/knowledge/store/postgres/store.go:313-325 | internal/knowledge/store/postgres/store.go:362-374 | internal/knowledge/store/sqlite/store.go:304-316 | internal/knowledge/store/sqlite/store.go:353-365 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:313` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) internal/runtime/ares_evolution/genome/population_guard.go:423 — internal/runtime/ares_evolution/genome/population_guard.go:423-434 | internal/runtime/ares_evolution/genome/population_guard.go:488-500 | internal/runtime/ares_evolution/genome/population_guard.go:544-556 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/runtime/ares_evolution/genome/population_guard.go:423` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) internal/kernel/registry.go:222 — internal/kernel/registry.go:222-234 | internal/tools/planner/bridge.go:487-497 — 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.
D4 · Code Duplication · Duplicated block (4–12 lines × 3) · ×1
  • Duplicated block (4–12 lines × 3) REDACTED:340 — REDACTED:340-343 | REDACTED:436-447 | REDACTED:532-543 — all 3 copies are in the same file, so extract the block into one function there and call 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:340` it does not close everything it opens, so those 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, `REDACTED:448` calls `Error` and `REDACTED:544` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) REDACTED:60 — REDACTED:60-70 | REDACTED:51-61 | REDACTED:57-67 — 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 `REDACTED:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) cmd/ares/evolution.go:465 — cmd/ares/evolution.go:465-475 | cmd/ares/evolution.go:508-516 — both copies are in the same file, so extract the 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 `string` to `targetID` in one and `capability` 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.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×1
  • Duplicated block (10 lines × 6) internal/knowledge/store/postgres/store.go:316 — internal/knowledge/store/postgres/store.go:316-325 | internal/knowledge/store/postgres/store.go:365-374 | internal/knowledge/store/postgres/store.go:803-812 | internal/knowledge/store/sqlite/store.go:307-316 | internal/knowledge/store/sqlite/store.go:356-365 | internal/knowledge/store/sqlite/store.go:789-798 — `internal/knowledge/store/postgres/store.go` and `internal/knowledge/store/sqlite/store.go` 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 14 separate duplicated blocks between them, totalling at least 202 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 `internal/knowledge/store/postgres/store.go:316` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) internal/fabric/task/workflow/engine/recovery_patcher.go:233 — internal/fabric/task/workflow/engine/recovery_patcher.go:233-242 | internal/fabric/task/workflow/engine/recovery_patcher.go:325-333 | internal/fabric/task/workflow/engine/recovery_patcher.go:416-424 — all 3 copies are in the same file, so extract the block into one function there and call 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 `internal/fabric/task/workflow/engine/recovery_patcher.go: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.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) internal/knowledge/store/sqlite/store.go:451 — internal/knowledge/store/sqlite/store.go:451-458 | internal/knowledge/store/sqlite/store.go:728-734 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/store/sqlite/store.go:451` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) internal/agentipc/bus.go:102 — internal/agentipc/bus.go:102-109 | internal/agentipc/bus.go:120-127 | internal/fabric/agent/fabric.go:122-129 | internal/fabric/task/fabric.go:164-171 — 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) internal/agents/sub/tools.go:95 — internal/agents/sub/tools.go:95-104 | internal/apitools/tools.go:158-166 | internal/tools/resources/core/factory.go:126-134 | internal/tools/resources/core/registry.go:100-110 — 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (13 lines × 6) · ×1
  • Duplicated block (13 lines × 6) internal/tools/resources/builtin/execution/code_runner.go:580 — internal/tools/resources/builtin/execution/code_runner.go:580-592 | internal/tools/resources/builtin/file/file_tools.go:607-619 | internal/tools/resources/builtin/memory/memory_tools.go:286-298 | REDACTED:197-209 | internal/tools/resources/builtin/system/id_generator.go:115-127 | REDACTED:285-297 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:283` calls `IsIdempotent` and `internal/tools/resources/builtin/execution/code_runner.go:577` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) REDACTED:147 — REDACTED:147-156 | REDACTED:137-146 | REDACTED:148-157 | REDACTED:159-168 — 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.
D4 · Code Duplication · Duplicated block (15 lines × 10) · ×1
  • Duplicated block (15 lines × 10) internal/storage/postgres/repositories/experience_repository.go:528 — internal/storage/postgres/repositories/experience_repository.go:528-542 | internal/storage/postgres/repositories/experience_repository.go:628-642 | internal/storage/postgres/repositories/experience_repository.go:736-750 | internal/storage/postgres/repositories/experience_repository.go:776-790 | internal/storage/postgres/repositories/knowledge_repository.go:865-879 | internal/storage/postgres/repositories/knowledge_repository.go:899-913 | internal/storage/postgres/repositories/secret_repository.go:145-159 | internal/storage/postgres/repositories/secret_repository.go:265-279 | REDACTED:615-629 | REDACTED:650-664 — there are 10 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 10 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/storage/postgres/repositories/experience_repository.go:528` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) internal/storage/postgres/profile.go:297 — internal/storage/postgres/profile.go:297-310 | internal/storage/postgres/recommend.go:139-152 | internal/storage/postgres/recommend.go:219-232 | internal/storage/postgres/session.go:176-189 — 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 `internal/storage/postgres/profile.go:297` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) internal/llm/chat.go:173 — internal/llm/chat.go:173-179 | internal/llm/chat.go:291-297 | internal/llm/chat.go:489-495 | internal/llm/generate.go:226-232 | internal/llm/generate.go:311-317 | internal/llm/generate.go:396-402 — 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 `internal/llm/chat.go:173` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
P1 · CI/CD gates · CI formatting step cannot fail · ×1
  • CI formatting step cannot fail REDACTED:51 — `echo "Code not formatted. Run 'goimports -w .'"` invokes goimports in the mode that REWRITES the files it reformats and exits 0 whatever it changed. The rewrite happens inside the runner's throwaway checkout and is then discarded, so the step passes on a badly-formatted change exactly as it passes on a clean one — it enforces nothing, and no other step in this file reads the result. `-l` is the flag that turns the same invocation into a gate: it leaves the files alone and exits non-zero when anything would have been reformatted.
X2 · Cancellation propagation · Function without context.Context · ×1
  • Function without context.Context: validateRemote cmd/ares/serve_arena.go:496 — `validateRemote` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Minor — 107 finding(s)
M4 · Documentation accuracy · README/code drift · ×40
  • README/code drift README.md:331 — README.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift README.md:536 — README.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift README.md:618 — README.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift README.md:620 — README.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift README_CN.md:160 — README_CN.md names `retrieval_nil_kbrepo_test.go`, but no file or folder `retrieval_nil_kbrepo_test.go` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift README_CN.md:288 — README_CN.md names `fabric/task.Fabric.Acquire/Preempt`, but no file or folder `fabric/task.Fabric.Acquire/Preempt` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift README_CN.md:290 — README_CN.md names `fabric/task.Fabric.Yield`, but no file or folder `fabric/task.Fabric.Yield` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift README_CN.md:315 — README_CN.md links to `ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/README.md:28 — docs/README.md links to `../ARCHITECTURE.md`, but `ARCHITECTURE.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/README.md:29 — docs/README.md links to `./reference/framework-comparison-langchain-crewai-agentscope-goagent-zh.md`, but `docs/reference/framework-comparison-langchain-crewai-agentscope-goagent-zh.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/system-internals.en.md:20 — docs/system-internals.en.md names `ARCHITECTURE.md`, but no file or folder `ARCHITECTURE.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/system-internals.zh.md:17 — docs/system-internals.zh.md names `ARCHITECTURE.md`, but no file or folder `ARCHITECTURE.md` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/system-internals.zh.md:1881 — docs/system-internals.zh.md names `internal/storage/postgres/services/`, but no file or folder `internal/storage/postgres/services` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:329 — docs/defects/00-INDEX.md names `postgres/services`, but no file or folder `postgres/services` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:500 — docs/defects/00-INDEX.md names `zh/02`, but no file or folder `zh/02` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:515 — docs/defects/00-INDEX.md names `en/23-quant-trading`, but no file or folder `en/23-quant-trading` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:516 — docs/defects/00-INDEX.md names `en/24.3`, but no file or folder `en/24.3` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:516 — docs/defects/00-INDEX.md names `zh/24.3`, but no file or folder `zh/24.3` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:517 — docs/defects/00-INDEX.md names `zh/00-goagentx-intro`, but no file or folder `zh/00-goagentx-intro` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:518 — docs/defects/00-INDEX.md names `zh/11-autonomous-evolution`, but no file or folder `zh/11-autonomous-evolution` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:520 — docs/defects/00-INDEX.md names `en/13`, but no file or folder `en/13` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:520 — docs/defects/00-INDEX.md names `en/05`, but no file or folder `en/05` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:520 — docs/defects/00-INDEX.md names `en/16`, but no file or folder `en/16` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:522 — docs/defects/00-INDEX.md names `en/22`, but no file or folder `en/22` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/defects/00-INDEX.md:522 — docs/defects/00-INDEX.md names `en/06`, but no file or folder `en/06` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • + 15 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×24
  • Duplicated predicate REDACTED:70 — `!unicode.IsLetter(r) && !unicode.IsDigit(r)` appears character-identically in 2 files — REDACTED, internal/knowledge/pipeline/normalizer.go. 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 cmd/ares/serve.go:332 — `cfg.Security.AuthEnabled && cfg.Security.JWTSecret != ""` appears character-identically in 2 files — cmd/ares/serve.go, cmd/ares/serve_wiring.go. 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 cmd/ares/serve_wiring.go:359 — `cfg.Storage.Enabled && cfg.Storage.Host != ""` appears character-identically in 2 files — cmd/ares/serve_wiring.go, internal/ares_bootstrap/bootstrap_builder.go. 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 internal/ares_bootstrap/bootstrap_evolution.go:36 — `cfg.Storage.Enabled && cfg.Storage.Type == storageTypePostgres && cfg.Storage.Host != ""` appears character-identically in 2 files — internal/ares_bootstrap/bootstrap_evolution.go, internal/ares_bootstrap/knowledge_akg.go. 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 internal/runtime/memory/push/service.go:80 — `config.MinScore < 0 || config.MinScore > 1` appears character-identically in 2 files — internal/runtime/memory/push/service.go, internal/runtime/memory/report/generator.go. 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 internal/storage/postgres/repositories/experience_repository.go:175 — `embeddingStr.Valid && embeddingStr.String != ""` appears character-identically in 3 files — internal/storage/postgres/repositories/experience_repository.go, internal/storage/postgres/repositories/knowledge_repository.go, 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.
  • Duplicated predicate internal/agentruntime/await.go:216 — `err != nil || tk.State != taskfabric.StateCompleted` appears character-identically in 2 files — internal/agentruntime/await.go, sdk/l2_submit.go. 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 internal/ares_events/archive_hook.go:43 — `ev.Type == EventTaskCompleted || ev.Type == EventTaskFailed` appears character-identically in 2 files — internal/ares_events/archive_hook.go, internal/ares_events/compactable_store.go. 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 internal/ares_config/store.go:215 — `event.Has(fsnotify.Rename) || event.Has(fsnotify.Create)` appears character-identically in 2 files — internal/ares_config/store.go, internal/runtime/protocol/mcp/config_watcher.go. 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 internal/ares_config/store.go:213 — `event.Has(fsnotify.Write) || event.Has(fsnotify.Create)` appears character-identically in 2 files — internal/ares_config/store.go, internal/runtime/protocol/mcp/config_watcher.go. 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 internal/ares_events/memory_store.go:127 — `expectedVersion > 0 && currentVersion != expectedVersion` appears character-identically in 2 files — internal/ares_events/memory_store.go, internal/ares_events/pg_store.go. 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 internal/fabric/task/workflow/engine/loader.go:274 — `ext != ".json" && ext != ".yaml" && ext != ".yml"` appears character-identically in 2 files — internal/fabric/task/workflow/engine/loader.go, internal/fabric/task/workflow/engine/reloader.go. 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 cmd/ares/agent_routes_interrupts.go:24 — `h.kernel == nil || h.kernel.fabric == nil` appears character-identically in 2 files — cmd/ares/agent_routes_interrupts.go, cmd/ares/agent_routes_task_read.go. 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 internal/apitools/builtin.go:496 — `ip.IsLoopback() || ip.IsPrivate() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast()` appears character-identically in 2 files — internal/apitools/builtin.go, internal/tools/resources/builtin/network/ssrf.go. 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 internal/knowledge/provider/postgres/provider.go:106 — `len(p.config.IntentTags) == 0 || intent.Goal == ""` appears character-identically in 2 files — internal/knowledge/provider/postgres/provider.go, internal/knowledge/provider/vector/provider.go. 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 internal/storage/postgres/repositories/experience_repository.go:184 — `metadataStr.Valid && metadataStr.String != ""` appears character-identically in 2 files — internal/storage/postgres/repositories/experience_repository.go, internal/storage/postgres/repositories/knowledge_repository.go. 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 internal/ares_events/compactable_store.go:416 — `opts.Limit > 0 && len(filtered) > opts.Limit` appears character-identically in 2 files — internal/ares_events/compactable_store.go, internal/ares_events/memory_store.go. 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 internal/knowledge/store/postgres/store.go:426 — `qualityJSON != "" && qualityJSON != "{}"` appears character-identically in 2 files — internal/knowledge/store/postgres/store.go, internal/knowledge/store/sqlite/store.go. 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 internal/ares_config/config.go:230 — `rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator))` appears character-identically in 4 files — internal/ares_config/config.go, internal/fabric/task/workflow/engine/loader.go, internal/tools/resources/builtin/file/file_tools.go, internal/tools/resources/builtin/pdf/pdf.go. 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 internal/runtime/protocol/mcp/transport_sse.go:326 — `resp.StatusCode < 200 || resp.StatusCode >= 300` appears character-identically in 2 files — internal/runtime/protocol/mcp/transport_sse.go, internal/tools/resources/builtin/embedding/embedding.go. 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 internal/runtime/ares_evolution/regression_gate.go:164 — `result.Confident && result.NewAvg < result.OldAvg` appears character-identically in 2 files — internal/runtime/ares_evolution/regression_gate.go, internal/runtime/evolution/candidate_regression.go. 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 internal/runtime/protocol/skills/catalog.go:300 — `strings.HasPrefix(entry.Path, "http://") || strings.HasPrefix(entry.Path, "https://")` appears character-identically in 2 files — internal/runtime/protocol/skills/catalog.go, internal/runtime/protocol/skills/loader.go. 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 internal/fabric/task/fabric.go:448 — `t.State == StateCompleted || t.State == StateFailed` appears character-identically in 2 files — internal/fabric/task/fabric.go, internal/fabric/task/restore.go. 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 internal/ares_bootstrap/knowledge_akg.go:254 — `tenantID == "" || len(taskText) < 10 || len(resultText) < 20` appears character-identically in 3 files — internal/ares_bootstrap/knowledge_akg.go, internal/ares_bootstrap/provide_distillation.go, sdk/distill_events.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X7 · Silent fallback defaults · Silent fallback default on error · ×19
  • Silent fallback default on error cmd/ares/agent_routes_tasks.go:791 — `collabNodeOutput` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error cmd/ares/main.go:377 — `findAresRoot` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error cmd/ares/serve.go:389 — `portOf` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/ares_events/tool_events.go:80 — `ToolArgShape` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/aresrecovery/sandbox.go:206 — `taskState` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/fabric/agent/planner_context.go:245 — `renderExperiencePrior` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/fabric/agent/planner_rationale.go:125 — `rationaleFromToolCalls` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/fabric/planprojection/projection.go:135 — `parsePriority` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/fabric/task/checkpoint_schema.go:346 — `tokenUsageFromCheckpoint` turns a non-nil `err` into `return 0, 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/fabric/task/checkpoint_schema.go:395 — `stepCheckpointMetadata` turns a non-nil `err` into `return 0, 0, nil` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/knowledge/retriever/eval.go:234 — `rawBaseline` turns a non-nil `err` into `return 0, 0, 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/llm/resilience.go:78 — `secureRandomFloat` turns a non-nil `err` into `return 0.5` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/runtime/ares_evolution/fitness_aggregator.go:464 — `querySourceMeanScopedAt` turns a non-nil `err` into `return 0, 0, time.Time{}, 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error REDACTED:134 — `Fitness` turns a non-nil `err` into `return 0.5, nil` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error REDACTED:124 — `Fitness` turns a non-nil `err` into `return 0.5, nil` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error REDACTED:118 — `Fitness` turns a non-nil `err` into `return 0.5, nil` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error REDACTED:183 — `Fitness` turns a non-nil `err` into `return 0.5, nil` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/runtime/protocol/skills/config.go:39 — `DefaultConfigPath` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error sdk/l2_submit.go:155 — `l2PlanTokenUsage` turns a non-nil `err` into `return TokenUsage{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. 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 `if` or in the doc comment, and the row stops firing.
X4 · Structured logging · Interpolated log message defeats structured logging · ×9
  • Interpolated log message defeats structured logging REDACTED:155 — `info` at line 155 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:163 — `info` at line 163 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:172 — `warning` at line 172 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:177 — `error` at line 177 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:235 — `warning` at line 235 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:263 — `warning` at line 263 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:314 — `warning` at line 314 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:343 — `warning` at line 343 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
  • Interpolated log message defeats structured logging REDACTED:429 — `info` at line 429 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog.
D19 · Documentation Quality · Documentation · ×2
  • Documentation: no project overview docs/README.md — The root README is a status table ('AKG — Knowledge Graph Without LLMs') with no description of what the project is or what it does. Add an overview paragraph explaining ARES's purpose (runtime kernel plus GA evolution) and its key features, such as the adaptive knowledge graph without generative AI.
  • Documentation: contradicts the code docs/system-internals.en.md — The 'Contents' listing references modules like 'CheckpointCognitive', which are not present in v0.3.x source. Verify that all cited modules exist in the current codebase and update the reference accordingly.
X9 · Subsumed condition operand · Subsumed condition operand · ×2
  • Subsumed condition operand examples/_fixtures/eval/main.go:342 — `strings.Contains(lower, "function")` can never decide this `||` — every value satisfying `strings.Contains(lower, "function")` also satisfies `strings.Contains(lower, "func")`, 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 internal/runtime/ares_evolution/service/llm_arena_scorer_test.go:34 — `strings.Contains(prompt, "EACH numbered task")` can never decide this `||` — every value satisfying `strings.Contains(prompt, "EACH numbered task")` also satisfies `strings.Contains(prompt, "numbered task")`, 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.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 2 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (183444 LoC, 1623 module-visible types across 134 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D31 · IaC & Container Security · Low IaC · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.
X2 · Cancellation propagation · Not all functions that make a request accept a context.Context · ×1
  • Not all functions that make a request accept a context.Context — Only 30/31 functions that make a cancellable request (net/http, net.Dial) accept a context.Context or pass one on, so a request keeps running after whatever wanted it has given up — a cancelled request, a shutdown, an expired deadline. Take `ctx context.Context` as the first parameter and build the request with it (`http.NewRequestWithContext`, `DialContext`); where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Minor — 14 finding(s)
D12 · Dependency Hygiene · Outdated · ×14
  • Outdated: github.com/jackc/pgx/v5 — `github.com/jackc/pgx/v5` is required at v5.10.0 in REDACTED, but v5.11.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/jackc/pgx/v5@v5.11.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/prometheus/client_golang — `github.com/prometheus/client_golang` is required at v1.24.1 in REDACTED, but v1.25.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/prometheus/client_golang@v1.25.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/stretchr/testify — `github.com/stretchr/testify` is required at v1.12.0 in REDACTED, but v1.12.1 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/stretchr/testify@v1.12.1 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.opentelemetry.io/otel — `go.opentelemetry.io/otel` is required at v1.45.0 in REDACTED, but v1.47.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.opentelemetry.io/otel@v1.47.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.opentelemetry.io/otel/exporters/stdout/stdouttrace — `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` is required at v1.45.0 in REDACTED, but v1.47.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.opentelemetry.io/otel/exporters/stdout/stdouttrace@v1.47.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.opentelemetry.io/otel/metric — `go.opentelemetry.io/otel/metric` is required at v1.45.0 in REDACTED, but v1.47.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.opentelemetry.io/otel/metric@v1.47.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.opentelemetry.io/otel/sdk — `go.opentelemetry.io/otel/sdk` is required at v1.45.0 in REDACTED, but v1.47.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.opentelemetry.io/otel/sdk@v1.47.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.opentelemetry.io/otel/sdk/metric — `go.opentelemetry.io/otel/sdk/metric` is required at v1.45.0 in REDACTED, but v1.47.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.opentelemetry.io/otel/sdk/metric@v1.47.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.opentelemetry.io/otel/trace — `go.opentelemetry.io/otel/trace` is required at v1.45.0 in REDACTED, but v1.47.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.opentelemetry.io/otel/trace@v1.47.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/crypto — `golang.org/x/crypto` is required at v0.55.0 in REDACTED, but v0.58.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/crypto@v0.58.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/sync — `golang.org/x/sync` is required at v0.22.0 in REDACTED, but v0.24.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/sync@v0.24.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/text — `golang.org/x/text` is required at v0.41.0 in REDACTED, but v0.43.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/text@v0.43.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/time — `golang.org/x/time` is required at v0.15.0 in REDACTED, but v0.16.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/time@v0.16.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: modernc.org/sqlite — `modernc.org/sqlite` is required at v1.56.0 in REDACTED, but v1.61.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get modernc.org/sqlite@v1.61.0 && go mod tidy` and commit the updated REDACTED and go.sum.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-9bdde91e90ea4130bd092666b7a4e637/history.json --exit-code 0 --source .14artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-9bdde91e90ea4130bd092666b7a4e637/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off .64artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm . /tmp/codehealth-osv-sbom-39d85a71d9604bdcba2f2a1030243c5617artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .7artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm . /tmp/codehealth-osv-sbom-39d85a71d9604bdcba2f2a1030243c560artifacts/raw/osv-scanner.json

Run 01a16253-4fb4-7198-838c-d8545f963d68 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

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