Public report — Core-Memory, published 20 Sep 2026.
Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches,
dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase surveyMeasured under the Code Assurance Index · rubric rubric-2026.09.15 (frozen) · verify this surveyFiledcd_9b9cad74eaca48b198a83fdb860214e2
Filed 25 September 2026, 05:08 UTC
Public
Large · 157,435 LoC · rebuild ~1.7 person-years · weakest lens: Readiness (58%)
Findings by grade
27 critical1129 serious22 minor42 could not be resolved — could be critical — see Limitations
This survey was produced by
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
20 September 2026, 21:50 UTC
A measurement, not a certificate. The Code Assurance Index does not certify,
approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The
standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said
here so the number is checked rather than believed.
Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸
1164findings with an exact file:lineof 1178 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
32/116dimensions across the health lenses157435 LoC — wide & deep
The system holds an adequate standing with a health score of 67%, but it carries significant operational risk that threatens delivery speed and security. While the architecture is sound, the foundation is weakened by low production readiness and a hidden tax on every code change. This creates a fragile environment where maintaining the asset is more expensive and slower than it needs to be.
This is a large asset, comprising over 157,000 lines of production code, with a rebuild cost estimated at roughly €250,000. The value tied up here is substantial, yet the code quality signals suggest a persistent velocity tax. Modifications in weaker areas likely cost 9–21% more effort than in clean code, meaning every change incurs a delay penalty that compounds as the system grows. This inefficiency drains engineering capacity and increases long-term maintenance costs.
The most critical risk lies in production readiness, which scores poorly at 58%. For a system of this size, weak operational safeguards mean higher exposure to outages and defects. Without robust testing visibility and secure release processes, the business faces unpredictable downtime and potential security regressions. The lack of clear documentation further complicates onboarding, making the team dependent on tribal knowledge rather than repeatable processes.
Conversely, the code structure and architectural design are genuinely strong, providing a stable base for future development. The domain logic is well-organized, and the system is not burdened by excessive boilerplate. This structural integrity is a key strength that should be preserved while addressing the operational gaps.
Focus first on adding automated security scanning to the continuous integration pipeline. This single action pays for itself within months by preventing security regressions and reducing the annual drag on engineering time. It is the highest-leverage move, offering immediate protection with minimal effort. Until this is in place, other improvements should wait, as they cannot offset the risk of unvetted code reaching production.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
454 finding(s) are new versus the previous scan (2026-07-20) — surfaced by this scheduled scan itself, no pull request required. Showing the first 100; the full set is in the report.
A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.
0.9× (at 67% quality) — the last 20% of quality is most of the work
Size & shape
Large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~1.7 person-years of build effort (about ~€250,000 to rebuild). Its weakest lens is Readiness at 58% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 0.9× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
The release job declares an environment, but its protection rules are not visible from the repository — confirm required reviewers are attached, or publish as a draft release so a bad build can be stopped before users can download it.
The top fix pays for itself · REDACTED · Economics
The top-ranked fix costs roughly 3–10 engineer-days once. Not doing it costs about 143.7–862 engineer-days every year, paid as drag on the ~623,830 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–2 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 9–21% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 153,821 line(s) changed over a 90-day window ⇒ ~623,830/year · D1/D2/D4 code quality: averaging 4.3/10 ⇒ a 9–21% drag on each change · top-ranked remediation: REDACTED effort ⇒ about 3–10 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 2 months.
Value concentrated against a weak lens · REDACTED · Value at risk
This is a Large asset (~1.7 person-years to rebuild), and its weakest lens is Readiness at 58%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Readiness first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · REDACTED · Leverage
Of everything flagged, the best return on effort is: Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
A velocity tax on every change · REDACTED · Economics
The code-quality signals (complexity, duplication, cohesion) average 4.3/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 9–21% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 4.3/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency matrix
Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
108 modules, 38 dependencies. Every dependency points down the layering — no cycles.
Showing the 40 most-connected modules; 68 more are not drawn.
Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
benchmarks.causal_continuity uses benchmarks.causal_continuity.judges. Changing benchmarks.causal_continuity.judges can break benchmarks.causal_continuity, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
17→3 benchmarks.locomo depends on benchmarks.contracts✕
Type pairs
3 distinct (type in benchmarks.locomo → type in benchmarks.contracts) references.
core_memory.entity uses core_memory.entity.speaker_resolver. Changing core_memory.entity.speaker_resolver can break core_memory.entity, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
24→6 core_memory.integrations.http depends on core_memory.integrations.http.server✕
Type pairs
43 distinct (type in core_memory.integrations.http → type in core_memory.integrations.http.server) references. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
core_memory.integrations.http uses core_memory.integrations.http.server. Changing core_memory.integrations.http.server can break core_memory.integrations.http, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
25→7 core_memory.integrations.neo4j depends on core_memory.integrations.neo4j.config✕
Type pairs
1 distinct (type in core_memory.integrations.neo4j → type in core_memory.integrations.neo4j.config) reference.
core_memory.integrations.neo4j uses core_memory.integrations.neo4j.config. Changing core_memory.integrations.neo4j.config can break core_memory.integrations.neo4j, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
26→14 core_memory.integrations.pydanticai depends on core_memory.schema.semantic_tasks✕
Type pairs
2 distinct (type in core_memory.integrations.pydanticai → type in core_memory.schema.semantic_tasks) references.
core_memory.integrations.pydanticai uses core_memory.schema.semantic_tasks. Changing core_memory.schema.semantic_tasks can break core_memory.integrations.pydanticai, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
27→14 core_memory.integrations.pydanticai.semantic_tasks depends on core_memory.schema.semantic_tasks✕
Type pairs
2 distinct (type in core_memory.integrations.pydanticai.semantic_tasks → type in core_memory.schema.semantic_tasks) references.
core_memory.integrations.pydanticai.semantic_tasks uses core_memory.schema.semantic_tasks. Changing core_memory.schema.semantic_tasks can break core_memory.integrations.pydanticai.semantic_tasks, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
28→14 core_memory.integrations.remote depends on core_memory.schema.semantic_tasks✕
Type pairs
3 distinct (type in core_memory.integrations.remote → type in core_memory.schema.semantic_tasks) references.
core_memory.integrations.remote uses core_memory.schema.semantic_tasks. Changing core_memory.schema.semantic_tasks can break core_memory.integrations.remote, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
29→14 core_memory.integrations.remote.semantic_tasks depends on core_memory.schema.semantic_tasks✕
Type pairs
2 distinct (type in core_memory.integrations.remote.semantic_tasks → type in core_memory.schema.semantic_tasks) references.
core_memory.integrations.remote.semantic_tasks uses core_memory.schema.semantic_tasks. Changing core_memory.schema.semantic_tasks can break core_memory.integrations.remote.semantic_tasks, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→8 core_memory.persistence depends on core_memory.persistence.backend✕
Type pairs
2 distinct (type in core_memory.persistence → type in core_memory.persistence.backend) references.
core_memory.persistence uses core_memory.persistence.backend. Changing core_memory.persistence.backend can break core_memory.persistence, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
30→14 core_memory.persistence depends on core_memory.schema.semantic_tasks✕
Type pairs
2 distinct (type in core_memory.persistence → type in core_memory.schema.semantic_tasks) references.
core_memory.persistence uses core_memory.schema.semantic_tasks. Changing core_memory.schema.semantic_tasks can break core_memory.persistence, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
31→8 core_memory.persistence.graph.graphiti_backend depends on core_memory.persistence.backend✕
Type pairs
1 distinct (type in core_memory.persistence.graph.graphiti_backend → type in core_memory.persistence.backend) reference.
core_memory.persistence.graph.graphiti_backend uses core_memory.persistence.backend. Changing core_memory.persistence.backend can break core_memory.persistence.graph.graphiti_backend, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
32→8 core_memory.persistence.graph.kuzu_backend depends on core_memory.persistence.backend✕
Type pairs
1 distinct (type in core_memory.persistence.graph.kuzu_backend → type in core_memory.persistence.backend) reference.
core_memory.persistence.graph.kuzu_backend uses core_memory.persistence.backend. Changing core_memory.persistence.backend can break core_memory.persistence.graph.kuzu_backend, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
33→8 core_memory.persistence.graph.neo4j_backend depends on core_memory.persistence.backend✕
Type pairs
1 distinct (type in core_memory.persistence.graph.neo4j_backend → type in core_memory.persistence.backend) reference.
core_memory.persistence.graph.neo4j_backend uses core_memory.persistence.backend. Changing core_memory.persistence.backend can break core_memory.persistence.graph.neo4j_backend, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
34→8 core_memory.persistence.graph.protocol depends on core_memory.persistence.backend✕
Type pairs
2 distinct (type in core_memory.persistence.graph.protocol → type in core_memory.persistence.backend) references.
core_memory.persistence.graph.protocol uses core_memory.persistence.backend. Changing core_memory.persistence.backend can break core_memory.persistence.graph.protocol, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→10 core_memory.policy depends on core_memory.policy.association_inference_v21✕
Type pairs
1 distinct (type in core_memory.policy → type in core_memory.policy.association_inference_v21) reference.
core_memory.policy uses core_memory.policy.association_inference_v21. Changing core_memory.policy.association_inference_v21 can break core_memory.policy, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
35→11 core_memory.policy depends on core_memory.provider_config✕
Type pairs
1 distinct (type in core_memory.policy → type in core_memory.provider_config) reference.
core_memory.policy.semantic_task_runtime uses core_memory.schema.semantic_tasks. Changing core_memory.schema.semantic_tasks can break core_memory.policy.semantic_task_runtime, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
37→12 core_memory.retrieval depends on core_memory.retrieval.contracts✕
Type pairs
5 distinct (type in core_memory.retrieval → type in core_memory.retrieval.contracts) references.
core_memory.retrieval.tools uses core_memory.persistence.store. Changing core_memory.persistence.store can break core_memory.retrieval.tools, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
39→9 core_memory.runtime.ingest depends on core_memory.persistence.store✕
Type pairs
1 distinct (type in core_memory.runtime.ingest → type in core_memory.persistence.store) reference.
core_memory.runtime.ingest uses core_memory.persistence.store. Changing core_memory.persistence.store can break core_memory.runtime.ingest, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
40→34 core_memory.persistence.graph depends on core_memory.persistence.graph.protocol✕
Type pairs
1 distinct (type in core_memory.persistence.graph → type in core_memory.persistence.graph.protocol) reference.
core_memory.persistence.graph uses core_memory.persistence.graph.protocol. Changing core_memory.persistence.graph.protocol can break core_memory.persistence.graph, not the reverse.
Position
Below the diagonal — points down the layering, which is what you want.
At a glance — Code Health · 73% · Adequate · gated by D1, D2 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A03:2021 — Injection
46
REDACTED / Critical
A06:2021 — Vulnerable & Outdated Components
2
REDACTED
Roadmap
First, integrate static security analysis into the CI pipeline to block builds containing vulnerabilities, and verify that deployment approvals are properly enforced to prevent unsafe releases. Next, update the README to clearly document how to run the test suite, and organize architecture decision records under a dedicated docs folder for better discoverability. Finally, restructure the repository by moving production code into a src directory to separate it from tooling and tests.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
The release job declares an environment, but its protection rules are not visible from the repository — confirm required reviewers are attached, or publish as a draft release so a bad build can be stopped before users can download it.
Resolve the 6 REDACTED finding(s) charged to Static Analysis (SAST) — the other 21 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once.
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 — 27
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 — 1129
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 — 22
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 42
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. 28 of 32 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 — 32 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1164 of 1178 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a coverage step in CI (`pytest tests/ -m "not neo4j_live" -x -q --tb=short --cov=cor…`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) 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 (`coverage run -m pytest` then `coverage xml`) 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.
D12 Dependency Hygiene — 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. Not scored — 1 shipped Python distribution(s) were read, but the outdated signal needs pypi.org, and no declaration here carries an exact pin to ask about — a floor or a range installs the newest release it admits and cannot be behind one, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
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: D22 has no public-API collector for any other ecosystem, and the remedy is to write one — no change to the scan image can close it.
D30 Dependency Vulnerabilities — measured, with a gap in what it reached — 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. The scanner produced no output at all, so no dependency was actually scanned. 1 of 2 declared ecosystem(s) (npm) WERE scanned and every vulnerability they reported is included in this result; REDACTED was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that REDACTED is free of known-vulnerable dependencies.
D43 Malicious Dependencies — measured, with a gap in what it reached — 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. The scanner produced no output at all, so no dependency was actually scanned. 1 of 2 declared ecosystem(s) (npm) WERE scanned and every vulnerability they reported is included in this result; REDACTED was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that REDACTED is free of known-vulnerable dependencies.
AX3 Project dependency cycles — 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 which project references which — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
AX4 Dependency direction — 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 direction each project reference points — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
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.
AX8 Test isolation — 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 which projects are test projects, and what they reference — facts that live in .csproj references. This repository either commits no MSBuild project at all (its C# may still have been parsed as syntax-only projects, which carry no references between them) or its projects failed to load, so there was no graph to read. That is a gap in this analyzer's reach — not a finding that the repository is free of what this check looks for.
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.
ED5 Idempotency — 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 finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
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.
X1 Async 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 is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X12 Unreachable branch — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X13 Undrained process stream — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X14 Bypassable address classification — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X15 Unvalidated length from an untrusted reader — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X19 Unrestored process-global state — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X2 Cancellation propagation — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X20 Mistyped argument guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X21 Side-effecting pattern guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X22 Contradicted release guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X23 Unguarded diagnostic materialisation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X24 Document value interpolated into markup unescaped — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X25 Inert configuration knob — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X26 Unsynchronised callback handoff — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X27 Collection changed while being enumerated — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X28 Index access outside its own emptiness guard — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X3 Exception handling — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X30 Support guard that admits what it rejects — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X32 Type resolved by simple name across every loaded assembly — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
X4 Structured logging — 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 implemented over the C# syntax tree, and no C# was loaded on this run, 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.
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 is implemented over the C# syntax tree, and no C# was loaded on this run, 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.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
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.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
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.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
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.
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.
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 Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: 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".
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, D20, D21, 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.
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.
+ 339 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 candidates.decide_dreamer_candidate (cyclomatic 204) finding(s) in Cyclomatic Complexity — start with candidates.py. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 management.maintain (cyclomatic 173) finding(s) in Cyclomatic Complexity — start with __init__.py. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 canonical.search_request (cyclomatic 150) finding(s) in Cyclomatic Complexity — start with canonical.py. — One of this dimension's main actionable groups (1 warning-level).
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 415 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 candidates.decide_dreamer_candidate (cognitive 359) finding(s) in Cognitive Complexity — start with candidates.py. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 management.maintain (cognitive 186) finding(s) in Cognitive Complexity — start with __init__.py. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 canonical.search_request (cognitive 180) finding(s) in Cognitive Complexity — start with canonical.py. — One of this dimension's main actionable groups (1 warning-level).
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.3 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 30 FileTooLong finding(s) in God Classes — start with coverage.py, server.py, REDACTED. — One of this dimension's main actionable groups (30 warning-level).
Resolve the 1 TooManyMethods finding(s) in God Classes — start with store.py. — One of this dimension's main actionable groups (1 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
183 duplicated block group(s) detected. A further 9 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 4 of the 192 are in trees this repository does not ship — vendored, example/demo, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 69 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 25 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with __init__.py (4), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (25 warning-level).
Resolve the 24 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with __init__.py (4), eval.py (3), crawler_contract.py. — One of this dimension's main actionable groups (24 warning-level).
Resolve the 9 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with root_cause.py (2), extended.py, feature_flags.py. — One of this dimension's main actionable groups (9 warning-level).
Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
What to do
Enforce Architectural Integrity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d7_recommendation.md.
Do you agree with this assessment?
D9 · Test Distribution9.9 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
2464 test methods: 2436 unit, 13 integration, 0 BDD, 15 e2e. The Python suite contributes 2464 test function(s) across 411 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
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.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 1 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 1 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (0 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 Apache-2.0, which is its own choice and is not judged here.
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.
Resolve the 126 Hotspot finding(s) in Churn × Complexity Hotspots — start with __init__.py (3), runner.py (2), store.py (2). — One of this dimension's main actionable groups (126 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor7.1 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
157 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is core_memory/runtime/associations/coverage.py. Counted over 273 of the 400 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×2
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
0 deducted task-comment markers across 84748 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.
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.
Core Memory's documentation is clear and complete: a hero banner plus an Apache-2.0 license badge, a one-page README describing the product (causal memory for AI agents), and a detailed architecture overview with use cases, causal-graph storage semantics, and a recall example; a dedicated tests/README mapping every test filename to its subsystem under development; a demo showing chat, graph, claims, runtime, benchmarking, and read-surface authority; and a benchmarks directory containing canonical harness scaffolds for LOCOMO-like retrieval plus causal-continuity suites. The architecture/pricing PRD index is also well written with a detailed capability PRD table. A comprehensive documentation set for Core Memory: the READMEs and architecture/Docs markdown files collectively present a clear overview of each integration type (SpringAI, PydanticAI, Neo4j, LangChain, GitHub), describe what each measures or surface, give quick-start paths to canonical source docs, document runtime framing and operational notes, and cover the truth-hierarchy policy across memory surfaces. The causal-chain reconstruction benchmark is a standalone README with an explicit outline (What it measures; Why this is the right eval; Quick start; Design notes), while the test suite and status page are canonical testing guides.
Documentation: no installation or build instructions · ×3README.md
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR QualityStrong◐ Sampled · advisory
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.
Evaluated 1 ADR(s) individually; mean quality 8.0/10 (consistently complete and clear). 0 flagged with a specific gap.
What to do
Improve ADR Quality — currently 8.0/10. — Evaluated 1 ADR(s) individually; mean quality 8.0/10 (consistently complete and clear). 0 flagged with a specific gap.
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.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged REDACTED. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
46 finding(s): 0 critical, 27 high, 10 medium, 9 low. 21 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 1 file(s) — `scripts/openclaw_bridge_doctor.sh` — so no absence of findings in them is evidence of anything, and nothing in them was analysed. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.
REDACTED
REDACTED
REDACTED
What to do
Resolve the 10 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED, REDACTED. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 9 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED, REDACTED. — One of this dimension's main actionable groups (9 recommendation-level).
Resolve the 6 REDACTED finding(s) charged to Static Analysis (SAST) — the other 21 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (27 issue-level, 6 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir/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 REDACTED.dev for Dart pub, Elixir/Hex, Go, Java and Kotlin via Maven/Gradle, 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.
No known-vulnerable dependencies in the 1 ecosystem(s) that were scanned (npm). Partial dependency scan: 1 of 2 declared ecosystem(s) were scanned (npm), and the findings above are real and complete for them. REDACTED was not scanned (REDACTED: the scanner produced no output at all, so no dependency was actually scanned), so this is not the whole dependency surface and the result is reported at reduced confidence.
REDACTED
✓ On the Gold path — maintain.
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
4 of 273 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is core_memory/persistence/metrics_ops.py. Counted over 273 of the 400 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned files with no living knowledge
✓ On the Gold path — maintain.
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 2 Change coupling finding(s) in Change Coupling — start with store_add_bead_ops.py, server.py. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
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.
No known-vulnerable dependencies in the 1 ecosystem(s) that were scanned (npm). Partial dependency scan: 1 of 2 declared ecosystem(s) were scanned (npm), and the findings above are real and complete for them. REDACTED was not scanned (REDACTED: the scanner produced no output at all, so no dependency was actually scanned), so this is not the whole dependency surface and the result is reported at reduced confidence.
REDACTED
✓ On the Gold path — maintain.
Detailed fixes: d43_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 1 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
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.
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
Add a 'Testing' section to the root README — how to run the test suite.
Add a README to the 1 of 1 project(s) that lack one — worth up to 2 pts.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
1 ADR-shaped document(s) detected by content — `docs/design/F-W1-write-pipeline.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
What to do
Move ADRs under docs/adr/ (or docs/adrs/) and name them NNNN-title.md so they're easy to find.
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.
Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
What to do
Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 8259 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
What to do
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
What to do
The release job declares an environment, but its protection rules are not visible from the repository — confirm required reviewers are attached, or publish as a draft release so a bad build can be stopped before users can download it.
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.
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Unscored — 2 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Not evidenced — 4 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.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 78 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — no DI registrations detected
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph 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
AX4 Dependency direction — not assessed — project cycles and dependency direction are computed over a project-reference graph 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
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 — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) 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
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.
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 — ~46390 lines of test source are present (.py) 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.
D12 Dependency Hygiene — Not scored — 1 shipped Python distribution(s) were read, but the outdated signal needs pypi.org, and no declaration here carries an exact pin to ask about — a floor or a range installs the newest release it admits and cannot be behind one, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — Production source is present (.py) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — none of 1 ADRs are conformance-checkable — unverifiable.
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — symbol resolution incomplete — navigability not assessed
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 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.
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
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.
D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a CS/VB/GO/SCALA/SWIFT/DART class graph, and this repository's production source is .py, which this pass does not read — so no class could be assessed. Not scored — this is a gap in the analyzer, not a finding about this repository.
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (91 value object(s))
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. 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
P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
P8 Schema migrations — not assessed — schema-migration practice is read from 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
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`coverage run -m pytest` then `coverage xml`) 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
PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF2 Allocation hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF3 Async & latency hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
X1 Async correctness — not 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
X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Hotspot: core_memory/runtime/queue/side_effect_queue.py core_memory/runtime/queue/side_effect_queue.py:117— core_memory/runtime/queue/side_effect_queue.py changed 24 times in last 90 days, max cyclomatic complexity 105 in side_effect_queue.process_side_effect_event at line 117. 2 of those changes were fix/bug commits, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/queue/side_effect_queue.py`: 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: core_memory/retrieval/pipeline/canonical.py core_memory/retrieval/pipeline/canonical.py:891— core_memory/retrieval/pipeline/canonical.py changed 16 times in last 90 days, max cyclomatic complexity 150 in canonical.search_request at line 891. 2 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/retrieval/pipeline/canonical.py`: 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: core_memory/runtime/dreamer/candidates.py core_memory/runtime/dreamer/candidates.py:334— core_memory/runtime/dreamer/candidates.py changed 10 times in last 90 days, max cyclomatic complexity 204 in candidates.decide_dreamer_candidate at line 334. 2 of those changes were fix/bug commits, and the other 8 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/dreamer/candidates.py`: 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: core_memory/association/crawler_contract.py core_memory/association/crawler_contract.py:767— core_memory/association/crawler_contract.py changed 16 times in last 90 days, max cyclomatic complexity 110 in crawler_contract.apply_crawler_updates at line 767. 2 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/association/crawler_contract.py`: 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: core_memory/management/__init__.py core_memory/management/__init__.py:829— core_memory/management/__init__.py changed 10 times in last 90 days, max cyclomatic complexity 173 in management.maintain at line 829. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/management/__init__.py`: 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: core_memory/runtime/turn/turn_flow.py core_memory/runtime/turn/turn_flow.py:29— core_memory/runtime/turn/turn_flow.py changed 13 times in last 90 days, max cyclomatic complexity 99 in turn_flow.process_turn_finalized_impl at line 29. 2 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/turn/turn_flow.py`: 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: core_memory/runtime/associations/coverage.py core_memory/runtime/associations/coverage.py:1862— core_memory/runtime/associations/coverage.py changed 17 times in last 90 days, max cyclomatic complexity 67 in coverage._apply_judge_result at line 1862. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/associations/coverage.py`: 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: core_memory/runtime/engine.py core_memory/runtime/engine.py:302— core_memory/runtime/engine.py changed 27 times in last 90 days, max cyclomatic complexity 39 in engine._resolve_reviewed_updates at line 302. 4 of those changes were fix/bug commits, and the other 23 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/engine.py`: 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: benchmarks/causal_continuity/reporting.py benchmarks/causal_continuity/reporting.py:93— benchmarks/causal_continuity/reporting.py changed 11 times in last 90 days, max cyclomatic complexity 95 in reporting.build_evidence_manifest at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- benchmarks/causal_continuity/reporting.py`: 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:1546— REDACTED changed 12 times in last 90 days, max cyclomatic complexity 85 in semantic_index.semantic_lookup at line 1546. 3 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05: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: core_memory/soul/dreamer_bridge.py core_memory/soul/dreamer_bridge.py:536— core_memory/soul/dreamer_bridge.py changed 14 times in last 90 days, max cyclomatic complexity 68 in dreamer_bridge.propose_soul_from_dreamer at line 536. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/soul/dreamer_bridge.py`: 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: core_memory/integrations/http/server.py core_memory/integrations/http/server.py:2000— core_memory/integrations/http/server.py changed 49 times in last 90 days, max cyclomatic complexity 19 in server.memory_association_candidate_decide at line 2000. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/integrations/http/server.py`: 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: core_memory/retrieval/agent.py core_memory/retrieval/agent.py:817— core_memory/retrieval/agent.py changed 18 times in last 90 days, max cyclomatic complexity 51 in agent.recall at line 817. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/retrieval/agent.py`: 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: core_memory/runtime/passes/enrichment.py core_memory/runtime/passes/enrichment.py:115— core_memory/runtime/passes/enrichment.py changed 10 times in last 90 days, max cyclomatic complexity 91 in enrichment.run_turn_enrichment at line 115. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/passes/enrichment.py`: 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: core_memory/persistence/store_add_bead_ops.py core_memory/persistence/store_add_bead_ops.py:33— core_memory/persistence/store_add_bead_ops.py changed 25 times in last 90 days, max cyclomatic complexity 34 in store_add_bead_ops.add_bead_for_store at line 33. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/persistence/store_add_bead_ops.py`: 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: core_memory/persistence/store_validation_helpers.py core_memory/persistence/store_validation_helpers.py:42— core_memory/persistence/store_validation_helpers.py changed 6 times in last 90 days, max cyclomatic complexity 127 in store_validation_helpers.required_field_issues_for_store at line 42. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/persistence/store_validation_helpers.py`: 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: core_memory/runtime/flush/flush_flow.py core_memory/runtime/flush/flush_flow.py:29— core_memory/runtime/flush/flush_flow.py changed 7 times in last 90 days, max cyclomatic complexity 103 in flush_flow.process_flush_impl at line 29. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/flush/flush_flow.py`: 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: core_memory/soul/summary.py core_memory/soul/summary.py:603— core_memory/soul/summary.py changed 8 times in last 90 days, max cyclomatic complexity 78 in summary._build_light_cone at line 603. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/soul/summary.py`: 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: core_memory/schema/models.py core_memory/schema/models.py:310— core_memory/schema/models.py changed 12 times in last 90 days, max cyclomatic complexity 46 in models._normalize_bead_payload at line 310. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/schema/models.py`: 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: core_memory/transcript_ingest.py core_memory/transcript_ingest.py:192— core_memory/transcript_ingest.py changed 8 times in last 90 days, max cyclomatic complexity 65 in transcript_ingest.normalize_transcript_payload at line 192. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/transcript_ingest.py`: 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: core_memory/integrations/api.py core_memory/integrations/api.py:349— core_memory/integrations/api.py changed 8 times in last 90 days, max cyclomatic complexity 60 in api.inspect_state at line 349. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/integrations/api.py`: 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: core_memory/retrieval/contracts.py core_memory/retrieval/contracts.py:306— core_memory/retrieval/contracts.py changed 8 times in last 90 days, max cyclomatic complexity 59 in contracts.recall_result_from_memory_execute at line 306. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/retrieval/contracts.py`: 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: core_memory/runtime/passes/agent_authored_contract.py core_memory/runtime/passes/agent_authored_contract.py:93— core_memory/runtime/passes/agent_authored_contract.py changed 7 times in last 90 days, max cyclomatic complexity 65 in agent_authored_contract.validate_agent_authored_updates at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/runtime/passes/agent_authored_contract.py`: 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: benchmarks/locomo_like/runner.py benchmarks/locomo_like/runner.py:182— benchmarks/locomo_like/runner.py changed 5 times in last 90 days, max cyclomatic complexity 90 in runner._materialize_case at line 182. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- benchmarks/locomo_like/runner.py`: 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: core_memory/policy/bead_judge.py core_memory/policy/bead_judge.py:371— core_memory/policy/bead_judge.py changed 19 times in last 90 days, max cyclomatic complexity 23 in bead_judge._normalize_judged_fields at line 371. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-05-08..2026-08-06, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-05-08 14:26:39 -05:00' --until='2026-08-06 14:26:39 -05:00' --full-history --no-merges -- core_memory/policy/bead_judge.py`: 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.
FileTooLong: associations/coverage.py core_memory/runtime/associations/coverage.py— FileTooLong — 2945 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2445 over it, 5.89× 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: http/server.py core_memory/integrations/http/server.py— FileTooLong — 2160 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1660 over it, 4.32× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1463 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 963 over it, 2.93× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: pipeline/canonical.py core_memory/retrieval/pipeline/canonical.py— FileTooLong — 1300 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 800 over it, 2.60× 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: graph/root_cause.py core_memory/graph/root_cause.py— FileTooLong — 1183 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 683 over it, 2.37× 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: management/__init__.py core_memory/management/__init__.py— FileTooLong — 1170 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 670 over it, 2.34× 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: soul/summary.py core_memory/soul/summary.py— FileTooLong — 966 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 466 over it, 1.93× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: dreamer/candidates.py core_memory/runtime/dreamer/candidates.py— FileTooLong — 950 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 450 over it, 1.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: turn/reauthoring.py core_memory/runtime/turn/reauthoring.py— FileTooLong — 950 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 450 over it, 1.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 888 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 388 over it, 1.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: association/crawler_contract.py core_memory/association/crawler_contract.py— FileTooLong — 872 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 372 over it, 1.74× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: scripts/check_architecture_guards.py scripts/check_architecture_guards.py— FileTooLong — 853 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 353 over it, 1.71× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: tools/memory_reason.py core_memory/retrieval/tools/memory_reason.py— FileTooLong — 832 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 332 over it, 1.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: session/session_enrichment_delta.py core_memory/runtime/session/session_enrichment_delta.py— FileTooLong — 785 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 285 over it, 1.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: graph/roadmap.py core_memory/graph/roadmap.py— FileTooLong — 776 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 276 over it, 1.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: retrieval/agent.py core_memory/retrieval/agent.py— FileTooLong — 759 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 259 over it, 1.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: persistence/store_management_ops.py core_memory/persistence/store_management_ops.py— FileTooLong — 747 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 247 over it, 1.49× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: retrieval/roadmap_planner.py core_memory/retrieval/roadmap_planner.py— FileTooLong — 744 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 244 over it, 1.49× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: goals/progress.py core_memory/runtime/goals/progress.py— FileTooLong — 712 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 212 over it, 1.42× 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: handlers/setup.py core_memory/cli/handlers/setup.py— FileTooLong — 704 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 204 over it, 1.41× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ingest/external_evidence.py core_memory/runtime/ingest/external_evidence.py— FileTooLong — 700 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 200 over it, 1.40× 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: runtime/engine.py core_memory/runtime/engine.py— FileTooLong — 698 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 198 over it, 1.40× 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: schema/models.py core_memory/schema/models.py— FileTooLong — 647 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 147 over it, 1.29× 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: soul/dreamer_bridge.py core_memory/soul/dreamer_bridge.py— FileTooLong — 583 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 83 over it, 1.17× 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: queue/side_effect_queue.py core_memory/runtime/queue/side_effect_queue.py— FileTooLong — 560 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 60 over it, 1.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
Duplicated block (6 lines × 2) core_memory/cli/handlers/graph.py:52— core_memory/cli/handlers/graph.py:52-57 | core_memory/cli/handlers/store.py:144-149 — 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:196— REDACTED:196-201 | core_memory/graph/traversal.py:49-54 — 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 (6 lines × 2) REDACTED:204— REDACTED:204-209 | REDACTED:541-548 — both copies are in the same file, so extract the 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:751— REDACTED:751-756 | core_memory/runtime/dreamer/analysis.py:70-75 — 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) core_memory/integrations/http/server.py:2305— core_memory/integrations/http/server.py:2305-2310 | core_memory/integrations/http/server.py:2730-2735 — both copies are in the same file, so extract the 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, `core_memory/integrations/http/server.py:2311` calls `str` and `core_memory/integrations/http/server.py:2736` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) REDACTED:184— REDACTED:184-189 | REDACTED:225-230 — both copies are in the same file, so extract the 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) core_memory/integrations/pydanticai/semantic_tasks.py:28— core_memory/integrations/pydanticai/semantic_tasks.py:28-33 | core_memory/policy/semantic_task_runtime.py:211-216 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) core_memory/integrations/pydanticai/semantic_tasks.py:190— core_memory/integrations/pydanticai/semantic_tasks.py:190-195 | core_memory/policy/semantic_task_runtime.py:336-341 — 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) core_memory/management/__init__.py:1002— core_memory/management/__init__.py:1002-1007 | core_memory/management/__init__.py:1072-1077 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/management/__init__.py:1002` it does not close everything it opens, so those exact lines 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) core_memory/management/__init__.py:1029— core_memory/management/__init__.py:1029-1034 | core_memory/management/__init__.py:1085-1090 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/management/__init__.py:1029` it does not close everything it opens, so those exact lines 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) core_memory/management/__init__.py:1075— core_memory/management/__init__.py:1075-1080 | core_memory/management/__init__.py:1088-1093 — both copies are in the same file, so extract the 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, `core_memory/management/__init__.py:1094` calls `_clean_str`, `get` and `core_memory/management/__init__.py:1081` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) core_memory/management/__init__.py:1226— core_memory/management/__init__.py:1226-1231 | core_memory/management/__init__.py:1270-1275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) core_memory/persistence/retrieval_feedback.py:201— core_memory/persistence/retrieval_feedback.py:201-206 | core_memory/schema/bead_projection.py:128-133 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) core_memory/persistence/store_session_ops.py:41— core_memory/persistence/store_session_ops.py:41-46 | core_memory/persistence/store_session_ops.py:50-55 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) core_memory/persistence/store_validation_helpers.py:105— core_memory/persistence/store_validation_helpers.py:105-110 | core_memory/persistence/store_validation_helpers.py:112-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) core_memory/retrieval/causal_recall.py:498— core_memory/retrieval/causal_recall.py:498-503 | core_memory/soul/summary.py:412-417 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) core_memory/retrieval/normalize.py:13— core_memory/retrieval/normalize.py:13-18 | core_memory/retrieval/query_norm.py: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 `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 (6 lines × 2) core_memory/runtime/observability/myelination.py:265— core_memory/runtime/observability/myelination.py:265-270 | core_memory/runtime/observability/myelination.py:275-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/observability/myelination.py:265` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) core_memory/runtime/observability/reviewer_quick_value.py:89— core_memory/runtime/observability/reviewer_quick_value.py:89-94 | core_memory/runtime/observability/reviewer_quick_value.py:97-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/observability/reviewer_quick_value.py:89` it does not close everything it opens, so those exact lines 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) core_memory/integrations/mcp/tools/capture.py:11— core_memory/integrations/mcp/tools/capture.py:11-16 | core_memory/integrations/mcp/tools/sync_transcript_snapshot.py:30-35 — 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 `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 (6 lines × 2) core_memory/persistence/archive_index.py:16— core_memory/persistence/archive_index.py:16-21 | core_memory/runtime/state.py:148-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) core_memory/persistence/metrics_ops.py:69— core_memory/persistence/metrics_ops.py:69-74 | core_memory/persistence/store_metrics_runtime.py:68-73 — before extracting anything, compare `core_memory/persistence/metrics_ops.py` and `core_memory/persistence/store_metrics_runtime.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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 (6 lines × 2) core_memory/integrations/openclaw/agent_end_bridge.py:224— core_memory/integrations/openclaw/agent_end_bridge.py:224-229 | REDACTED:96-101 — 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) core_memory/policy/incidents.py:86— core_memory/policy/incidents.py:86-91 | core_memory/policy/incidents.py:108-113 — both copies are in the same file, so extract the 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 `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 (6 lines × 2) core_memory/runtime/dreamer/goal_discovery.py:99— core_memory/runtime/dreamer/goal_discovery.py:99-104 | core_memory/soul/identity_value_signals.py:87-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) core_memory/association/crawler_contract.py:603— core_memory/association/crawler_contract.py:603-607 | core_memory/association/crawler_contract.py:1014-1019 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core_memory/association/crawler_contract.py:610` calls `_association_in_session_scope` and `core_memory/association/crawler_contract.py:1020` 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) core_memory/cli/__init__.py:159— core_memory/cli/__init__.py:159-163 | core_memory/cli/parsers/extended.py:132-136 — 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) core_memory/cli/__init__.py:231— core_memory/cli/__init__.py:231-235 | core_memory/cli/parsers/extended.py:55-59 — 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) core_memory/cli/handlers/metrics.py:118— core_memory/cli/handlers/metrics.py:118-122 | core_memory/cli/handlers/metrics.py:132-136 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) REDACTED:197— REDACTED:197-201 | core_memory/retrieval/causal_recall.py:491-495 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) core_memory/graph/junctions.py:212— core_memory/graph/junctions.py:212-216 | core_memory/soul/dreamer_bridge.py:389-393 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) core_memory/integrations/http/server.py:2495— core_memory/integrations/http/server.py:2495-2499 | core_memory/integrations/langchain/memory.py:93-99 — 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 `core_memory/integrations/http/server.py:2495` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) REDACTED:250— REDACTED:250-254 | REDACTED:261-265 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) core_memory/integrations/openclaw/agent_end_bridge.py:193— core_memory/integrations/openclaw/agent_end_bridge.py:193-198 | REDACTED:199-203 — 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 (5 lines × 2) core_memory/integrations/openclaw/read_bridge.py:37— core_memory/integrations/openclaw/read_bridge.py:37-41 | core_memory/integrations/openclaw/read_bridge.py:104-108 — both copies are in the same file, so extract the 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) core_memory/management/__init__.py:436— core_memory/management/__init__.py:436-440 | core_memory/management/__init__.py:492-496 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) core_memory/persistence/myelination_rewards.py:212— core_memory/persistence/myelination_rewards.py:212-216 | core_memory/runtime/observability/myelination.py:90-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 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) core_memory/runtime/associations/coverage.py:1222— core_memory/runtime/associations/coverage.py:1222-1226 | core_memory/runtime/associations/coverage.py:1232-1236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/associations/coverage.py:1222` it does not close everything it opens, so those exact lines 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) core_memory/runtime/dreamer/eval.py:191— core_memory/runtime/dreamer/eval.py:191-195 | core_memory/runtime/dreamer/longitudinal.py:99-103 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) core_memory/runtime/dreamer/geometry.py:129— core_memory/runtime/dreamer/geometry.py:129-133 | core_memory/soul/tension_signals.py:59-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. 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, `core_memory/soul/tension_signals.py:64` calls `normalize_relation_type`, `get` and `core_memory/runtime/dreamer/geometry.py:134` 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) core_memory/runtime/turn/ingress.py:28— core_memory/runtime/turn/ingress.py:28-32 | core_memory/runtime/turn/ingress.py:54-58 — both copies are in the same file, so extract the 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) core_memory/soul/store.py:369— core_memory/soul/store.py:369-373 | core_memory/soul/store.py:386-390 — both copies are in the same file, so extract the 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) core_memory/integrations/obsidian/protocol.py:16— core_memory/integrations/obsidian/protocol.py:16-20 | core_memory/persistence/graph/protocol.py:14-70 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) core_memory/policy/semantic_task_runtime.py:38— core_memory/policy/semantic_task_runtime.py:38-42 | core_memory/provider_config.py:106-110 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) core_memory/runtime/dreamer/eval.py:57— core_memory/runtime/dreamer/eval.py:57-61 | core_memory/runtime/dreamer/longitudinal.py:51-55 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) core_memory/management/__init__.py:479— core_memory/management/__init__.py:479-483 | core_memory/management/__init__.py:486-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/management/__init__.py:479` it begins part-way through the construct above it, so those exact lines 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) core_memory/runtime/dreamer/candidates.py:42— core_memory/runtime/dreamer/candidates.py:42-46 | core_memory/schema/normalization.py:642-646 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) core_memory/runtime/dreamer/eval.py:315— core_memory/runtime/dreamer/eval.py:315-319 | core_memory/runtime/dreamer/longitudinal.py:131-135 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) core_memory/runtime/turn/reauthoring.py:228— core_memory/runtime/turn/reauthoring.py:228-232 | core_memory/runtime/turn/reauthoring.py:249-253 — both copies are in the same file, so extract the 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) core_memory/cli/parsers/extended.py:15— core_memory/cli/parsers/extended.py:15-23 | core_memory/cli/parsers/extended.py:25-33 — both copies are in the same file, so extract the block into 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) core_memory/config/feature_flags.py:16— core_memory/config/feature_flags.py:16-24 | core_memory/integrations/neo4j/config.py:52-60 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) core_memory/graph/root_cause.py:306— core_memory/graph/root_cause.py:306-314 | core_memory/graph/root_cause.py:329-337 — both copies are in the same file, so extract the block into 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) core_memory/integrations/mcp/tools/transcript_snapshot_state.py:158— core_memory/integrations/mcp/tools/transcript_snapshot_state.py:158-166 | core_memory/integrations/mcp/tools/transcript_snapshot_state.py:190-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core_memory/integrations/mcp/tools/transcript_snapshot_state.py:189` calls `str` and `core_memory/integrations/mcp/tools/transcript_snapshot_state.py:157` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) core_memory/persistence/store_claim_ops.py:378— core_memory/persistence/store_claim_ops.py:378-386 | core_memory/persistence/store_claim_ops.py:394-402 — both copies are in the same file, so extract the 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) core_memory/runtime/dreamer/eval.py:161— core_memory/runtime/dreamer/eval.py:161-169 | core_memory/runtime/dreamer/longitudinal.py:73-81 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) core_memory/runtime/dreamer/geometry.py:129— core_memory/runtime/dreamer/geometry.py:129-137 | core_memory/soul/assembly_depth.py:150-158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) core_memory/runtime/turn/reauthoring.py:100— core_memory/runtime/turn/reauthoring.py:100-108 | core_memory/runtime/turn/semantic_state.py:355-363 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) core_memory/graph/root_cause.py:63— core_memory/graph/root_cause.py:63-71 | core_memory/retrieval/causal_recall.py:25-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) core_memory/cli/handlers/integrations.py:21— core_memory/cli/handlers/integrations.py:21-28 | core_memory/cli/handlers/integrations.py:39-46 — both copies are in the same file, so extract the block into 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) core_memory/integrations/http/server.py:1078— core_memory/integrations/http/server.py:1078-1085 | core_memory/integrations/http/server.py:1158-1165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/http/server.py:1078` it begins part-way through the construct above it, so those 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) core_memory/management/__init__.py:1014— core_memory/management/__init__.py:1014-1021 | core_memory/management/__init__.py:1101-1108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/management/__init__.py:1014` it does not close everything it opens, so those exact lines 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) core_memory/persistence/store_autonomy_ops.py:12— core_memory/persistence/store_autonomy_ops.py:12-19 | core_memory/schema/promotion.py:88-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) core_memory/persistence/store_claim_ops.py:180— core_memory/persistence/store_claim_ops.py:180-187 | core_memory/policy/association_inference_v21.py:78-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) core_memory/persistence/store_validation_helpers.py:142— core_memory/persistence/store_validation_helpers.py:142-149 | core_memory/persistence/store_validation_helpers.py:153-160 — both copies are in the same file, so extract the block into 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) core_memory/provider_config.py:150— core_memory/provider_config.py:150-157 | core_memory/provider_config.py:182-189 — both copies are in the same file, so extract the block into 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) core_memory/retrieval/pipeline/canonical.py:950— core_memory/retrieval/pipeline/canonical.py:950-957 | core_memory/retrieval/pipeline/canonical.py:960-967 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) core_memory/runtime/dreamer/refinement.py:183— core_memory/runtime/dreamer/refinement.py:183-190 | core_memory/runtime/dreamer/research.py:342-349 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/dreamer/refinement.py:183` it does not close everything it opens, so those exact lines 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) core_memory/integrations/http/server.py:642— core_memory/integrations/http/server.py:642-648 | core_memory/integrations/http/server.py:716-722 — both copies are in the same file, so extract the block into 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) core_memory/integrations/http/server.py:2107— core_memory/integrations/http/server.py:2107-2113 | core_memory/integrations/http/server.py:2115-2121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/http/server.py:2107` it begins part-way through the construct above it, so those exact lines 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) core_memory/integrations/mcp/protocol_server.py:256— core_memory/integrations/mcp/protocol_server.py:256-262 | core_memory/integrations/mcp/protocol_server.py:303-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/mcp/protocol_server.py:256` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) core_memory/persistence/dreamer_candidate_store.py:47— core_memory/persistence/dreamer_candidate_store.py:47-53 | core_memory/runtime/dreamer/analysis.py:273-279 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) REDACTED:1160— REDACTED:1160-1166 | REDACTED:1170-1176 — both copies are in the same file, so extract the block into 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) core_memory/retrieval/tools/memory_reason.py:783— core_memory/retrieval/tools/memory_reason.py:783-789 | core_memory/retrieval/tools/memory_reason.py:791-797 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) core_memory/integrations/neo4j/client.py:237— core_memory/integrations/neo4j/client.py:237-243 | core_memory/integrations/neo4j/client.py:252-258 — both copies are in the same file, so extract the block into 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) core_memory/persistence/goal_lifecycle_v2.py:101— core_memory/persistence/goal_lifecycle_v2.py:101-107 | core_memory/persistence/promotion_service.py:308-314 — 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 (7 lines × 2) examples/http_springai_client.py:90— examples/http_springai_client.py:90-97 | examples/http_springai_client.py:99-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `examples/http_springai_client.py:90` it begins part-way through the construct above it, so those exact lines 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) core_memory/integrations/mcp/tools/ingest_discord.py:65— core_memory/integrations/mcp/tools/ingest_discord.py:65-76 | core_memory/integrations/mcp/tools/ingest_slack.py:62-73 — before extracting anything, compare `core_memory/integrations/mcp/tools/ingest_discord.py` and `core_memory/integrations/mcp/tools/ingest_slack.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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) core_memory/integrations/mcp/tools/ingest_discord.py:104— core_memory/integrations/mcp/tools/ingest_discord.py:104-115 | core_memory/integrations/mcp/tools/ingest_slack.py:99-110 — before extracting anything, compare `core_memory/integrations/mcp/tools/ingest_discord.py` and `core_memory/integrations/mcp/tools/ingest_slack.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/mcp/tools/ingest_discord.py:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) core_memory/management/__init__.py:1331— core_memory/management/__init__.py:1331-1342 | core_memory/management/__init__.py:1355-1366 — both copies are in the same file, so extract the 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) core_memory/persistence/backend.py:311— core_memory/persistence/backend.py:311-322 | core_memory/persistence/backend.py:357-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) core_memory/persistence/graph/graphiti_backend.py:165— core_memory/persistence/graph/graphiti_backend.py:165-176 | core_memory/persistence/graph/graphiti_backend.py:179-190 — both copies are in the same file, so extract the 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) core_memory/persistence/store_approval_ops.py:131— core_memory/persistence/store_approval_ops.py:131-144 | core_memory/persistence/store_lifecycle_ops.py:55-66 — 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 `core_memory/persistence/store_approval_ops.py:131` it does not close everything it opens, so those 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, `core_memory/persistence/store_lifecycle_ops.py:51` calls `str`, `get`, `strip` and `core_memory/persistence/store_approval_ops.py:129` 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) core_memory/runtime/dreamer/eval.py:32— core_memory/runtime/dreamer/eval.py:32-43 | core_memory/runtime/dreamer/longitudinal.py:26-37 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) core_memory/runtime/dreamer/eval.py:266— core_memory/runtime/dreamer/eval.py:266-277 | core_memory/runtime/dreamer/longitudinal.py:183-194 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) core_memory/claim/retrieval_planner.py:44— core_memory/claim/retrieval_planner.py:44-54 | core_memory/retrieval/evidence_scoring.py:49-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) core_memory/persistence/events.py:195— core_memory/persistence/events.py:195-205 | core_memory/persistence/events.py:210-220 — both copies are in the same file, so extract the 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 (11 lines × 2) core_memory/persistence/store_reporting.py:28— core_memory/persistence/store_reporting.py:28-38 | core_memory/persistence/store_reporting.py:85-95 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core_memory/persistence/store_reporting.py:83` calls `get` and `core_memory/persistence/store_reporting.py:27` 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) core_memory/persistence/store_retrieval_context.py:74— core_memory/persistence/store_retrieval_context.py:74-84 | core_memory/retrieval/context_recall.py:100-110 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) core_memory/runtime/dreamer/eval.py:18— core_memory/runtime/dreamer/eval.py:18-28 | core_memory/runtime/dreamer/longitudinal.py:12-22 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) scripts/check_architecture_guards.py:1030— scripts/check_architecture_guards.py:1030-1040 | scripts/check_architecture_guards.py:1063-1073 — both copies are in the same file, so extract the block into 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) core_memory/integrations/openclaw/runtime.py:53— core_memory/integrations/openclaw/runtime.py:53-67 | core_memory/integrations/openclaw/runtime.py:93-107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/openclaw/runtime.py:53` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) core_memory/persistence/event_schema_audit.py:158— core_memory/persistence/event_schema_audit.py:158-172 | core_memory/persistence/event_schema_audit.py:174-188 — both copies are in the same file, so extract the block into 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) core_memory/runtime/turn/semantic_state.py:253— core_memory/runtime/turn/semantic_state.py:253-267 | core_memory/runtime/turn/semantic_state.py:286-300 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) core_memory/persistence/metrics_ops.py:51— core_memory/persistence/metrics_ops.py:51-65 | core_memory/persistence/store_metrics_runtime.py:50-64 — before extracting anything, compare `core_memory/persistence/metrics_ops.py` and `core_memory/persistence/store_metrics_runtime.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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) demo/app.py:728— demo/app.py:728-749 | demo/app.py:767-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `demo/app.py:767` it does not close everything it opens, so those 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 (5 lines × 3) core_memory/graph/traversal.py:126— core_memory/graph/traversal.py:126-130 | REDACTED:226-230 | core_memory/retrieval/causal_recall.py:491-495 — 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 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, `core_memory/retrieval/causal_recall.py:496` calls `str`, `get`, `strip` and `core_memory/graph/traversal.py:131` 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 × 3) core_memory/retrieval/normalize.py:13— core_memory/retrieval/normalize.py:13-17 | core_memory/retrieval/query_norm.py:79-83 | core_memory/retrieval/rerank.py:38-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) core_memory/runtime/observability/reviewer_quick_value.py:90— core_memory/runtime/observability/reviewer_quick_value.py:90-94 | core_memory/runtime/observability/reviewer_quick_value.py:98-102 | core_memory/runtime/observability/reviewer_quick_value.py:229-233 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/observability/reviewer_quick_value.py:90` it does not close everything it opens, so those exact lines 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) core_memory/cli/parsers/extended.py:73— core_memory/cli/parsers/extended.py:73-77 | core_memory/cli/parsers/extended.py:79-83 | core_memory/cli/parsers/ops.py:40-44 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 3) core_memory/integrations/mcp/protocol_server.py:162— core_memory/integrations/mcp/protocol_server.py:162-175 | core_memory/integrations/mcp/protocol_server.py:207-229 | core_memory/integrations/mcp/protocol_server.py:290-294 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/mcp/protocol_server.py:162` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) core_memory/integrations/openclaw/agent_end_bridge.py:266— core_memory/integrations/openclaw/agent_end_bridge.py:266-275 | REDACTED:119-128 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) core_memory/persistence/metrics_ops.py:31— core_memory/persistence/metrics_ops.py:31-40 | core_memory/persistence/store_metrics_runtime.py:30-39 — before extracting anything, compare `core_memory/persistence/metrics_ops.py` and `core_memory/persistence/store_metrics_runtime.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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, `core_memory/persistence/store_metrics_runtime.py:28` calls `read_metrics_state_for_store`, `_default_state` and `core_memory/persistence/metrics_ops.py:30` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) REDACTED:18— REDACTED:18-27 | core_memory/retrieval/fanout.py:17-26 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. 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) core_memory/runtime/dreamer/eval.py:65— core_memory/runtime/dreamer/eval.py:65-74 | core_memory/runtime/dreamer/longitudinal.py:59-68 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (5 members, 50+ identical tokens) core_memory/graph/storylines.py:40— core_memory/graph/storylines.py:40-55 | core_memory/persistence/semantic_task_receipts.py:95-107 | core_memory/persistence/session_surface.py:16-36 | core_memory/runtime/associations/coverage.py:187-200 | core_memory/runtime/associations/coverage.py:204-216 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) core_memory/integrations/pydanticai/semantic_tasks.py:37— core_memory/integrations/pydanticai/semantic_tasks.py:37-47 | core_memory/policy/bead_judge.py:300-310 | core_memory/policy/bead_typing.py:120-130 | core_memory/policy/rationale.py:168-178 | core_memory/policy/semantic_task_runtime.py:197-207 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) core_memory/persistence/retrieval_feedback.py:18— core_memory/persistence/retrieval_feedback.py:18-29 | core_memory/runtime/dreamer/eval.py:17-28 | core_memory/runtime/dreamer/longitudinal.py:11-22 | core_memory/runtime/observability/self_model_drift.py:22-33 | core_memory/temporal/resolution.py:8-19 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (4 members, 50+ identical tokens) core_memory/integrations/mcp/tools/ingest.py:197— core_memory/integrations/mcp/tools/ingest.py:197-298 | core_memory/integrations/mcp/tools/ingest_discord.py:80-172 | core_memory/integrations/mcp/tools/ingest_slack.py:77-153 | core_memory/integrations/mcp/tools/ingest_zoom.py:130-237 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) core_memory/integrations/openclaw/agent_end_bridge.py:325— core_memory/integrations/openclaw/agent_end_bridge.py:325-353 | core_memory/integrations/openclaw/compaction_bridge.py:62-77 | REDACTED:279-305 | core_memory/integrations/openclaw/read_bridge.py:136-160 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) core_memory/runtime/dreamer/convergence.py:146— core_memory/runtime/dreamer/convergence.py:146-209 | core_memory/runtime/dreamer/goal_decay.py:125-176 | core_memory/runtime/dreamer/goal_discovery.py:136-187 | core_memory/runtime/dreamer/tension_discovery.py:69-123 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Duplicated block (19 lines × 2) core_memory/integrations/mcp/protocol_server.py:396— core_memory/integrations/mcp/protocol_server.py:396-414 | core_memory/integrations/mcp/protocol_server.py:523-546 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/mcp/protocol_server.py:396` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) core_memory/retrieval/pipeline/canonical.py:1421— core_memory/retrieval/pipeline/canonical.py:1421-1439 | core_memory/retrieval/pipeline/canonical.py:1549-1567 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) core_memory/runtime/engine.py:814— core_memory/runtime/engine.py:814-832 | core_memory/runtime/turn/turn_flow.py:105-123 — 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 `core_memory/runtime/engine.py:814` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) core_memory/persistence/myelination_rewards.py:602— core_memory/persistence/myelination_rewards.py:602-619 | core_memory/persistence/retrieval_feedback.py:150-167 — 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 (18 lines × 2) core_memory/persistence/store_text_hygiene_ops.py:41— core_memory/persistence/store_text_hygiene_ops.py:41-58 | core_memory/retrieval/query_norm.py:56-73 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) core_memory/retrieval/lexical.py:162— core_memory/retrieval/lexical.py:162-179 | core_memory/retrieval/lexical.py:209-226 — both copies are in the same file, so extract the block into 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 × 5) core_memory/graph/storylines.py:42— core_memory/graph/storylines.py:42-49 | core_memory/persistence/semantic_task_receipts.py:95-102 | core_memory/persistence/session_surface.py:23-30 | core_memory/runtime/associations/coverage.py:188-195 | core_memory/runtime/associations/coverage.py:204-211 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 5) core_memory/integrations/pydanticai/semantic_tasks.py:37— core_memory/integrations/pydanticai/semantic_tasks.py:37-44 | core_memory/policy/bead_judge.py:300-307 | core_memory/policy/bead_typing.py:120-127 | core_memory/policy/rationale.py:168-175 | core_memory/policy/semantic_task_runtime.py:197-204 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `core_memory/policy/bead_judge.py:308` calls `isinstance` and `core_memory/integrations/pydanticai/semantic_tasks.py:45` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 5) core_memory/runtime/dreamer/candidates.py:50— core_memory/runtime/dreamer/candidates.py:50-57 | core_memory/runtime/dreamer/geometry.py:48-55 | core_memory/runtime/dreamer/refinement.py:51-58 | core_memory/runtime/dreamer/research.py:31-38 | core_memory/soul/summary.py:56-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. 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, `core_memory/runtime/dreamer/geometry.py:43` calls `_manifest_path`, `Path` and `core_memory/runtime/dreamer/refinement.py:47` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) core_memory/association/slo.py:50— core_memory/association/slo.py:50-55 | core_memory/graph/traversal.py:125-130 | core_memory/retrieval/causal_recall.py:490-495 — 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 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, `core_memory/retrieval/causal_recall.py:496` calls `str`, `get`, `strip` and `core_memory/graph/traversal.py:131` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) core_memory/graph/traversal.py:50— core_memory/graph/traversal.py:50-55 | core_memory/graph/traversal.py:126-131 | REDACTED:226-231 — 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 (6 lines × 3) core_memory/runtime/dreamer/goal_decay.py:147— core_memory/runtime/dreamer/goal_decay.py:147-176 | core_memory/runtime/dreamer/goal_discovery.py:182-187 | core_memory/runtime/dreamer/tension_discovery.py:118-123 — before extracting anything, compare `core_memory/runtime/dreamer/goal_decay.py` and `core_memory/runtime/dreamer/goal_discovery.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/dreamer/goal_discovery.py:182` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 × 4) core_memory/retrieval/agent.py:512— core_memory/retrieval/agent.py:512-516 | core_memory/retrieval/agent.py:553-557 | core_memory/retrieval/agent.py:584-588 | core_memory/retrieval/agent.py:758-762 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/retrieval/agent.py:512` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 4) core_memory/association/edge_lifecycle.py:41— core_memory/association/edge_lifecycle.py:41-45 | core_memory/graph/worldlines.py:39-43 | core_memory/retrieval/agent.py:99-103 | core_memory/retrieval/causal_recall.py:37-41 — 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 transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `root` to `str | Path` in one and `str` 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 (5 lines × 4) core_memory/graph/junctions.py:34— core_memory/graph/junctions.py:34-38 | core_memory/graph/roadmap.py:58-62 | core_memory/graph/root_cause.py:121-125 | core_memory/retrieval/roadmap_planner.py:42-46 — 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 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.
Change coupling: store_add_bead_ops.py ↔ external_evidence.py core_memory/persistence/store_add_bead_ops.py— `core_memory/persistence/store_add_bead_ops.py` and `core_memory/runtime/ingest/external_evidence.py` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `d31b77b1` Implement lossless agent-authored bead writes (#404); `438d294b` Scrub retired Ragie tie-ins (#375); `a5e2460b` Remove Ragie recall fan-out (#374) — run `git show` on any of them.
Change coupling: server.py ↔ side_effect_queue.py core_memory/integrations/http/server.py— `core_memory/integrations/http/server.py` and `core_memory/runtime/queue/side_effect_queue.py` change together 50% of the time (10 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `e9016a24` feat(retrieval): build durable junction roadmap (#434); `cae4f400` feat(goals): add reviewed goal progress edges (#433); `2aa1f9e2` Improve agent-judged causal association quality (#417) — run `git show` on any of them.
Duplicated block (28 lines × 2) core_memory/integrations/github/connector.py:73— core_memory/integrations/github/connector.py:73-100 | core_memory/integrations/github/connector.py:109-136 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `core_memory/integrations/github/connector.py:71` calls `_s`, `get` and `core_memory/integrations/github/connector.py:108` 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 (28 lines × 2) core_memory/runtime/observability/reviewer_quick_value.py:119— core_memory/runtime/observability/reviewer_quick_value.py:119-146 | core_memory/runtime/observability/reviewer_quick_value.py:152-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 `core_memory/runtime/observability/reviewer_quick_value.py:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) core_memory/graph/root_cause.py:349— core_memory/graph/root_cause.py:349-372 | core_memory/retrieval/causal_recall.py:108-131 — 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 `core_memory/graph/root_cause.py:349` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `bead` to `Mapping[str, Any]` in one and `dict[str, Any]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (24 lines × 2) core_memory/soul/summary.py:882— core_memory/soul/summary.py:882-905 | core_memory/soul/summary.py:907-930 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (23 lines × 2) core_memory/integrations/openclaw/compaction_bridge.py:36— core_memory/integrations/openclaw/compaction_bridge.py:36-58 | core_memory/runtime/queue/compaction_queue.py:76-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23 lines × 2) core_memory/runtime/dreamer/candidates.py:743— core_memory/runtime/dreamer/candidates.py:743-765 | core_memory/runtime/dreamer/candidates.py:802-824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/dreamer/candidates.py:802` it begins part-way through the construct above it, so those exact lines 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) core_memory/integrations/http/server.py:826— core_memory/integrations/http/server.py:826-842 | core_memory/integrations/http/server.py:2258-2274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) core_memory/runtime/turn/reauthoring.py:880— core_memory/runtime/turn/reauthoring.py:880-896 | core_memory/runtime/turn/reauthoring.py:1126-1142 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/turn/reauthoring.py:880` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) core_memory/integrations/mcp/tools/ingest_discord.py:80— core_memory/integrations/mcp/tools/ingest_discord.py:80-96 | core_memory/integrations/mcp/tools/ingest_slack.py:77-92 — before extracting anything, compare `core_memory/integrations/mcp/tools/ingest_discord.py` and `core_memory/integrations/mcp/tools/ingest_slack.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) core_memory/integrations/mcp/tools/ingest_discord.py:139— core_memory/integrations/mcp/tools/ingest_discord.py:139-154 | core_memory/integrations/mcp/tools/ingest_zoom.py:204-219 — 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–16 lines × 2) core_memory/integrations/pydanticai/run.py:115— core_memory/integrations/pydanticai/run.py:115-128 | core_memory/integrations/pydanticai/run.py:219-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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–16 lines × 2) core_memory/runtime/associations/coverage.py:2043— core_memory/runtime/associations/coverage.py:2043-2058 | core_memory/runtime/associations/coverage.py:3379-3392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/associations/coverage.py:2043` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–14 lines × 2) core_memory/association/crawler_contract.py:511— core_memory/association/crawler_contract.py:511-524 | core_memory/association/crawler_contract.py:929-940 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/association/crawler_contract.py: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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–14 lines × 2) core_memory/retrieval/tools/memory_reason.py:480— core_memory/retrieval/tools/memory_reason.py:480-493 | core_memory/retrieval/tools/memory_reason.py:505-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.
Duplicated block (14 lines × 2) core_memory/persistence/turn_archive.py:254— core_memory/persistence/turn_archive.py:254-267 | REDACTED:929-942 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) examples/claim_layer_demo.py:71— examples/claim_layer_demo.py:71-84 | examples/claim_layer_demo.py:135-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.
Duplicated block (11 lines × 3) REDACTED:152— REDACTED:152-162 | core_memory/persistence/store_validation_helpers.py:21-31 | core_memory/schema/promotion.py:68-78 — 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 `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 (11 lines × 3) core_memory/persistence/retrieval_feedback.py:19— core_memory/persistence/retrieval_feedback.py:19-29 | core_memory/runtime/observability/self_model_drift.py:23-33 | core_memory/temporal/resolution.py:9-19 — 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 transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) core_memory/association/crawler_contract.py:143— core_memory/association/crawler_contract.py:143-152 | core_memory/runtime/ingest/external_evidence.py:106-115 | core_memory/schema/models.py:265-274 — 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 transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) core_memory/persistence/retrieval_feedback.py:38— core_memory/persistence/retrieval_feedback.py:38-47 | core_memory/runtime/dreamer/eval.py:35-44 | core_memory/runtime/dreamer/longitudinal.py:29-38 — 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 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.
candidates.decide_dreamer_candidate (cyclomatic 204) core_memory/runtime/dreamer/candidates.py:334— candidates.decide_dreamer_candidate has cyclomatic complexity 204 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
management.maintain (cyclomatic 173) core_memory/management/__init__.py:829— management.maintain has cyclomatic complexity 173 (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.
canonical.search_request (cyclomatic 150) core_memory/retrieval/pipeline/canonical.py:891— canonical.search_request has cyclomatic complexity 150 (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.
store_validation_helpers.required_field_issues_for_store (cyclomatic 127) core_memory/persistence/store_validation_helpers.py:42— store_validation_helpers.required_field_issues_for_store has cyclomatic complexity 127 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
canonical.trace_request (cyclomatic 121) core_memory/retrieval/pipeline/canonical.py:1180— canonical.trace_request has cyclomatic complexity 121 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
crawler_contract.apply_crawler_updates (cyclomatic 110) core_memory/association/crawler_contract.py:767— crawler_contract.apply_crawler_updates has cyclomatic complexity 110 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
management._validate_action (cyclomatic 110) core_memory/management/__init__.py:396— management._validate_action has cyclomatic complexity 110 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
memory_reason.memory_reason (cyclomatic 109) core_memory/retrieval/tools/memory_reason.py:762— memory_reason.memory_reason has cyclomatic complexity 109 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
canonical.execute_request (cyclomatic 108) core_memory/retrieval/pipeline/canonical.py:1444— canonical.execute_request has cyclomatic complexity 108 (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.
side_effect_queue.process_side_effect_event (cyclomatic 105) core_memory/runtime/queue/side_effect_queue.py:117— side_effect_queue.process_side_effect_event has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
flush_flow.process_flush_impl (cyclomatic 103) core_memory/runtime/flush/flush_flow.py:29— flush_flow.process_flush_impl has cyclomatic complexity 103 (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.
turn_flow.process_turn_finalized_impl (cyclomatic 99) core_memory/runtime/turn/turn_flow.py:29— turn_flow.process_turn_finalized_impl has cyclomatic complexity 99 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
crawler_contract.merge_crawler_updates (cyclomatic 93) core_memory/association/crawler_contract.py:435— crawler_contract.merge_crawler_updates has cyclomatic complexity 93 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
enrichment.run_turn_enrichment (cyclomatic 91) core_memory/runtime/passes/enrichment.py:115— enrichment.run_turn_enrichment has cyclomatic complexity 91 (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.
search.search_typed (cyclomatic 86) core_memory/retrieval/pipeline/search.py:36— search.search_typed has cyclomatic complexity 86 (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.
semantic_index.semantic_lookup (cyclomatic 85) REDACTED:1546— semantic_index.semantic_lookup has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session_enrichment_delta.crawler_updates_to_delta (cyclomatic 81) core_memory/runtime/session/session_enrichment_delta.py:422— session_enrichment_delta.crawler_updates_to_delta has cyclomatic complexity 81 (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.
candidates.enqueue_dreamer_candidates (cyclomatic 79) core_memory/runtime/dreamer/candidates.py:93— candidates.enqueue_dreamer_candidates has cyclomatic complexity 79 (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.
summary._build_light_cone (cyclomatic 78) core_memory/soul/summary.py:603— summary._build_light_cone has cyclomatic complexity 78 (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.
sync_transcript_snapshot.sync_transcript_snapshot_handler (cyclomatic 68) core_memory/integrations/mcp/tools/sync_transcript_snapshot.py:217— sync_transcript_snapshot.sync_transcript_snapshot_handler has cyclomatic complexity 68 (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.
dreamer_bridge.propose_soul_from_dreamer (cyclomatic 68) core_memory/soul/dreamer_bridge.py:536— dreamer_bridge.propose_soul_from_dreamer has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
memory_reason._plan_why (cyclomatic 67) core_memory/retrieval/tools/memory_reason.py:525— memory_reason._plan_why has cyclomatic complexity 67 (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.
coverage._apply_judge_result (cyclomatic 67) core_memory/runtime/associations/coverage.py:1862— coverage._apply_judge_result has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hybrid.hybrid_lookup (cyclomatic 66) core_memory/retrieval/hybrid.py:101— hybrid.hybrid_lookup has cyclomatic complexity 66 (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.
agent_authored_contract.validate_agent_authored_updates (cyclomatic 65) core_memory/runtime/passes/agent_authored_contract.py:93— agent_authored_contract.validate_agent_authored_updates has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
summary._build_tensions (cyclomatic 65) core_memory/soul/summary.py:957— summary._build_tensions has cyclomatic complexity 65 (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.
transcript_ingest.normalize_transcript_payload (cyclomatic 65) core_memory/transcript_ingest.py:192— transcript_ingest.normalize_transcript_payload has cyclomatic complexity 65 (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.
canonical._apply_typed_filters (cyclomatic 61) core_memory/retrieval/pipeline/canonical.py:699— canonical._apply_typed_filters has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
coverage.run_association_coverage (cyclomatic 61) core_memory/runtime/associations/coverage.py:2483— coverage.run_association_coverage has cyclomatic complexity 61 (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.
api.inspect_state (cyclomatic 60) core_memory/integrations/api.py:349— api.inspect_state has cyclomatic complexity 60 (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.
contracts.recall_result_from_memory_execute (cyclomatic 59) core_memory/retrieval/contracts.py:306— contracts.recall_result_from_memory_execute has cyclomatic complexity 59 (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.
coverage.decide_association_candidate (cyclomatic 58) core_memory/runtime/associations/coverage.py:2925— coverage.decide_association_candidate has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
core.backfill_causal_links (cyclomatic 55) REDACTED:257— core.backfill_causal_links has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
roadmap.roadmap_watershed_attribution (cyclomatic 55) core_memory/graph/roadmap.py:486— roadmap.roadmap_watershed_attribution has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
core.sync_structural_pipeline (cyclomatic 54) REDACTED:391— core.sync_structural_pipeline has cyclomatic complexity 54 (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.
ingest.ingest_handler (cyclomatic 54) core_memory/integrations/mcp/tools/ingest.py:196— ingest.ingest_handler has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
crawler_contract._normalize_review_rows (cyclomatic 53) core_memory/association/crawler_contract.py:35— crawler_contract._normalize_review_rows has cyclomatic complexity 53 (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.
metrics.handle_metrics_command (cyclomatic 53) core_memory/cli/handlers/metrics.py:14— metrics.handle_metrics_command 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.
canonical._claim_anchors_from_state (cyclomatic 52) core_memory/retrieval/pipeline/canonical.py:184— canonical._claim_anchors_from_state has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent.recall (cyclomatic 51) core_memory/retrieval/agent.py:817— agent.recall has cyclomatic complexity 51 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
reauthoring._cohort_metrics (cyclomatic 51) core_memory/runtime/turn/reauthoring.py:209— reauthoring._cohort_metrics has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Neo4jClient.upsert_projection (cyclomatic 50) core_memory/integrations/neo4j/client.py:121— Neo4jClient.upsert_projection has cyclomatic complexity 50 (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.
agent._expand_via_association_hops (cyclomatic 49) core_memory/retrieval/agent.py:599— agent._expand_via_association_hops has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session_enrichment_delta.canonical_session_projection (cyclomatic 47) core_memory/runtime/session/session_enrichment_delta.py:802— session_enrichment_delta.canonical_session_projection has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
semantic_index.apply_semantic_delta (cyclomatic 46) REDACTED:1348— semantic_index.apply_semantic_delta has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
models._normalize_bead_payload (cyclomatic 46) core_memory/schema/models.py:310— models._normalize_bead_payload has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
memory_reason._radius1_structural_fallback (cyclomatic 45) core_memory/retrieval/tools/memory_reason.py:371— memory_reason._radius1_structural_fallback has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
coverage.enqueue_association_coverage (cyclomatic 45) core_memory/runtime/associations/coverage.py:2192— coverage.enqueue_association_coverage has cyclomatic complexity 45 (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.
crawler_contract._normalize_creation_rows_with_diagnostics (cyclomatic 43) core_memory/association/crawler_contract.py:156— crawler_contract._normalize_creation_rows_with_diagnostics has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
core.build_graph (cyclomatic 43) REDACTED:673— core.build_graph has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
summary._build_divergence (cyclomatic 43) core_memory/soul/summary.py:829— summary._build_divergence has cyclomatic complexity 43 (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.
health.association_pending_judge_health (cyclomatic 42) core_memory/association/health.py:29— health.association_pending_judge_health has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
answer_signals.compute_answer_signals (cyclomatic 42) core_memory/claim/answer_signals.py:15— answer_signals.compute_answer_signals has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
graph.handle_graph_command (cyclomatic 42) core_memory/cli/handlers/graph.py:20— graph.handle_graph_command has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
semantic_index.build_semantic_index (cyclomatic 42) REDACTED:1104— semantic_index.build_semantic_index has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
reviewer_quick_value.reviewer_quick_value_v2 (cyclomatic 42) core_memory/runtime/observability/reviewer_quick_value.py:61— reviewer_quick_value.reviewer_quick_value_v2 has cyclomatic complexity 42 (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.
compat.apply_grouped_aliases (cyclomatic 41) core_memory/cli/compat.py:63— compat.apply_grouped_aliases has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent_end_bridge.process_agent_end_event (cyclomatic 41) core_memory/integrations/openclaw/agent_end_bridge.py:182— agent_end_bridge.process_agent_end_event has cyclomatic complexity 41 (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.
agent._collect_extra_seeds (cyclomatic 41) core_memory/retrieval/agent.py:473— agent._collect_extra_seeds has cyclomatic complexity 41 (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.
canonical._claim_answer_candidate (cyclomatic 41) core_memory/retrieval/pipeline/canonical.py:310— canonical._claim_answer_candidate has cyclomatic complexity 41 (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.
memory_execute_eval.main (cyclomatic 41) eval/memory_execute_eval.py:44— memory_execute_eval.main has cyclomatic complexity 41 (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.
retrieval_feedback.record_retrieval_feedback (cyclomatic 40) core_memory/persistence/retrieval_feedback.py:76— retrieval_feedback.record_retrieval_feedback has cyclomatic complexity 40 (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.
coverage._normalized_candidate_rows (cyclomatic 40) core_memory/runtime/associations/coverage.py:490— coverage._normalized_candidate_rows has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
eval.dreamer_eval_report (cyclomatic 40) core_memory/runtime/dreamer/eval.py:261— eval.dreamer_eval_report has cyclomatic complexity 40 (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.
side_effect_queue.drain_side_effect_queue (cyclomatic 40) core_memory/runtime/queue/side_effect_queue.py:582— side_effect_queue.drain_side_effect_queue has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
semantic_task_verifier.verify_semantic_task_output (cyclomatic 39) core_memory/policy/semantic_task_verifier.py:182— semantic_task_verifier.verify_semantic_task_output has cyclomatic complexity 39 (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.
coverage._pair_signals (cyclomatic 39) core_memory/runtime/associations/coverage.py:1056— coverage._pair_signals has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine._resolve_reviewed_updates (cyclomatic 39) core_memory/runtime/engine.py:302— engine._resolve_reviewed_updates has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
receipt.build_turn_finalized_receipt (cyclomatic 39) core_memory/runtime/turn/receipt.py:129— receipt.build_turn_finalized_receipt has cyclomatic complexity 39 (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.
root_cause._parameterized_best_first_search (cyclomatic 38) core_memory/graph/root_cause.py:554— root_cause._parameterized_best_first_search has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
events.rebuild_index (cyclomatic 38) core_memory/persistence/events.py:163— events.rebuild_index has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
refinement.refine_pending_candidates (cyclomatic 38) core_memory/runtime/dreamer/refinement.py:145— refinement.refine_pending_candidates has cyclomatic complexity 38 (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.
core.causal_traverse (cyclomatic 37) REDACTED:816— core.causal_traverse has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
traversal._build_adjacency (cyclomatic 37) core_memory/graph/traversal.py:37— traversal._build_adjacency has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
canonical._apply_hint_boosts (cyclomatic 37) core_memory/retrieval/pipeline/canonical.py:811— canonical._apply_hint_boosts has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
bead_projection.build_retrieval_text (cyclomatic 37) core_memory/schema/bead_projection.py:79— bead_projection.build_retrieval_text has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
register (cyclomatic 37) plugins/openclaw-core-memory-bridge/index.js:19— register has cyclomatic complexity 37 (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.
myelination.compute_myelination_bonus_map (cyclomatic 36) core_memory/runtime/observability/myelination.py:57— myelination.compute_myelination_bonus_map has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent_authored_updates._validate_json_value (cyclomatic 36) core_memory/schema/agent_authored_updates.py:506— agent_authored_updates._validate_json_value has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ingest_discord.ingest_discord_handler (cyclomatic 35) core_memory/integrations/mcp/tools/ingest_discord.py:79— ingest_discord.ingest_discord_handler has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
entity_registry.upsert_canonical_entity (cyclomatic 35) REDACTED:112— entity_registry.upsert_canonical_entity has cyclomatic complexity 35 (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.
store_claim_ops.resolve_current_state (cyclomatic 35) core_memory/persistence/store_claim_ops.py:448— store_claim_ops.resolve_current_state has cyclomatic complexity 35 (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.
evidence_scoring.rerank_semantic_rows (cyclomatic 35) core_memory/retrieval/evidence_scoring.py:105— evidence_scoring.rerank_semantic_rows has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
progress._evaluate_pair (cyclomatic 35) core_memory/runtime/goals/progress.py:231— progress._evaluate_pair has cyclomatic complexity 35 (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.
turn_prep.normalize_turn_request (cyclomatic 35) core_memory/runtime/turn/turn_prep.py:25— turn_prep.normalize_turn_request has cyclomatic complexity 35 (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.
dreamer_bridge._run_soul_proposal_task (cyclomatic 35) core_memory/soul/dreamer_bridge.py:421— dreamer_bridge._run_soul_proposal_task has cyclomatic complexity 35 (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.
transcript_ingest._resolve_envelope_speakers (cyclomatic 35) core_memory/transcript_ingest.py:467— transcript_ingest._resolve_envelope_speakers has cyclomatic complexity 35 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
promotion_service.promotion_kpis_for_store (cyclomatic 34) core_memory/persistence/promotion_service.py:528— promotion_service.promotion_kpis_for_store has cyclomatic complexity 34 (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.
store_add_bead_ops.add_bead_for_store (cyclomatic 34) core_memory/persistence/store_add_bead_ops.py:33— store_add_bead_ops.add_bead_for_store has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store_retrieval_context.retrieve_with_context_for_store (cyclomatic 34) core_memory/persistence/store_retrieval_context.py:6— store_retrieval_context.retrieve_with_context_for_store has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
coverage.apply_association_proposals (cyclomatic 34) core_memory/runtime/associations/coverage.py:3270— coverage.apply_association_proposals has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
research._apply_candidate_refinements (cyclomatic 34) core_memory/runtime/dreamer/research.py:243— research._apply_candidate_refinements has cyclomatic complexity 34 (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.
research.run_dreamer_research (cyclomatic 34) core_memory/runtime/dreamer/research.py:303— research.run_dreamer_research has cyclomatic complexity 34 (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.
health.association_health_report (cyclomatic 33) core_memory/association/health.py:120— health.association_health_report has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.main (cyclomatic 33) core_memory/cli/__init__.py:100— cli.main has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
core.backfill_structural_edges (cyclomatic 32) REDACTED:488— core.backfill_structural_edges has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
core.infer_structural_edges (cyclomatic 32) REDACTED:582— core.infer_structural_edges has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
chunk_evidence.resolve_semantic_hits (cyclomatic 32) core_memory/retrieval/chunk_evidence.py:190— chunk_evidence.resolve_semantic_hits has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
context_recall.retrieve_with_context (cyclomatic 32) core_memory/retrieval/context_recall.py:15— context_recall.retrieve_with_context has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
semantic_index.load_cached_bead_embeddings (cyclomatic 32) REDACTED:945— semantic_index.load_cached_bead_embeddings has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
progress.run_goal_progress_tasks (cyclomatic 32) core_memory/runtime/goals/progress.py:436— progress.run_goal_progress_tasks has cyclomatic complexity 32 (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.
tension_meter.compute_tension_resolution_meter (cyclomatic 32) core_memory/runtime/observability/tension_meter.py:108— tension_meter.compute_tension_resolution_meter has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
store.handle_store_commands (cyclomatic 31) core_memory/cli/handlers/store.py:14— store.handle_store_commands has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
traversal.filter_chains_to_active_edges (cyclomatic 31) core_memory/graph/traversal.py:106— traversal.filter_chains_to_active_edges has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ingest_zoom.ingest_zoom_handler (cyclomatic 31) core_memory/integrations/mcp/tools/ingest_zoom.py:129— ingest_zoom.ingest_zoom_handler has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
calibration.compute_calibration_curve (cyclomatic 31) core_memory/persistence/calibration.py:182— calibration.compute_calibration_curve has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
store_reporting.schema_quality_report_for_store (cyclomatic 31) core_memory/persistence/store_reporting.py:127— store_reporting.schema_quality_report_for_store has cyclomatic complexity 31 (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.
agent._conflicts_for_result (cyclomatic 31) core_memory/retrieval/agent.py:241— agent._conflicts_for_result has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
coverage.judge_association_candidates (cyclomatic 31) core_memory/runtime/associations/coverage.py:3137— coverage.judge_association_candidates has cyclomatic complexity 31 (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.
external_evidence._find_existing_external_bead (cyclomatic 31) core_memory/runtime/ingest/external_evidence.py:242— external_evidence._find_existing_external_bead has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
root_cause.segment_frontier_between (cyclomatic 30) core_memory/graph/root_cause.py:1168— root_cause.segment_frontier_between 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.
store_relationship_ops.promote_for_store (cyclomatic 30) core_memory/persistence/store_relationship_ops.py:18— store_relationship_ops.promote_for_store 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.
analysis._structural_signal_pack (cyclomatic 30) core_memory/runtime/dreamer/analysis.py:204— analysis._structural_signal_pack has cyclomatic complexity 30 (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.
geometry.build_geometry_manifest (cyclomatic 30) core_memory/runtime/dreamer/geometry.py:68— geometry.build_geometry_manifest has cyclomatic complexity 30 (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.
engine.process_turn_finalized (cyclomatic 30) core_memory/runtime/engine.py:576— engine.process_turn_finalized 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.
reauthoring.reauthor_memory (cyclomatic 30) core_memory/runtime/turn/reauthoring.py:618— reauthoring.reauthor_memory 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.
diagnostics.doctor_report (cyclomatic 29) core_memory/cli/diagnostics.py:71— diagnostics.doctor_report has cyclomatic complexity 29 (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.
memory.handle_memory_command (cyclomatic 29) core_memory/cli/handlers/memory.py:8— memory.handle_memory_command 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.
storylines.derive_storylines (cyclomatic 29) core_memory/graph/storylines.py:66— storylines.derive_storylines 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.
sync._collect_prune_keep_assoc_ids (cyclomatic 29) REDACTED:199— sync._collect_prune_keep_assoc_ids 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.
goal_lifecycle_v2.transition_goal_state_for_store (cyclomatic 29) core_memory/persistence/goal_lifecycle_v2.py:77— goal_lifecycle_v2.transition_goal_state_for_store has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
promotion_service.decide_promotion_for_store (cyclomatic 29) core_memory/persistence/promotion_service.py:155— promotion_service.decide_promotion_for_store has cyclomatic complexity 29 (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.
store_add_helpers.find_recent_duplicate_bead_id_for_store (cyclomatic 29) core_memory/persistence/store_add_helpers.py:121— store_add_helpers.find_recent_duplicate_bead_id_for_store has cyclomatic complexity 29 (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.
store_management_ops.remove_beads_for_store (cyclomatic 29) core_memory/persistence/store_management_ops.py:322— store_management_ops.remove_beads_for_store has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
coverage.enqueue_goal_progress_candidate (cyclomatic 29) core_memory/runtime/associations/coverage.py:615— coverage.enqueue_goal_progress_candidate has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
coverage._write_association_if_missing (cyclomatic 29) core_memory/runtime/associations/coverage.py:1271— coverage._write_association_if_missing has cyclomatic complexity 29 (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.
engine._ensure_turn_creation_update (cyclomatic 29) core_memory/runtime/engine.py:483— engine._ensure_turn_creation_update 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.
ingress.maybe_emit_finalize_memory_event (cyclomatic 29) core_memory/runtime/turn/ingress.py:80— ingress.maybe_emit_finalize_memory_event has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
paraphrase_eval.main (cyclomatic 29) eval/paraphrase_eval.py:51— paraphrase_eval.main 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.
answer_policy.decide_answer_outcome (cyclomatic 28) core_memory/claim/answer_policy.py:22— answer_policy.decide_answer_outcome has cyclomatic complexity 28 (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.
core._sync_associations_to_links (cyclomatic 28) REDACTED:188— core._sync_associations_to_links 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.
junctions.derive_junction_projection (cyclomatic 28) core_memory/graph/junctions.py:323— junctions.derive_junction_projection has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
roadmap.build_junction_roadmap (cyclomatic 28) core_memory/graph/roadmap.py:774— roadmap.build_junction_roadmap 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.
entity_merge_flow.apply_entity_merge_for_index (cyclomatic 28) REDACTED:133— entity_merge_flow.apply_entity_merge_for_index has cyclomatic complexity 28 (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.
myelination_rewards.emit_myelination_reward_event (cyclomatic 28) core_memory/persistence/myelination_rewards.py:236— myelination_rewards.emit_myelination_reward_event has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
source_hydration.hydrate_bead_sources_for_root (cyclomatic 28) core_memory/persistence/source_hydration.py:19— source_hydration.hydrate_bead_sources_for_root 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.
chunk_evidence.build_chunk_evidence_corpus (cyclomatic 28) core_memory/retrieval/chunk_evidence.py:110— chunk_evidence.build_chunk_evidence_corpus 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.
analysis.synthesize_themes (cyclomatic 28) core_memory/runtime/dreamer/analysis.py:545— analysis.synthesize_themes 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.
engine._enforce_structural_invariants (cyclomatic 28) core_memory/runtime/engine.py:418— engine._enforce_structural_invariants 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.
semantic_state.mark_semantic_write_state (cyclomatic 28) core_memory/runtime/turn/semantic_state.py:85— semantic_state.mark_semantic_write_state has cyclomatic complexity 28 (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.
register::emitFallbackTurn (cyclomatic 28) plugins/openclaw-core-memory-bridge/index.js:446— register::emitFallbackTurn has cyclomatic complexity 28 (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.
root_cause._build_edges (cyclomatic 27) core_memory/graph/root_cause.py:163— root_cause._build_edges 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.
ingest_slack.ingest_slack_handler (cyclomatic 27) core_memory/integrations/mcp/tools/ingest_slack.py:76— ingest_slack.ingest_slack_handler has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
recall_payload.run_recall_payload (cyclomatic 27) core_memory/integrations/recall_payload.py:59— recall_payload.run_recall_payload has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
llm_client.chat_complete (cyclomatic 27) REDACTED:27— llm_client.chat_complete 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.
dreamer_candidate_store.enqueue_contradiction_pressure_candidates (cyclomatic 27) core_memory/persistence/dreamer_candidate_store.py:152— dreamer_candidate_store.enqueue_contradiction_pressure_candidates 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.
myelination_rewards.supporting_edge_keys_for_bead (cyclomatic 27) core_memory/persistence/myelination_rewards.py:164— myelination_rewards.supporting_edge_keys_for_bead 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.
retrieval_feedback.summarize_retrieval_feedback (cyclomatic 27) core_memory/persistence/retrieval_feedback.py:180— retrieval_feedback.summarize_retrieval_feedback has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
agent._resolved_goals_for_result (cyclomatic 27) core_memory/retrieval/agent.py:139— agent._resolved_goals_for_result 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.
catalog.build_catalog (cyclomatic 27) core_memory/retrieval/pipeline/catalog.py:14— catalog.build_catalog 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.
roadmap_planner.plan_over_roadmap (cyclomatic 27) core_memory/retrieval/roadmap_planner.py:657— roadmap_planner.plan_over_roadmap has cyclomatic complexity 27 (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.
semantic_index._provider_vectors (cyclomatic 27) REDACTED:768— semantic_index._provider_vectors has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
identity_value_research.enqueue_identity_value_candidates (cyclomatic 27) core_memory/runtime/dreamer/identity_value_research.py:38— identity_value_research.enqueue_identity_value_candidates 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.
external_evidence._validate_external_payload (cyclomatic 27) core_memory/runtime/ingest/external_evidence.py:372— external_evidence._validate_external_payload 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.
agent_crawler_invoke.invoke_turn_crawler_agent (cyclomatic 27) core_memory/runtime/passes/agent_crawler_invoke.py:20— agent_crawler_invoke.invoke_turn_crawler_agent 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.
session_start_flow.build_session_start_snapshot (cyclomatic 27) core_memory/runtime/session/session_start_flow.py:31— session_start_flow.build_session_start_snapshot has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
transcript_ingest.ingest_turn_envelopes (cyclomatic 27) core_memory/transcript_ingest.py:344— transcript_ingest.ingest_turn_envelopes 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.
worldlines._goal_worldlines (cyclomatic 26) core_memory/graph/worldlines.py:161— worldlines._goal_worldlines 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.
hosted_capture_bridge.process_hosted_capture_event (cyclomatic 26) REDACTED:186— hosted_capture_bridge.process_hosted_capture_event has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
store_management_ops.deactivate_association_for_store (cyclomatic 26) core_memory/persistence/store_management_ops.py:785— store_management_ops.deactivate_association_for_store has cyclomatic complexity 26 (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.
association_inference_v21.validate_and_normalize_inference_payload (cyclomatic 26) core_memory/policy/association_inference_v21.py:129— association_inference_v21.validate_and_normalize_inference_payload has cyclomatic complexity 26 (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.
causal_recall.build_state_packet (cyclomatic 26) core_memory/retrieval/causal_recall.py:247— causal_recall.build_state_packet 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.
pipeline._normalize_search_request (cyclomatic 26) core_memory/retrieval/pipeline/__init__.py:25— pipeline._normalize_search_request has cyclomatic complexity 26 (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.
canonical._to_anchor (cyclomatic 26) core_memory/retrieval/pipeline/canonical.py:596— canonical._to_anchor has cyclomatic complexity 26 (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.
semantic_index.semantic_doctor (cyclomatic 26) REDACTED:452— semantic_index.semantic_doctor has cyclomatic complexity 26 (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.
analysis.run_analysis (cyclomatic 26) core_memory/runtime/dreamer/analysis.py:371— analysis.run_analysis 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.
self_model_drift.compute_self_model_drift (cyclomatic 26) core_memory/runtime/observability/self_model_drift.py:129— self_model_drift.compute_self_model_drift 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.
assembly_depth.compute_assembly_depth (cyclomatic 26) core_memory/soul/assembly_depth.py:135— assembly_depth.compute_assembly_depth 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.
identity_value_signals.detect_identity_value_findings (cyclomatic 26) core_memory/soul/identity_value_signals.py:74— identity_value_signals.detect_identity_value_findings has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
integrity.soul_integrity_check (cyclomatic 26) core_memory/soul/integrity.py:63— integrity.soul_integrity_check 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.
memory_search_ab_compare.main (cyclomatic 26) eval/memory_search_ab_compare.py:30— memory_search_ab_compare.main 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.
check_architecture_guards.main (cyclomatic 26) scripts/check_architecture_guards.py:1100— check_architecture_guards.main 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.
edge_lifecycle.collect_used_edge_pairs (cyclomatic 25) core_memory/association/edge_lifecycle.py:60— edge_lifecycle.collect_used_edge_pairs 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.
slo.association_slo_report (cyclomatic 25) core_memory/association/slo.py:65— slo.association_slo_report has cyclomatic complexity 25 (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.
retrieval_planner.plan_retrieval_mode (cyclomatic 25) core_memory/claim/retrieval_planner.py:73— retrieval_planner.plan_retrieval_mode 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.
roadmap.edge_cost_row (cyclomatic 25) core_memory/graph/roadmap.py:229— roadmap.edge_cost_row has cyclomatic complexity 25 (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.
onboard.harden_openclaw_plugin_config (cyclomatic 25) core_memory/integrations/openclaw/onboard.py:39— onboard.harden_openclaw_plugin_config has cyclomatic complexity 25 (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.
store_autonomy_ops.reinforcement_signals_for_store (cyclomatic 25) core_memory/persistence/store_autonomy_ops.py:6— store_autonomy_ops.reinforcement_signals_for_store has cyclomatic complexity 25 (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.
store_claim_ops.find_canonical_turn_bead_id (cyclomatic 25) core_memory/persistence/store_claim_ops.py:84— store_claim_ops.find_canonical_turn_bead_id 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.
store_compaction_ops.compact_for_store (cyclomatic 25) core_memory/persistence/store_compaction_ops.py:14— store_compaction_ops.compact_for_store has cyclomatic complexity 25 (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.
causal_recall.extract_source_citations (cyclomatic 25) core_memory/retrieval/causal_recall.py:146— causal_recall.extract_source_citations 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.
eval._label_summary (cyclomatic 25) core_memory/runtime/dreamer/eval.py:204— eval._label_summary has cyclomatic complexity 25 (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.
research._bead_context (cyclomatic 25) core_memory/runtime/dreamer/research.py:98— research._bead_context has cyclomatic complexity 25 (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.
compaction_queue.drain_compaction_queue (cyclomatic 25) core_memory/runtime/queue/compaction_queue.py:122— compaction_queue.drain_compaction_queue has cyclomatic complexity 25 (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.
goal_lifecycle.resolve_goals_for_turn (cyclomatic 25) core_memory/runtime/session/goal_lifecycle.py:51— goal_lifecycle.resolve_goals_for_turn 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.
promotion._reinforcement_signals (cyclomatic 25) core_memory/schema/promotion.py:81— promotion._reinforcement_signals has cyclomatic complexity 25 (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.
summary._tension_light_cone_reports (cyclomatic 25) core_memory/soul/summary.py:527— summary._tension_light_cone_reports has cyclomatic complexity 25 (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.
edge_lifecycle.fold_edge_usage (cyclomatic 24) core_memory/association/edge_lifecycle.py:131— edge_lifecycle.fold_edge_usage 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.
update_policy.emit_claim_updates (cyclomatic 24) core_memory/claim/update_policy.py:123— update_policy.emit_claim_updates 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.
sync._dedupe_projection (cyclomatic 24) REDACTED:246— sync._dedupe_projection has cyclomatic complexity 24 (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.
store_management_ops.remove_source_beads_for_store (cyclomatic 24) core_memory/persistence/store_management_ops.py:474— store_management_ops.remove_source_beads_for_store has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
hygiene.curated_type_title_hygiene (cyclomatic 24) core_memory/policy/hygiene.py:45— hygiene.curated_type_title_hygiene 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.
agent._normalize_request (cyclomatic 24) core_memory/retrieval/agent.py:376— agent._normalize_request has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rerank._load_structural_adjacency (cyclomatic 24) core_memory/retrieval/rerank.py:113— rerank._load_structural_adjacency 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.
retrieval_value_overrides.apply_retrieval_value_override_for_index (cyclomatic 24) REDACTED:55— retrieval_value_overrides.apply_retrieval_value_override_for_index has cyclomatic complexity 24 (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.
reauthoring.retry_pending_semantic (cyclomatic 24) core_memory/runtime/turn/reauthoring.py:921— reauthoring.retry_pending_semantic 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.
diagnostics.simple_recall_fallback (cyclomatic 23) core_memory/cli/diagnostics.py:170— diagnostics.simple_recall_fallback has cyclomatic complexity 23 (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.
sync._collect_projection (cyclomatic 23) REDACTED:151— sync._collect_projection 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.
promotion_service.resolve_goal_candidate_for_store (cyclomatic 23) core_memory/persistence/promotion_service.py:288— promotion_service.resolve_goal_candidate_for_store has cyclomatic complexity 23 (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.
bead_judge._normalize_judged_fields (cyclomatic 23) core_memory/policy/bead_judge.py:371— bead_judge._normalize_judged_fields has cyclomatic complexity 23 (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.
causal_recall.attach_causal_recall_pipeline (cyclomatic 23) core_memory/retrieval/causal_recall.py:521— causal_recall.attach_causal_recall_pipeline 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.
roadmap_planner._fallback (cyclomatic 23) core_memory/retrieval/roadmap_planner.py:511— roadmap_planner._fallback has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
memory_reason._chain_coherence (cyclomatic 23) core_memory/retrieval/tools/memory_reason.py:121— memory_reason._chain_coherence has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
projection.compute_future_projections (cyclomatic 23) core_memory/runtime/dreamer/projection.py:159— projection.compute_future_projections has cyclomatic complexity 23 (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.
external_evidence._bead_payload (cyclomatic 23) core_memory/runtime/ingest/external_evidence.py:417— external_evidence._bead_payload has cyclomatic complexity 23 (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.
retrieval_eval._causal_grounding_components (cyclomatic 23) eval/retrieval_eval.py:22— retrieval_eval._causal_grounding_components 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.
answer_policy.explain_answer_outcome (cyclomatic 22) core_memory/claim/answer_policy.py:77— answer_policy.explain_answer_outcome has cyclomatic complexity 22 (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.
migrate.handle_migrate (cyclomatic 22) core_memory/cli/handlers/migrate.py:68— migrate.handle_migrate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
retrieval.expand_query_with_entities (cyclomatic 22) core_memory/entity/retrieval.py:63— retrieval.expand_query_with_entities 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.
api.list_turn_summaries (cyclomatic 22) core_memory/integrations/api.py:601— api.list_turn_summaries has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
connector._build_default_branch_doc_push (cyclomatic 22) core_memory/integrations/github/connector.py:170— connector._build_default_branch_doc_push has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
semantic_tasks._result_from_payload (cyclomatic 22) REDACTED:137— semantic_tasks._result_from_payload has cyclomatic complexity 22 (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.
store_compaction_ops.uncompact_for_store (cyclomatic 22) core_memory/persistence/store_compaction_ops.py:86— store_compaction_ops.uncompact_for_store 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.
agent._claim_slots_for_result (cyclomatic 22) core_memory/retrieval/agent.py:205— agent._claim_slots_for_result 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.
snap.snap_form (cyclomatic 22) core_memory/retrieval/pipeline/snap.py:43— snap.snap_form has cyclomatic complexity 22 (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.
external_evidence._run_semantic_enrichment (cyclomatic 22) core_memory/runtime/ingest/external_evidence.py:591— external_evidence._run_semantic_enrichment has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
semantic_state.semantic_write_health (cyclomatic 22) core_memory/runtime/turn/semantic_state.py:201— semantic_state.semantic_write_health has cyclomatic complexity 22 (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.
assembly_depth._raw_factors (cyclomatic 22) core_memory/soul/assembly_depth.py:76— assembly_depth._raw_factors has cyclomatic complexity 22 (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.
transcript_ingest._group_envelopes (cyclomatic 22) core_memory/transcript_ingest.py:104— transcript_ingest._group_envelopes 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.
check_architecture_guards.check_deterministic_semantic_writers (cyclomatic 22) scripts/check_architecture_guards.py:806— check_architecture_guards.check_deterministic_semantic_writers 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.
typed_read.query_current_state (cyclomatic 21) core_memory/integrations/mcp/typed_read.py:168— typed_read.query_current_state has cyclomatic complexity 21 (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.
typed_read.query_contradictions (cyclomatic 21) core_memory/integrations/mcp/typed_read.py:288— typed_read.query_contradictions has cyclomatic complexity 21 (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.
chunk_turns.list_chunk_turns (cyclomatic 21) core_memory/runtime/ingest/chunk_turns.py:263— chunk_turns.list_chunk_turns 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.
store.propose_soul_update (cyclomatic 21) core_memory/soul/store.py:201— store.propose_soul_update has cyclomatic complexity 21 (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.
quarantine.write_quarantine (cyclomatic 20) core_memory/association/quarantine.py:37— quarantine.write_quarantine has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
junctions.resolve_junction_matches (cyclomatic 20) core_memory/graph/junctions.py:437— junctions.resolve_junction_matches has cyclomatic complexity 20 (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.
root_cause.root_cause_trace (cyclomatic 20) core_memory/graph/root_cause.py:1277— root_cause.root_cause_trace 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.
myelination_rewards.reward_claim_conflict_resolution (cyclomatic 20) core_memory/persistence/myelination_rewards.py:527— myelination_rewards.reward_claim_conflict_resolution 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_reporting.metrics_report_for_store (cyclomatic 20) core_memory/persistence/store_reporting.py:22— store_reporting.metrics_report_for_store 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.
pipehouse_adapter.retrieve (cyclomatic 20) REDACTED:30— pipehouse_adapter.retrieve has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
canonical._locomo_dia_ids_from_bead (cyclomatic 20) core_memory/retrieval/pipeline/canonical.py:558— canonical._locomo_dia_ids_from_bead 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.
rerank.rerank_candidates (cyclomatic 20) core_memory/retrieval/rerank.py:221— rerank.rerank_candidates 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.
analysis._load_seen_state (cyclomatic 20) core_memory/runtime/dreamer/analysis.py:36— analysis._load_seen_state 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.
candidates.submit_entity_merge_candidate (cyclomatic 20) core_memory/runtime/dreamer/candidates.py:1112— candidates.submit_entity_merge_candidate has cyclomatic complexity 20 (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.
convergence.detect_worldline_convergence (cyclomatic 20) core_memory/runtime/dreamer/convergence.py:46— convergence.detect_worldline_convergence 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.
external_evidence.ingest_external_evidence (cyclomatic 20) core_memory/runtime/ingest/external_evidence.py:684— external_evidence.ingest_external_evidence 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.
jobs.enqueue_async_job (cyclomatic 20) core_memory/runtime/queue/jobs.py:192— jobs.enqueue_async_job 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.
injection.soul_injection (cyclomatic 20) core_memory/soul/injection.py:30— injection.soul_injection 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.
tension_signals.detect_goal_conflicts (cyclomatic 20) core_memory/soul/tension_signals.py:43— tension_signals.detect_goal_conflicts 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.
audit_store_delegation.main (cyclomatic 20) scripts/audit_store_delegation.py:74— audit_store_delegation.main 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.
update_policy._normalize_explicit_updates (cyclomatic 19) core_memory/claim/update_policy.py:75— update_policy._normalize_explicit_updates has cyclomatic complexity 19 (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.
junctions._worldline_identities (cyclomatic 19) core_memory/graph/junctions.py:277— junctions._worldline_identities 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.
worldlines._entity_worldlines (cyclomatic 19) core_memory/graph/worldlines.py:111— worldlines._entity_worldlines 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.
server.memory_association_candidate_decide (cyclomatic 19) core_memory/integrations/http/server.py:2000— server.memory_association_candidate_decide has cyclomatic complexity 19 (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.
CoreMemoryRetriever._get_relevant_documents (cyclomatic 19) core_memory/integrations/langchain/retriever.py:67— CoreMemoryRetriever._get_relevant_documents 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.
transcript_snapshot_state.reserve_transcript_snapshot (cyclomatic 19) core_memory/integrations/mcp/tools/transcript_snapshot_state.py:92— transcript_snapshot_state.reserve_transcript_snapshot has cyclomatic complexity 19 (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.
mapper.bead_to_node (cyclomatic 19) REDACTED:23— mapper.bead_to_node has cyclomatic complexity 19 (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.
entity_merge_flow.decide_entity_merge_proposal_for_index (cyclomatic 19) REDACTED:204— entity_merge_flow.decide_entity_merge_proposal_for_index has cyclomatic complexity 19 (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.
store_metrics_runtime.append_metric_for_store (cyclomatic 19) core_memory/persistence/store_metrics_runtime.py:81— store_metrics_runtime.append_metric_for_store has cyclomatic complexity 19 (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.
causal_recall.execute_state_packet (cyclomatic 19) core_memory/retrieval/causal_recall.py:387— causal_recall.execute_state_packet has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
coverage._candidate_association_payload (cyclomatic 19) core_memory/runtime/associations/coverage.py:1808— coverage._candidate_association_payload has cyclomatic complexity 19 (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.
candidates._entity_similarity (cyclomatic 19) core_memory/runtime/dreamer/candidates.py:60— candidates._entity_similarity has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
session_enrichment_delta.delta_to_crawler_updates (cyclomatic 19) core_memory/runtime/session/session_enrichment_delta.py:740— session_enrichment_delta.delta_to_crawler_updates 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.
storyline_overlay.validate_storyline_overlay (cyclomatic 19) core_memory/schema/storyline_overlay.py:40— storyline_overlay.validate_storyline_overlay has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
crawler_contract._maybe_upgrade_context_to_reflection (cyclomatic 18) core_memory/association/crawler_contract.py:697— crawler_contract._maybe_upgrade_context_to_reflection 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.
resolver.resolve_all_current_state (cyclomatic 18) core_memory/claim/resolver.py:17— resolver.resolve_all_current_state 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.
retrieval.infer_query_entity_context (cyclomatic 18) core_memory/entity/retrieval.py:17— retrieval.infer_query_entity_context 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.
edge_weights.normalize_backend_chain (cyclomatic 18) core_memory/graph/edge_weights.py:149— edge_weights.normalize_backend_chain 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.
roadmap.sample_junction_identities (cyclomatic 18) core_memory/graph/roadmap.py:104— roadmap.sample_junction_identities has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
root_cause._path_record (cyclomatic 18) core_memory/graph/root_cause.py:480— root_cause._path_record has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
server.turn_finalized (cyclomatic 18) core_memory/integrations/http/server.py:801— server.turn_finalized has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
server.memory_association_runs (cyclomatic 18) core_memory/integrations/http/server.py:2034— server.memory_association_runs has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
capture.capture_handler (cyclomatic 18) core_memory/integrations/mcp/tools/capture.py:35— capture.capture_handler has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dreamer_candidate_store.make_candidate_row (cyclomatic 18) core_memory/persistence/dreamer_candidate_store.py:102— dreamer_candidate_store.make_candidate_row has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
semantic_task_verifier._deterministic_checks (cyclomatic 18) core_memory/policy/semantic_task_verifier.py:84— semantic_task_verifier._deterministic_checks 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.
provider_config.resolve_embedding_config (cyclomatic 18) core_memory/provider_config.py:169— provider_config.resolve_embedding_config 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.
rerank._chain_features (cyclomatic 18) core_memory/retrieval/rerank.py:177— rerank._chain_features 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.
coverage.on_bead_committed (cyclomatic 18) core_memory/runtime/associations/coverage.py:2410— coverage.on_bead_committed 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.
progress._process_goal_progress_pair_page (cyclomatic 18) core_memory/runtime/goals/progress.py:743— progress._process_goal_progress_pair_page has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
seed_backfill.run_seed_quality_backfill (cyclomatic 18) core_memory/runtime/hygiene/seed_backfill.py:96— seed_backfill.run_seed_quality_backfill 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.
reviewer_quick_value._find_bead_id_by_turn_and_title (cyclomatic 18) core_memory/runtime/observability/reviewer_quick_value.py:28— reviewer_quick_value._find_bead_id_by_turn_and_title 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.
jobs.run_async_jobs (cyclomatic 18) core_memory/runtime/queue/jobs.py:287— jobs.run_async_jobs 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.
semantic_state.latest_finalized_turn (cyclomatic 18) core_memory/runtime/turn/semantic_state.py:250— semantic_state.latest_finalized_turn has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
turn_quality.emit_agent_turn_quality_metric (cyclomatic 18) core_memory/runtime/turn/turn_quality.py:34— turn_quality.emit_agent_turn_quality_metric has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
promotion.compute_promotion_score (cyclomatic 18) core_memory/schema/promotion.py:129— promotion.compute_promotion_score 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.
dreamer_bridge._normalize_drafts (cyclomatic 18) core_memory/soul/dreamer_bridge.py:380— dreamer_bridge._normalize_drafts 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.
store._current_entries (cyclomatic 18) core_memory/soul/store.py:101— store._current_entries has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
retrieval_planner._active_slot_hints (cyclomatic 17) core_memory/claim/retrieval_planner.py:43— retrieval_planner._active_slot_hints 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.
root_cause.normalize_causal_hints (cyclomatic 17) core_memory/graph/root_cause.py:98— root_cause.normalize_causal_hints has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
root_cause.segment_between (cyclomatic 17) core_memory/graph/root_cause.py:1104— root_cause.segment_between 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.
Neo4jClient._prune_scope (cyclomatic 17) core_memory/integrations/neo4j/client.py:305— Neo4jClient._prune_scope has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
memory_tools.continuity_prompt (cyclomatic 17) core_memory/integrations/pydanticai/memory_tools.py:102— memory_tools.continuity_prompt has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
entity_merge_flow.suggest_entity_merge_proposals_for_index (cyclomatic 17) REDACTED:60— entity_merge_flow.suggest_entity_merge_proposals_for_index 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.
myelination_rewards.reward_dreamer_candidate_decision (cyclomatic 17) core_memory/persistence/myelination_rewards.py:427— myelination_rewards.reward_dreamer_candidate_decision has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
promotion_service.evaluate_candidates_for_store (cyclomatic 17) core_memory/persistence/promotion_service.py:77— promotion_service.evaluate_candidates_for_store has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
promotion_service.apply_agent_promotion_reviews_for_store (cyclomatic 17) core_memory/persistence/promotion_service.py:394— promotion_service.apply_agent_promotion_reviews_for_store has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
promotion_service.decide_session_promotion_states_for_store (cyclomatic 17) core_memory/persistence/promotion_service.py:454— promotion_service.decide_session_promotion_states_for_store 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.
semantic_task_receipts._compact_run (cyclomatic 17) core_memory/persistence/semantic_task_receipts.py:161— semantic_task_receipts._compact_run has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
store_failure_ops.find_failure_signature_matches_for_store (cyclomatic 17) core_memory/persistence/store_failure_ops.py:16— store_failure_ops.find_failure_signature_matches_for_store 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.
store_management_ops._split_source_selector (cyclomatic 17) core_memory/persistence/store_management_ops.py:75— store_management_ops._split_source_selector 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.
store_query.query_for_store (cyclomatic 17) core_memory/persistence/store_query.py:8— store_query.query_for_store 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.
store_validation_helpers.normalize_links (cyclomatic 17) core_memory/persistence/store_validation_helpers.py:6— store_validation_helpers.normalize_links 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.
ProviderSemanticTaskRuntime.run (cyclomatic 17) core_memory/policy/semantic_task_runtime.py:254— ProviderSemanticTaskRuntime.run has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
turn_memory_authoring._value_at_path (cyclomatic 17) core_memory/policy/turn_memory_authoring.py:215— turn_memory_authoring._value_at_path has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pipeline._append_structural_chains (cyclomatic 17) core_memory/retrieval/pipeline/__init__.py:80— pipeline._append_structural_chains 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.
query_norm.resolve_query_anchors (cyclomatic 17) core_memory/retrieval/query_norm.py:106— query_norm.resolve_query_anchors 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.
memory_reason._select_diverse_chains (cyclomatic 17) core_memory/retrieval/tools/memory_reason.py:209— memory_reason._select_diverse_chains 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.
memory_reason._plan_changed (cyclomatic 17) core_memory/retrieval/tools/memory_reason.py:676— memory_reason._plan_changed 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.
longitudinal.longitudinal_benchmark_v2 (cyclomatic 17) core_memory/runtime/dreamer/longitudinal.py:178— longitudinal.longitudinal_benchmark_v2 has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
flush_state.upsert_process_flush_checkpoint_bead (cyclomatic 17) core_memory/runtime/flush/flush_state.py:34— flush_state.upsert_process_flush_checkpoint_bead has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
progress.process_goal_progress_event (cyclomatic 17) core_memory/runtime/goals/progress.py:804— progress.process_goal_progress_event has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
source_envelope.normalize_source_ingest_envelope (cyclomatic 17) core_memory/runtime/ingest/source_envelope.py:111— source_envelope.normalize_source_ingest_envelope has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
side_effect_queue.side_effect_queue_status (cyclomatic 17) core_memory/runtime/queue/side_effect_queue.py:67— side_effect_queue.side_effect_queue_status 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.
TurnEnvelope.finalize_hashes (cyclomatic 17) core_memory/runtime/state.py:79— TurnEnvelope.finalize_hashes has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
promotion._normalize_links (cyclomatic 17) core_memory/schema/promotion.py:53— promotion._normalize_links 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.
dreamer_bridge._maybe_auto_endorse_goal (cyclomatic 17) core_memory/soul/dreamer_bridge.py:277— dreamer_bridge._maybe_auto_endorse_goal has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
store.apply_soul_update (cyclomatic 17) core_memory/soul/store.py:306— store.apply_soul_update has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
transcript_ingest._associations_created_summary (cyclomatic 17) core_memory/transcript_ingest.py:429— transcript_ingest._associations_created_summary has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
transcript_ingest.ingest_transcript (cyclomatic 17) core_memory/transcript_ingest.py:545— transcript_ingest.ingest_transcript has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
rolling_window._select_beads_for_budget (cyclomatic 17) core_memory/write_pipeline/rolling_window.py:188— rolling_window._select_beads_for_budget 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.
paraphrase_eval._anchor_hit (cyclomatic 17) eval/paraphrase_eval.py:36— paraphrase_eval._anchor_hit has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
preview.compute_preview_association_candidates (cyclomatic 16) core_memory/association/preview.py:138— preview.compute_preview_association_candidates 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.
extraction.extract_claims (cyclomatic 16) core_memory/claim/extraction.py:248— extraction.extract_claims 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.
semantic.handle_semantic_command (cyclomatic 16) core_memory/cli/handlers/semantic.py:46— semantic.handle_semantic_command 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.
core._normalize_links (cyclomatic 16) REDACTED:141— core._normalize_links 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.
root_cause._upstream_edges (cyclomatic 16) core_memory/graph/root_cause.py:305— root_cause._upstream_edges 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.
root_cause._edge_cost (cyclomatic 16) core_memory/graph/root_cause.py:389— root_cause._edge_cost 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.
root_cause._rank_influence (cyclomatic 16) core_memory/graph/root_cause.py:741— root_cause._rank_influence 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.
ingest_discord._parse_message (cyclomatic 16) core_memory/integrations/mcp/tools/ingest_discord.py:25— ingest_discord._parse_message 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.
status.status_handler (cyclomatic 16) core_memory/integrations/mcp/tools/status.py:40— status.status_handler 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.
mapper.association_to_edge (cyclomatic 16) REDACTED:69— mapper.association_to_edge 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.
entity_merge_flow._entity_similarity (cyclomatic 16) REDACTED:24— entity_merge_flow._entity_similarity 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.
semantic_task_receipts.summarize_semantic_task_runs (cyclomatic 16) core_memory/persistence/semantic_task_receipts.py:204— semantic_task_receipts.summarize_semantic_task_runs 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.
store_projection_ops.rebuild_index_projection_from_sessions_for_store (cyclomatic 16) core_memory/persistence/store_projection_ops.py:11— store_projection_ops.rebuild_index_projection_from_sessions_for_store has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
causal_recall._fallback_execute_decision (cyclomatic 16) core_memory/retrieval/causal_recall.py:322— causal_recall._fallback_execute_decision 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.
causal_recall.causal_edge_pressure (cyclomatic 16) core_memory/retrieval/causal_recall.py:477— causal_recall.causal_edge_pressure 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.
roadmap_planner._goal_advancing_terminals (cyclomatic 16) core_memory/retrieval/roadmap_planner.py:110— roadmap_planner._goal_advancing_terminals 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.
roadmap_planner._states_for_alternative (cyclomatic 16) core_memory/retrieval/roadmap_planner.py:306— roadmap_planner._states_for_alternative 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.
roadmap_planner._shortest_stitched_path (cyclomatic 16) core_memory/retrieval/roadmap_planner.py:441— roadmap_planner._shortest_stitched_path 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.
memory_reason._collect_citations_from_chains (cyclomatic 16) core_memory/retrieval/tools/memory_reason.py:342— memory_reason._collect_citations_from_chains 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.
memory_reason._retrieve_ranked (cyclomatic 16) core_memory/retrieval/tools/memory_reason.py:476— memory_reason._retrieve_ranked 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.
visible_corpus.build_visible_corpus (cyclomatic 16) core_memory/retrieval/visible_corpus.py:64— visible_corpus.build_visible_corpus 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.
coverage.association_judge_readiness (cyclomatic 16) core_memory/runtime/associations/coverage.py:1525— coverage.association_judge_readiness 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.
analysis.score_association (cyclomatic 16) core_memory/runtime/dreamer/analysis.py:297— analysis.score_association 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.
goal_decay.detect_goal_decay (cyclomatic 16) core_memory/runtime/dreamer/goal_decay.py:72— goal_decay.detect_goal_decay 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.
source_envelope._infer_boundary_type (cyclomatic 16) core_memory/runtime/ingest/source_envelope.py:65— source_envelope._infer_boundary_type 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.
source_events.ingest_source_event (cyclomatic 16) core_memory/runtime/ingest/source_events.py:79— source_events.ingest_source_event 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.
session_enrichment_delta.write_delta_quarantine (cyclomatic 16) core_memory/runtime/session/session_enrichment_delta.py:333— session_enrichment_delta.write_delta_quarantine 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.
session_start_flow.process_session_start_impl (cyclomatic 16) core_memory/runtime/session/session_start_flow.py:114— session_start_flow.process_session_start_impl 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.
ingress._normalize_mesh_trace (cyclomatic 16) core_memory/runtime/turn/ingress.py:53— ingress._normalize_mesh_trace 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.
receipt._queue_receipt (cyclomatic 16) core_memory/runtime/turn/receipt.py:76— receipt._queue_receipt 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.
promotion.get_recommendation_rows (cyclomatic 16) core_memory/schema/promotion.py:218— promotion.get_recommendation_rows 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.
dreamer_bridge.dreamer_soul_review (cyclomatic 16) core_memory/soul/dreamer_bridge.py:768— dreamer_bridge.dreamer_soul_review 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.
check_architecture_guards.check_cleanup_truth (cyclomatic 16) scripts/check_architecture_guards.py:580— check_architecture_guards.check_cleanup_truth 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.
candidates.decide_dreamer_candidate (cognitive 359) core_memory/runtime/dreamer/candidates.py:334— candidates.decide_dreamer_candidate has cognitive complexity 359 (threshold 15). Drivers by points: if/else 49 (139 pts), boolean chains 127, ternaries 19 (64 pts), error handling 5 (17 pts), loops 4 (12 pts) (nesting depth added 155). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
management.maintain (cognitive 186) core_memory/management/__init__.py:829— management.maintain has cognitive complexity 186 (threshold 15). Drivers by points: boolean chains 118, if/else 56 (68 pts) (nesting depth added 12). 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.
canonical.search_request (cognitive 180) core_memory/retrieval/pipeline/canonical.py:891— canonical.search_request has cognitive complexity 180 (threshold 15). Drivers by points: boolean chains 92, if/else 34 (58 pts), ternaries 11 (14 pts), loops 8 (13 pts), error handling 3 (nesting depth added 32). 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.
canonical.trace_request (cognitive 162) core_memory/retrieval/pipeline/canonical.py:1180— canonical.trace_request has cognitive complexity 162 (threshold 15). Drivers by points: if/else 34 (62 pts), boolean chains 61, ternaries 15 (16 pts), loops 6 (14 pts), error handling 5 (9 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
crawler_contract.apply_crawler_updates (cognitive 159) core_memory/association/crawler_contract.py:767— crawler_contract.apply_crawler_updates has cognitive complexity 159 (threshold 15). Drivers by points: if/else 36 (79 pts), boolean chains 63, loops 7 (9 pts), ternaries 2 (5 pts), error handling 1 (3 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
side_effect_queue.process_side_effect_event (cognitive 155) core_memory/runtime/queue/side_effect_queue.py:117— side_effect_queue.process_side_effect_event has cognitive complexity 155 (threshold 15). Drivers by points: if/else 32 (56 pts), boolean chains 48, error handling 15 (31 pts), ternaries 9 (18 pts), loops 1 (2 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
crawler_contract.merge_crawler_updates (cognitive 151) core_memory/association/crawler_contract.py:435— crawler_contract.merge_crawler_updates has cognitive complexity 151 (threshold 15). Drivers by points: if/else 29 (83 pts), boolean chains 51, error handling 2 (7 pts), ternaries 2 (6 pts), loops 4 (nesting depth added 63). 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.
store_validation_helpers.required_field_issues_for_store (cognitive 148) core_memory/persistence/store_validation_helpers.py:42— store_validation_helpers.required_field_issues_for_store has cognitive complexity 148 (threshold 15). Drivers by points: if/else 48 (86 pts), boolean chains 60, loops 1 (2 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_reason.memory_reason (cognitive 148) core_memory/retrieval/tools/memory_reason.py:762— memory_reason.memory_reason has cognitive complexity 148 (threshold 15). Drivers by points: boolean chains 67, if/else 27 (51 pts), ternaries 10 (19 pts), loops 4 (8 pts), error handling 1 (3 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
turn_flow.process_turn_finalized_impl (cognitive 141) core_memory/runtime/turn/turn_flow.py:29— turn_flow.process_turn_finalized_impl has cognitive complexity 141 (threshold 15). Drivers by points: if/else 35 (68 pts), boolean chains 58, error handling 3 (7 pts), ternaries 2 (5 pts), loops 1 (3 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
semantic_index.semantic_lookup (cognitive 129) REDACTED:1546— semantic_index.semantic_lookup has cognitive complexity 129 (threshold 15). Drivers by points: if/else 35 (65 pts), boolean chains 48, error handling 3 (6 pts), ternaries 2 (6 pts), loops 2 (4 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
canonical.execute_request (cognitive 126) core_memory/retrieval/pipeline/canonical.py:1444— canonical.execute_request has cognitive complexity 126 (threshold 15). Drivers by points: boolean chains 85, if/else 19 (33 pts), ternaries 3 (6 pts), error handling 1 (2 pts) (nesting depth added 18). 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.
management._validate_action (cognitive 122) core_memory/management/__init__.py:396— management._validate_action has cognitive complexity 122 (threshold 15). Drivers by points: if/else 41 (78 pts), boolean chains 44 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent_authored_contract.validate_agent_authored_updates (cognitive 115) core_memory/runtime/passes/agent_authored_contract.py:93— agent_authored_contract.validate_agent_authored_updates has cognitive complexity 115 (threshold 15). Drivers by points: if/else 35 (78 pts), boolean chains 17, ternaries 6 (16 pts), loops 3 (4 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
candidates.enqueue_dreamer_candidates (cognitive 109) core_memory/runtime/dreamer/candidates.py:93— candidates.enqueue_dreamer_candidates has cognitive complexity 109 (threshold 15). Drivers by points: boolean chains 52, if/else 17 (41 pts), ternaries 5 (9 pts), loops 3 (6 pts), error handling 1 (nesting depth added 31). 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.
enrichment.run_turn_enrichment (cognitive 109) core_memory/runtime/passes/enrichment.py:115— enrichment.run_turn_enrichment has cognitive complexity 109 (threshold 15). Drivers by points: boolean chains 57, if/else 19 (31 pts), error handling 12 (17 pts), ternaries 2 (4 pts) (nesting depth added 19). 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.
search.search_typed (cognitive 107) core_memory/retrieval/pipeline/search.py:36— search.search_typed has cognitive complexity 107 (threshold 15). Drivers by points: boolean chains 57, if/else 24 (44 pts), loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 22). 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.
flush_flow.process_flush_impl (cognitive 106) core_memory/runtime/flush/flush_flow.py:29— flush_flow.process_flush_impl has cognitive complexity 106 (threshold 15). Drivers by points: boolean chains 84, if/else 8 (12 pts), error handling 4 (6 pts), ternaries 4 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
coverage._apply_judge_result (cognitive 101) core_memory/runtime/associations/coverage.py:1862— coverage._apply_judge_result has cognitive complexity 101 (threshold 15). Drivers by points: if/else 29 (59 pts), boolean chains 32, loops 5 (10 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
session_enrichment_delta.crawler_updates_to_delta (cognitive 101) core_memory/runtime/session/session_enrichment_delta.py:422— session_enrichment_delta.crawler_updates_to_delta has cognitive complexity 101 (threshold 15). Drivers by points: boolean chains 46, if/else 20 (37 pts), loops 10 (12 pts), ternaries 4 (6 pts) (nesting depth added 21). 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.
canonical._claim_anchors_from_state (cognitive 93) core_memory/retrieval/pipeline/canonical.py:184— canonical._claim_anchors_from_state has cognitive complexity 93 (threshold 15). Drivers by points: if/else 18 (50 pts), boolean chains 28, loops 4 (9 pts), ternaries 2 (6 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
summary._build_light_cone (cognitive 93) core_memory/soul/summary.py:603— summary._build_light_cone has cognitive complexity 93 (threshold 15). Drivers by points: boolean chains 42, if/else 19 (32 pts), loops 8 (9 pts), ternaries 5 (7 pts), error handling 3 (nesting depth added 16). 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.
dreamer_bridge.propose_soul_from_dreamer (cognitive 90) core_memory/soul/dreamer_bridge.py:536— dreamer_bridge.propose_soul_from_dreamer has cognitive complexity 90 (threshold 15). Drivers by points: boolean chains 39, if/else 17 (35 pts), ternaries 10 (14 pts), loops 2 (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.
core.backfill_causal_links (cognitive 88) REDACTED:257— core.backfill_causal_links has cognitive complexity 88 (threshold 15). Drivers by points: if/else 13 (38 pts), boolean chains 31, loops 9 (15 pts), ternaries 1 (4 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hybrid.hybrid_lookup (cognitive 88) core_memory/retrieval/hybrid.py:101— hybrid.hybrid_lookup has cognitive complexity 88 (threshold 15). Drivers by points: boolean chains 39, if/else 16 (33 pts), loops 6 (9 pts), ternaries 3 (5 pts), error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
roadmap.roadmap_watershed_attribution (cognitive 84) core_memory/graph/roadmap.py:486— roadmap.roadmap_watershed_attribution has cognitive complexity 84 (threshold 15). Drivers by points: if/else 20 (45 pts), boolean chains 23, loops 9 (13 pts), ternaries 2 (3 pts) (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.
transcript_ingest.normalize_transcript_payload (cognitive 83) core_memory/transcript_ingest.py:192— transcript_ingest.normalize_transcript_payload has cognitive complexity 83 (threshold 15). Drivers by points: boolean chains 39, if/else 15 (24 pts), ternaries 5 (11 pts), loops 5 (9 pts) (nesting depth added 19). 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.
canonical._apply_typed_filters (cognitive 82) core_memory/retrieval/pipeline/canonical.py:699— canonical._apply_typed_filters has cognitive complexity 82 (threshold 15). Drivers by points: if/else 21 (43 pts), boolean chains 38, loops 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.
sync_transcript_snapshot.sync_transcript_snapshot_handler (cognitive 80) core_memory/integrations/mcp/tools/sync_transcript_snapshot.py:217— sync_transcript_snapshot.sync_transcript_snapshot_handler has cognitive complexity 80 (threshold 15). Drivers by points: boolean chains 39, if/else 26 (36 pts), error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 12). 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.
agent._expand_via_association_hops (cognitive 80) core_memory/retrieval/agent.py:599— agent._expand_via_association_hops has cognitive complexity 80 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 18, loops 10 (18 pts), ternaries 3 (5 pts), error handling 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_reason._plan_why (cognitive 80) core_memory/retrieval/tools/memory_reason.py:525— memory_reason._plan_why has cognitive complexity 80 (threshold 15). Drivers by points: boolean chains 41, if/else 20 (30 pts), loops 3 (4 pts), ternaries 3, error handling 1 (2 pts) (nesting depth added 12). 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.
session_enrichment_delta.canonical_session_projection (cognitive 79) core_memory/runtime/session/session_enrichment_delta.py:802— session_enrichment_delta.canonical_session_projection has cognitive complexity 79 (threshold 15). Drivers by points: if/else 23 (52 pts), boolean chains 16, loops 7 (11 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
coverage.decide_association_candidate (cognitive 74) core_memory/runtime/associations/coverage.py:2925— coverage.decide_association_candidate has cognitive complexity 74 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 26, ternaries 8 (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.
summary._build_tensions (cognitive 74) core_memory/soul/summary.py:957— summary._build_tensions has cognitive complexity 74 (threshold 15). Drivers by points: boolean chains 41, if/else 9 (15 pts), loops 6 (7 pts), ternaries 4 (7 pts), error handling 4 (nesting depth added 10). 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.
traversal._build_adjacency (cognitive 72) core_memory/graph/traversal.py:37— traversal._build_adjacency has cognitive complexity 72 (threshold 15). Drivers by points: if/else 14 (42 pts), boolean chains 16, loops 6 (14 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
core.sync_structural_pipeline (cognitive 69) REDACTED:391— core.sync_structural_pipeline has cognitive complexity 69 (threshold 15). Drivers by points: boolean chains 31, if/else 15 (28 pts), loops 7 (10 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.
memory_reason._radius1_structural_fallback (cognitive 69) core_memory/retrieval/tools/memory_reason.py:371— memory_reason._radius1_structural_fallback has cognitive complexity 69 (threshold 15). Drivers by points: if/else 13 (36 pts), boolean chains 22, loops 7 (10 pts), ternaries 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
crawler_contract._normalize_creation_rows_with_diagnostics (cognitive 67) core_memory/association/crawler_contract.py:156— crawler_contract._normalize_creation_rows_with_diagnostics has cognitive complexity 67 (threshold 15). Drivers by points: if/else 24 (46 pts), boolean chains 13, loops 3 (4 pts), ternaries 3 (4 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.
root_cause._parameterized_best_first_search (cognitive 67) core_memory/graph/root_cause.py:554— root_cause._parameterized_best_first_search has cognitive complexity 67 (threshold 15). Drivers by points: if/else 20 (47 pts), boolean chains 12, loops 4 (6 pts), ternaries 1 (2 pts) (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.
semantic_index.build_semantic_index (cognitive 67) REDACTED:1104— semantic_index.build_semantic_index has cognitive complexity 67 (threshold 15). Drivers by points: boolean chains 20, if/else 13 (20 pts), ternaries 4 (12 pts), error handling 4 (9 pts), loops 2 (6 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.
ingest.ingest_handler (cognitive 66) core_memory/integrations/mcp/tools/ingest.py:196— ingest.ingest_handler has cognitive complexity 66 (threshold 15). Drivers by points: boolean chains 26, if/else 13 (21 pts), ternaries 9 (13 pts), error handling 3 (5 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
contracts.recall_result_from_memory_execute (cognitive 66) core_memory/retrieval/contracts.py:306— contracts.recall_result_from_memory_execute has cognitive complexity 66 (threshold 15). Drivers by points: boolean chains 22, ternaries 16 (21 pts), if/else 18 (20 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
events.rebuild_index (cognitive 65) core_memory/persistence/events.py:163— events.rebuild_index has cognitive complexity 65 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 12, loops 6 (9 pts), error handling 2 (6 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reauthoring._cohort_metrics (cognitive 65) core_memory/runtime/turn/reauthoring.py:209— reauthoring._cohort_metrics has cognitive complexity 65 (threshold 15). Drivers by points: if/else 23 (39 pts), boolean chains 22, loops 3 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.process_turn_finalized (cognitive 63) core_memory/runtime/engine.py:576— engine.process_turn_finalized has cognitive complexity 63 (threshold 15). Drivers by points: if/else 10 (31 pts), ternaries 6 (13 pts), boolean chains 9, error handling 3 (8 pts), loops 1 (2 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent.recall (cognitive 62) core_memory/retrieval/agent.py:817— agent.recall has cognitive complexity 62 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 15, error handling 9 (13 pts), ternaries 7 (10 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
coverage.run_association_coverage (cognitive 62) core_memory/runtime/associations/coverage.py:2483— coverage.run_association_coverage has cognitive complexity 62 (threshold 15). Drivers by points: boolean chains 34, if/else 18 (20 pts), loops 4, error handling 2, ternaries 2 (nesting depth added 2). 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.
crawler_contract._normalize_review_rows (cognitive 61) core_memory/association/crawler_contract.py:35— crawler_contract._normalize_review_rows has cognitive complexity 61 (threshold 15). Drivers by points: boolean chains 37, if/else 9 (16 pts), loops 6 (8 pts) (nesting depth added 9). 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.
semantic_index.apply_semantic_delta (cognitive 61) REDACTED:1348— semantic_index.apply_semantic_delta has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 21, loops 4 (6 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
health.association_pending_judge_health (cognitive 60) core_memory/association/health.py:29— health.association_pending_judge_health has cognitive complexity 60 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 19, ternaries 6 (9 pts), error handling 2 (5 pts), loops 2 (3 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.
core.causal_traverse (cognitive 60) REDACTED:816— core.causal_traverse has cognitive complexity 60 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 17, loops 5 (10 pts), error handling 2 (4 pts), ternaries 2 (4 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.
api.inspect_state (cognitive 60) core_memory/integrations/api.py:349— api.inspect_state has cognitive complexity 60 (threshold 15). Drivers by points: boolean chains 47, if/else 3 (5 pts), loops 4, error handling 3, ternaries 1 (nesting depth added 2). 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.
myelination.compute_myelination_bonus_map (cognitive 60) core_memory/runtime/observability/myelination.py:57— myelination.compute_myelination_bonus_map has cognitive complexity 60 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 14, loops 6 (11 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
models._normalize_bead_payload (cognitive 59) core_memory/schema/models.py:310— models._normalize_bead_payload has cognitive complexity 59 (threshold 15). Drivers by points: if/else 22 (28 pts), ternaries 9 (16 pts), boolean chains 12, 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.
Neo4jClient.upsert_projection (cognitive 58) core_memory/integrations/neo4j/client.py:121— Neo4jClient.upsert_projection has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 32, if/else 11 (20 pts), error handling 4, loops 2 (nesting depth added 9). 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.
agent._collect_extra_seeds (cognitive 58) core_memory/retrieval/agent.py:473— agent._collect_extra_seeds has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 22, if/else 7 (16 pts), ternaries 3 (8 pts), loops 4 (7 pts), error handling 4 (5 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
core.build_graph (cognitive 56) REDACTED:673— core.build_graph has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 18, loops 6 (8 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.
coverage._normalized_candidate_rows (cognitive 56) core_memory/runtime/associations/coverage.py:490— coverage._normalized_candidate_rows has cognitive complexity 56 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 20, loops 4 (5 pts), ternaries 2 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
side_effect_queue.drain_side_effect_queue (cognitive 55) core_memory/runtime/queue/side_effect_queue.py:582— side_effect_queue.drain_side_effect_queue has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 22, loops 3 (4 pts), ternaries 2 (3 pts), error handling 1 (2 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.
agent_authored_updates._validate_json_value (cognitive 55) core_memory/schema/agent_authored_updates.py:506— agent_authored_updates._validate_json_value has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (38 pts), boolean chains 10, loops 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_retrieval_context.retrieve_with_context_for_store (cognitive 54) core_memory/persistence/store_retrieval_context.py:6— store_retrieval_context.retrieve_with_context_for_store has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 15, loops 4 (8 pts), ternaries 2 (4 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.
chunk_evidence.resolve_semantic_hits (cognitive 54) core_memory/retrieval/chunk_evidence.py:190— chunk_evidence.resolve_semantic_hits has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 13, ternaries 5 (10 pts), loops 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
semantic_index._provider_vectors (cognitive 54) REDACTED:768— semantic_index._provider_vectors has cognitive complexity 54 (threshold 15). Drivers by points: if/else 8 (24 pts), boolean chains 12, loops 4 (10 pts), error handling 2 (8 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
external_evidence._find_existing_external_bead (cognitive 54) core_memory/runtime/ingest/external_evidence.py:242— external_evidence._find_existing_external_bead has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (39 pts), boolean chains 11, loops 2 (3 pts), ternaries 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.
summary._build_divergence (cognitive 54) core_memory/soul/summary.py:829— summary._build_divergence has cognitive complexity 54 (threshold 15). Drivers by points: boolean chains 26, if/else 9 (23 pts), error handling 2, loops 2, ternaries 1 (nesting depth added 14). 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.
transcript_ingest._resolve_envelope_speakers (cognitive 54) core_memory/transcript_ingest.py:467— transcript_ingest._resolve_envelope_speakers has cognitive complexity 54 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 17, loops 7 (13 pts), error handling 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.
canonical._apply_hint_boosts (cognitive 53) core_memory/retrieval/pipeline/canonical.py:811— canonical._apply_hint_boosts has cognitive complexity 53 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 19, loops 4 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bead_projection.build_retrieval_text (cognitive 53) core_memory/schema/bead_projection.py:79— bead_projection.build_retrieval_text has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 16, loops 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
context_recall.retrieve_with_context (cognitive 52) core_memory/retrieval/context_recall.py:15— context_recall.retrieve_with_context has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 13, loops 4 (8 pts), ternaries 2 (4 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.
answer_signals.compute_answer_signals (cognitive 51) core_memory/claim/answer_signals.py:15— answer_signals.compute_answer_signals has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 22, loops 1 (2 pts), ternaries 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.
metrics.handle_metrics_command (cognitive 51) core_memory/cli/handlers/metrics.py:14— metrics.handle_metrics_command has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 12, ternaries 1 (3 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.
engine._resolve_reviewed_updates (cognitive 51) core_memory/runtime/engine.py:302— engine._resolve_reviewed_updates has cognitive complexity 51 (threshold 15). Drivers by points: boolean chains 23, if/else 12 (20 pts), ternaries 4 (8 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
coverage.apply_association_proposals (cognitive 50) core_memory/runtime/associations/coverage.py:3270— coverage.apply_association_proposals has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 18, ternaries 3 (6 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent._conflicts_for_result (cognitive 49) core_memory/retrieval/agent.py:241— agent._conflicts_for_result has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 13, loops 4 (6 pts), ternaries 3 (6 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.
catalog.build_catalog (cognitive 49) core_memory/retrieval/pipeline/catalog.py:14— catalog.build_catalog has cognitive complexity 49 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 10, loops 5 (9 pts), error handling 1 (2 pts) (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.
myelination_rewards.supporting_edge_keys_for_bead (cognitive 48) core_memory/persistence/myelination_rewards.py:164— myelination_rewards.supporting_edge_keys_for_bead has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (29 pts), boolean chains 11, loops 3 (6 pts), error handling 1 (2 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.
canonical._claim_answer_candidate (cognitive 48) core_memory/retrieval/pipeline/canonical.py:310— canonical._claim_answer_candidate has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 25, if/else 13 (19 pts), loops 1 (2 pts), ternaries 2 (nesting depth added 7). 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.
core.infer_structural_edges (cognitive 47) REDACTED:582— core.infer_structural_edges has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 14, loops 6 (10 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.
coverage._pair_signals (cognitive 47) core_memory/runtime/associations/coverage.py:1056— coverage._pair_signals has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 16, ternaries 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
storylines.derive_storylines (cognitive 46) core_memory/graph/storylines.py:66— storylines.derive_storylines has cognitive complexity 46 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 13, loops 5 (7 pts), ternaries 1 (4 pts), error handling 1 (3 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.
source_hydration.hydrate_bead_sources_for_root (cognitive 46) core_memory/persistence/source_hydration.py:19— source_hydration.hydrate_bead_sources_for_root has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 4 (9 pts), boolean chains 8, error handling 1 (3 pts), ternaries 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.
analysis.synthesize_themes (cognitive 46) core_memory/runtime/dreamer/analysis.py:545— analysis.synthesize_themes has cognitive complexity 46 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 6 (13 pts), boolean chains 11, ternaries 1 (3 pts), error handling 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.
calibration.compute_calibration_curve (cognitive 45) core_memory/persistence/calibration.py:182— calibration.compute_calibration_curve has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (21 pts), ternaries 7 (11 pts), boolean chains 9, loops 3 (4 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.
evidence_scoring.rerank_semantic_rows (cognitive 45) core_memory/retrieval/evidence_scoring.py:105— evidence_scoring.rerank_semantic_rows has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 17, ternaries 3 (6 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
coverage.enqueue_association_coverage (cognitive 45) core_memory/runtime/associations/coverage.py:2192— coverage.enqueue_association_coverage has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 30, if/else 11 (12 pts), ternaries 3 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
health.association_health_report (cognitive 44) core_memory/association/health.py:120— health.association_health_report has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 14, loops 2 (3 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph.handle_graph_command (cognitive 44) core_memory/cli/handlers/graph.py:20— graph.handle_graph_command has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 12, ternaries 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ingest_discord.ingest_discord_handler (cognitive 44) core_memory/integrations/mcp/tools/ingest_discord.py:79— ingest_discord.ingest_discord_handler has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 17, error handling 3 (5 pts), ternaries 2 (3 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.
semantic_index.load_cached_bead_embeddings (cognitive 44) REDACTED:945— semantic_index.load_cached_bead_embeddings has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 12, loops 4 (6 pts), error handling 2 (3 pts), ternaries 1 (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.
memory.handle_memory_command (cognitive 43) core_memory/cli/handlers/memory.py:8— memory.handle_memory_command has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 16 (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.
traversal.filter_chains_to_active_edges (cognitive 43) core_memory/graph/traversal.py:106— traversal.filter_chains_to_active_edges has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 15, loops 4 (6 pts), error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rerank._load_structural_adjacency (cognitive 43) core_memory/retrieval/rerank.py:113— rerank._load_structural_adjacency has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 9, error handling 3 (7 pts), loops 2 (4 pts), ternaries 1 (3 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.
check_architecture_guards.check_cleanup_truth (cognitive 43) scripts/check_architecture_guards.py:580— check_architecture_guards.check_cleanup_truth has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 5 (12 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
core.backfill_structural_edges (cognitive 42) REDACTED:488— core.backfill_structural_edges has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 18, loops 4 (5 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.
eval.dreamer_eval_report (cognitive 42) core_memory/runtime/dreamer/eval.py:261— eval.dreamer_eval_report has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 20, 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.
reviewer_quick_value.reviewer_quick_value_v2 (cognitive 42) core_memory/runtime/observability/reviewer_quick_value.py:61— reviewer_quick_value.reviewer_quick_value_v2 has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 33, if/else 6 (7 pts), loops 1, ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
reauthoring.reauthor_memory (cognitive 42) core_memory/runtime/turn/reauthoring.py:618— reauthoring.reauthor_memory has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 11, ternaries 4 (7 pts), error handling 2 (4 pts), 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.
memory_execute_eval.main (cognitive 42) eval/memory_execute_eval.py:44— memory_execute_eval.main has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 20, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
agent_end_bridge.process_agent_end_event (cognitive 41) core_memory/integrations/openclaw/agent_end_bridge.py:182— agent_end_bridge.process_agent_end_event has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 21, if/else 15 (16 pts), ternaries 4 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
semantic_task_verifier.verify_semantic_task_output (cognitive 41) core_memory/policy/semantic_task_verifier.py:182— semantic_task_verifier.verify_semantic_task_output has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 29, ternaries 6 (9 pts), if/else 3 (nesting depth added 3). 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.
chunk_evidence.build_chunk_evidence_corpus (cognitive 41) core_memory/retrieval/chunk_evidence.py:110— chunk_evidence.build_chunk_evidence_corpus has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 13, loops 4 (6 pts), ternaries 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_search_ab_compare.main (cognitive 41) eval/memory_search_ab_compare.py:30— memory_search_ab_compare.main has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 6 (19 pts), boolean chains 16, if/else 1 (3 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.
cli.main (cognitive 40) core_memory/cli/__init__.py:100— cli.main has cognitive complexity 40 (threshold 15). Drivers by points: if/else 27 (40 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.
ingest_zoom.ingest_zoom_handler (cognitive 40) core_memory/integrations/mcp/tools/ingest_zoom.py:129— ingest_zoom.ingest_zoom_handler has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 14, error handling 3 (6 pts), ternaries 2 (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.
promotion_service.promotion_kpis_for_store (cognitive 40) core_memory/persistence/promotion_service.py:528— promotion_service.promotion_kpis_for_store has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 21, if/else 8 (15 pts), loops 3, ternaries 1 (nesting depth added 7). 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.
store_add_bead_ops.add_bead_for_store (cognitive 40) core_memory/persistence/store_add_bead_ops.py:33— store_add_bead_ops.add_bead_for_store has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 14, error handling 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.
integrity.soul_integrity_check (cognitive 40) core_memory/soul/integrity.py:63— integrity.soul_integrity_check has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 15, if/else 7 (15 pts), ternaries 2 (7 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.
paraphrase_eval.main (cognitive 40) eval/paraphrase_eval.py:51— paraphrase_eval.main has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 15, if/else 5 (11 pts), loops 4 (7 pts), ternaries 4 (7 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.
store.handle_store_commands (cognitive 39) core_memory/cli/handlers/store.py:14— store.handle_store_commands has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26 (33 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
root_cause._build_edges (cognitive 39) core_memory/graph/root_cause.py:163— root_cause._build_edges has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 9, loops 6 (9 pts), error handling 2 (3 pts), ternaries 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
worldlines._goal_worldlines (cognitive 39) core_memory/graph/worldlines.py:161— worldlines._goal_worldlines has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 13, loops 4 (6 pts), ternaries 1 (2 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.
retrieval_feedback.record_retrieval_feedback (cognitive 39) core_memory/persistence/retrieval_feedback.py:76— retrieval_feedback.record_retrieval_feedback has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 35, if/else 3, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
retrieval_feedback.summarize_retrieval_feedback (cognitive 39) core_memory/persistence/retrieval_feedback.py:180— retrieval_feedback.summarize_retrieval_feedback has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 14, loops 5 (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.
store_relationship_ops.promote_for_store (cognitive 39) core_memory/persistence/store_relationship_ops.py:18— store_relationship_ops.promote_for_store has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 18 (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.
causal_recall.extract_source_citations (cognitive 39) core_memory/retrieval/causal_recall.py:146— causal_recall.extract_source_citations has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 9, loops 4 (7 pts), ternaries 3 (5 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.
refinement.refine_pending_candidates (cognitive 39) core_memory/runtime/dreamer/refinement.py:145— refinement.refine_pending_candidates has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 23, if/else 11 (13 pts), ternaries 2, loops 1 (nesting depth added 2). 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.
retrieval_eval._causal_grounding_components (cognitive 39) eval/retrieval_eval.py:22— retrieval_eval._causal_grounding_components has cognitive complexity 39 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 14, loops 2 (7 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audit_store_delegation.main (cognitive 39) scripts/audit_store_delegation.py:74— audit_store_delegation.main has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 4 (12 pts), loops 5 (9 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.
core._sync_associations_to_links (cognitive 38) REDACTED:188— core._sync_associations_to_links has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 15, 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.
entity_registry.upsert_canonical_entity (cognitive 38) REDACTED:112— entity_registry.upsert_canonical_entity has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 21, if/else 11 (15 pts), loops 2 (nesting depth added 4). 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.
analysis.run_analysis (cognitive 38) core_memory/runtime/dreamer/analysis.py:371— analysis.run_analysis has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 11, loops 2 (3 pts), ternaries 1 (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.
chunk_turns.list_chunk_turns (cognitive 38) core_memory/runtime/ingest/chunk_turns.py:263— chunk_turns.list_chunk_turns has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 3 (8 pts), boolean chains 6, loops 2 (3 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.
transcript_ingest.ingest_turn_envelopes (cognitive 38) core_memory/transcript_ingest.py:344— transcript_ingest.ingest_turn_envelopes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 12, error handling 2 (5 pts), loops 2 (3 pts), ternaries 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.
edge_lifecycle.fold_edge_usage (cognitive 37) core_memory/association/edge_lifecycle.py:131— edge_lifecycle.fold_edge_usage has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 5 (7 pts), boolean chains 5, ternaries 2 (5 pts), loops 3 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
roadmap.build_junction_roadmap (cognitive 37) core_memory/graph/roadmap.py:774— roadmap.build_junction_roadmap has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 15, loops 1 (2 pts), ternaries 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.
llm_client.chat_complete (cognitive 37) REDACTED:27— llm_client.chat_complete has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 12, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_add_helpers.find_recent_duplicate_bead_id_for_store (cognitive 37) core_memory/persistence/store_add_helpers.py:121— store_add_helpers.find_recent_duplicate_bead_id_for_store has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 18, if/else 9 (18 pts), loops 1 (nesting depth added 9). 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.
store_claim_ops.resolve_current_state (cognitive 37) core_memory/persistence/store_claim_ops.py:448— store_claim_ops.resolve_current_state has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 17, if/else 10 (14 pts), ternaries 4 (5 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.
hygiene.curated_type_title_hygiene (cognitive 37) core_memory/policy/hygiene.py:45— hygiene.curated_type_title_hygiene has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 10, loops 4 (8 pts), ternaries 1 (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.
research._apply_candidate_refinements (cognitive 37) core_memory/runtime/dreamer/research.py:243— research._apply_candidate_refinements has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 23, if/else 8 (12 pts), loops 1, ternaries 1 (nesting depth added 4). 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.
receipt.build_turn_finalized_receipt (cognitive 37) core_memory/runtime/turn/receipt.py:129— receipt.build_turn_finalized_receipt has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 25, if/else 8, ternaries 2 (4 pts) (nesting depth added 2). 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.
edge_lifecycle.collect_used_edge_pairs (cognitive 36) core_memory/association/edge_lifecycle.py:60— edge_lifecycle.collect_used_edge_pairs has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 11, loops 4 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
root_cause.segment_frontier_between (cognitive 36) core_memory/graph/root_cause.py:1168— root_cause.segment_frontier_between has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 12, loops 4 (5 pts), ternaries 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_reporting.schema_quality_report_for_store (cognitive 36) core_memory/persistence/store_reporting.py:127— store_reporting.schema_quality_report_for_store has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 19, if/else 6 (14 pts), loops 2 (3 pts) (nesting depth added 9). 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.
memory_reason._select_diverse_chains (cognitive 36) core_memory/retrieval/tools/memory_reason.py:209— memory_reason._select_diverse_chains has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 5 (10 pts), boolean chains 4 (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.
research._bead_context (cognitive 36) core_memory/runtime/dreamer/research.py:98— research._bead_context has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (12 pts), loops 5 (9 pts), ternaries 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.
update_policy.emit_claim_updates (cognitive 35) core_memory/claim/update_policy.py:123— update_policy.emit_claim_updates has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 6, loops 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
migrate.handle_migrate (cognitive 35) core_memory/cli/handlers/migrate.py:68— migrate.handle_migrate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 9, error handling 4 (9 pts), loops 1 (2 pts), ternaries 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.
event_schema_audit.audit_event_schemas (cognitive 35) core_memory/persistence/event_schema_audit.py:120— event_schema_audit.audit_event_schemas has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (25 pts), loops 3 (6 pts), error handling 1 (3 pts), ternaries 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.
store_validation_helpers.normalize_links (cognitive 35) core_memory/persistence/store_validation_helpers.py:6— store_validation_helpers.normalize_links has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (8 pts), boolean chains 5 (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.
turn_memory_authoring._value_at_path (cognitive 35) core_memory/policy/turn_memory_authoring.py:215— turn_memory_authoring._value_at_path has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 4, error handling 1 (3 pts), 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.
agent._resolved_goals_for_result (cognitive 35) core_memory/retrieval/agent.py:139— agent._resolved_goals_for_result has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 12, loops 3, ternaries 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.
geometry.build_geometry_manifest (cognitive 35) core_memory/runtime/dreamer/geometry.py:68— geometry.build_geometry_manifest has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 17, if/else 6 (11 pts), loops 3, error handling 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
progress._evaluate_pair (cognitive 35) core_memory/runtime/goals/progress.py:231— progress._evaluate_pair has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 19, if/else 12, ternaries 3 (4 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
promotion._normalize_links (cognitive 35) core_memory/schema/promotion.py:53— promotion._normalize_links has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (8 pts), boolean chains 5 (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.
dreamer_bridge._run_soul_proposal_task (cognitive 35) core_memory/soul/dreamer_bridge.py:421— dreamer_bridge._run_soul_proposal_task has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 27, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
injection.soul_injection (cognitive 35) core_memory/soul/injection.py:30— injection.soul_injection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 11, loops 2 (5 pts), ternaries 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sync._collect_prune_keep_assoc_ids (cognitive 34) REDACTED:199— sync._collect_prune_keep_assoc_ids has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 15, loops 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_compaction_ops.uncompact_for_store (cognitive 34) core_memory/persistence/store_compaction_ops.py:86— store_compaction_ops.uncompact_for_store has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 5, ternaries 4 (5 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.
engine._ensure_turn_creation_update (cognitive 34) core_memory/runtime/engine.py:483— engine._ensure_turn_creation_update has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 14, ternaries 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
turn_prep.normalize_turn_request (cognitive 34) core_memory/runtime/turn/turn_prep.py:25— turn_prep.normalize_turn_request has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 20, ternaries 7 (9 pts), if/else 5 (nesting depth added 2). 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.
check_architecture_guards.main (cognitive 34) scripts/check_architecture_guards.py:1100— check_architecture_guards.main has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 9, ternaries 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.
retrieval_planner.plan_retrieval_mode (cognitive 33) core_memory/claim/retrieval_planner.py:73— retrieval_planner.plan_retrieval_mode has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 9, loops 3 (6 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.
core._normalize_links (cognitive 33) REDACTED:141— core._normalize_links has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (8 pts), boolean chains 5 (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.
ingest_slack.ingest_slack_handler (cognitive 33) core_memory/integrations/mcp/tools/ingest_slack.py:76— ingest_slack.ingest_slack_handler has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (11 pts), error handling 3 (5 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dreamer_candidate_store.enqueue_contradiction_pressure_candidates (cognitive 33) core_memory/persistence/dreamer_candidate_store.py:152— dreamer_candidate_store.enqueue_contradiction_pressure_candidates has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 14, loops 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent._claim_slots_for_result (cognitive 33) core_memory/retrieval/agent.py:205— agent._claim_slots_for_result has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 5 (10 pts), boolean chains 7, loops 4 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
causal_recall.build_state_packet (cognitive 33) core_memory/retrieval/causal_recall.py:247— causal_recall.build_state_packet has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 6 (9 pts), boolean chains 8, loops 4 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
research.run_dreamer_research (cognitive 33) core_memory/runtime/dreamer/research.py:303— research.run_dreamer_research has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 26, if/else 6, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
assembly_depth.compute_assembly_depth (cognitive 33) core_memory/soul/assembly_depth.py:135— assembly_depth.compute_assembly_depth has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, loops 6 (7 pts), ternaries 3 (5 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.
identity_value_signals.detect_identity_value_findings (cognitive 33) core_memory/soul/identity_value_signals.py:74— identity_value_signals.detect_identity_value_findings has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 12, loops 6 (8 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.
compat.apply_grouped_aliases (cognitive 32) core_memory/cli/compat.py:63— compat.apply_grouped_aliases has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (32 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.
recall_payload.run_recall_payload (cognitive 32) core_memory/integrations/recall_payload.py:59— recall_payload.run_recall_payload has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 10, error handling 4 (6 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.
entity_merge_flow.apply_entity_merge_for_index (cognitive 32) REDACTED:133— entity_merge_flow.apply_entity_merge_for_index has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (12 pts), loops 3, ternaries 1 (2 pts) (nesting depth added 5). 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.
store_autonomy_ops.reinforcement_signals_for_store (cognitive 32) core_memory/persistence/store_autonomy_ops.py:6— store_autonomy_ops.reinforcement_signals_for_store has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 13, if/else 6 (12 pts), loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_claim_ops.find_canonical_turn_bead_id (cognitive 32) core_memory/persistence/store_claim_ops.py:84— store_claim_ops.find_canonical_turn_bead_id has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 11, ternaries 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
coverage.judge_association_candidates (cognitive 32) core_memory/runtime/associations/coverage.py:3137— coverage.judge_association_candidates has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 19, ternaries 4 (5 pts), if/else 4, loops 2 (3 pts), error handling 1 (nesting depth added 2). 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.
engine._enforce_structural_invariants (cognitive 32) core_memory/runtime/engine.py:418— engine._enforce_structural_invariants has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 13, ternaries 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.
progress.run_goal_progress_tasks (cognitive 32) core_memory/runtime/goals/progress.py:436— progress.run_goal_progress_tasks has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 18, if/else 10 (11 pts), ternaries 2, loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
agent_crawler_invoke.invoke_turn_crawler_agent (cognitive 32) core_memory/runtime/passes/agent_crawler_invoke.py:20— agent_crawler_invoke.invoke_turn_crawler_agent has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (12 pts), ternaries 3 (4 pts), error handling 2 (3 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.
ingress.maybe_emit_finalize_memory_event (cognitive 32) core_memory/runtime/turn/ingress.py:80— ingress.maybe_emit_finalize_memory_event has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (12 pts), ternaries 5 (6 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.
reauthoring.retry_pending_semantic (cognitive 32) core_memory/runtime/turn/reauthoring.py:921— reauthoring.retry_pending_semantic has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, error handling 2 (4 pts), ternaries 2 (3 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.
promotion._reinforcement_signals (cognitive 32) core_memory/schema/promotion.py:81— promotion._reinforcement_signals has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 13, if/else 6 (12 pts), loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diagnostics.doctor_report (cognitive 31) core_memory/cli/diagnostics.py:71— diagnostics.doctor_report has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 20, if/else 2 (4 pts), loops 2 (3 pts), ternaries 3, error handling 1 (nesting depth added 3). 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.
junctions.derive_junction_projection (cognitive 31) core_memory/graph/junctions.py:323— junctions.derive_junction_projection has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 11, loops 4 (5 pts), ternaries 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.
api.list_turn_summaries (cognitive 31) core_memory/integrations/api.py:601— api.list_turn_summaries has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (11 pts), error handling 2 (5 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_MCPAuthMiddleware.__call__ (cognitive 31) core_memory/integrations/http/server.py:634— _MCPAuthMiddleware.__call__ has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 4, error handling 1 (3 pts) (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.
myelination_rewards.emit_myelination_reward_event (cognitive 31) core_memory/persistence/myelination_rewards.py:236— myelination_rewards.emit_myelination_reward_event has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 14, if/else 10 (14 pts), ternaries 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.
store_compaction_ops.compact_for_store (cognitive 31) core_memory/persistence/store_compaction_ops.py:14— store_compaction_ops.compact_for_store has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 17, if/else 6 (13 pts), loops 1 (nesting depth added 7). 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.
identity_value_research.enqueue_identity_value_candidates (cognitive 31) core_memory/runtime/dreamer/identity_value_research.py:38— identity_value_research.enqueue_identity_value_candidates has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 15, if/else 7 (14 pts), loops 2 (nesting depth added 7). 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.
external_evidence._validate_external_payload (cognitive 31) core_memory/runtime/ingest/external_evidence.py:372— external_evidence._validate_external_payload has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 10 (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.
check_architecture_guards.check_deterministic_semantic_writers (cognitive 31) scripts/check_architecture_guards.py:806— check_architecture_guards.check_deterministic_semantic_writers has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5, loops 3, ternaries 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
edge_weights.normalize_backend_chain (cognitive 30) core_memory/graph/edge_weights.py:149— edge_weights.normalize_backend_chain has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, error handling 1 (4 pts), loops 2 (4 pts), ternaries 1 (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.
connector._build_default_branch_doc_push (cognitive 30) core_memory/integrations/github/connector.py:170— connector._build_default_branch_doc_push has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 10, loops 4 (7 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
goal_lifecycle_v2.transition_goal_state_for_store (cognitive 30) core_memory/persistence/goal_lifecycle_v2.py:77— goal_lifecycle_v2.transition_goal_state_for_store has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 13, ternaries 1 (2 pts) (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.
store_management_ops.remove_beads_for_store (cognitive 30) core_memory/persistence/store_management_ops.py:322— store_management_ops.remove_beads_for_store has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 13, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
tension_meter.compute_tension_resolution_meter (cognitive 30) core_memory/runtime/observability/tension_meter.py:108— tension_meter.compute_tension_resolution_meter has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (12 pts), ternaries 3, error handling 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.
session_start_flow.build_session_start_snapshot (cognitive 30) core_memory/runtime/session/session_start_flow.py:31— session_start_flow.build_session_start_snapshot has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (11 pts), loops 4 (5 pts), ternaries 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.
summary._tension_light_cone_reports (cognitive 30) core_memory/soul/summary.py:527— summary._tension_light_cone_reports has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 16, if/else 6 (9 pts), error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 5). 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.
extraction.extract_claims (cognitive 29) core_memory/claim/extraction.py:248— extraction.extract_claims has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 6, 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.
root_cause._claim_refs (cognitive 29) core_memory/graph/root_cause.py:889— root_cause._claim_refs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (6 pts), ternaries 1 (5 pts), boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
worldlines._entity_worldlines (cognitive 29) core_memory/graph/worldlines.py:111— worldlines._entity_worldlines has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 7 (10 pts), boolean chains 4, ternaries 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.
store_management_ops.deactivate_association_for_store (cognitive 29) core_memory/persistence/store_management_ops.py:785— store_management_ops.deactivate_association_for_store has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 14, if/else 10 (14 pts), loops 1 (nesting depth added 4). 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.
association_inference_v21.validate_and_normalize_inference_payload (cognitive 29) core_memory/policy/association_inference_v21.py:129— association_inference_v21.validate_and_normalize_inference_payload has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 16, if/else 9 (12 pts), ternaries 1 (nesting depth added 3). 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.
roadmap_planner.plan_over_roadmap (cognitive 29) core_memory/retrieval/roadmap_planner.py:657— roadmap_planner.plan_over_roadmap has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 8, ternaries 3 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
coverage._claim_slots (cognitive 29) core_memory/runtime/associations/coverage.py:1001— coverage._claim_slots has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 4 (11 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.
analysis._load_seen_state (cognitive 29) core_memory/runtime/dreamer/analysis.py:36— analysis._load_seen_state has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6, loops 3 (4 pts), error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
analysis._structural_signal_pack (cognitive 29) core_memory/runtime/dreamer/analysis.py:204— analysis._structural_signal_pack has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 22, if/else 7. 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.
goal_lifecycle.resolve_goals_for_turn (cognitive 29) core_memory/runtime/session/goal_lifecycle.py:51— goal_lifecycle.resolve_goals_for_turn has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 10, 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.
retrieval_planner._active_slot_hints (cognitive 28) core_memory/claim/retrieval_planner.py:43— retrieval_planner._active_slot_hints has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
retrieval.expand_query_with_entities (cognitive 28) core_memory/entity/retrieval.py:63— retrieval.expand_query_with_entities has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 11, 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.
sync._dedupe_projection (cognitive 28) REDACTED:246— sync._dedupe_projection has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 7 (12 pts), loops 2 (nesting depth added 5). 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.
store_management_ops._split_source_selector (cognitive 28) core_memory/persistence/store_management_ops.py:75— store_management_ops._split_source_selector has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, loops 2 (4 pts), ternaries 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.
chunk_evidence._referenced_turn_records (cognitive 28) core_memory/retrieval/chunk_evidence.py:68— chunk_evidence._referenced_turn_records has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 3 (7 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
canonical._locomo_dia_ids_from_bead (cognitive 28) core_memory/retrieval/pipeline/canonical.py:558— canonical._locomo_dia_ids_from_bead has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 8, loops 3 (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.
coverage.enqueue_goal_progress_candidate (cognitive 28) core_memory/runtime/associations/coverage.py:615— coverage.enqueue_goal_progress_candidate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, boolean chains 13, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
coverage._write_association_if_missing (cognitive 28) core_memory/runtime/associations/coverage.py:1271— coverage._write_association_if_missing has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 23, if/else 5. 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.
self_model_drift.compute_self_model_drift (cognitive 28) core_memory/runtime/observability/self_model_drift.py:129— self_model_drift.compute_self_model_drift has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (13 pts), error handling 1, loops 1 (nesting depth added 4). 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.
compaction_queue.drain_compaction_queue (cognitive 28) core_memory/runtime/queue/compaction_queue.py:122— compaction_queue.drain_compaction_queue has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 16, if/else 7 (11 pts), loops 1 (nesting depth added 4). 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.
transcript_ingest._group_envelopes (cognitive 28) core_memory/transcript_ingest.py:104— transcript_ingest._group_envelopes has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (9 pts), ternaries 3 (6 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.
register (cognitive 28) plugins/openclaw-core-memory-bridge/index.js:19— register has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 75, if/else 41 (57 pts), ternaries 22, error handling 14 (20 pts), loops 9 (10 pts), other 6 (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.
quarantine.write_quarantine (cognitive 27) core_memory/association/quarantine.py:37— quarantine.write_quarantine has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 4 (7 pts), error handling 1 (3 pts), ternaries 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.
answer_policy.decide_answer_outcome (cognitive 27) core_memory/claim/answer_policy.py:22— answer_policy.decide_answer_outcome has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 20, if/else 6, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
sync._collect_projection (cognitive 27) REDACTED:151— sync._collect_projection has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 11, loops 2, error handling 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.
hosted_capture_bridge.process_hosted_capture_event (cognitive 27) REDACTED:186— hosted_capture_bridge.process_hosted_capture_event has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 12, if/else 7, error handling 3 (4 pts), ternaries 3 (4 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
promotion_service.decide_promotion_for_store (cognitive 27) core_memory/persistence/promotion_service.py:155— promotion_service.decide_promotion_for_store has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 16, if/else 10 (11 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
store_query.query_for_store (cognitive 27) core_memory/persistence/store_query.py:8— store_query.query_for_store has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 6, 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.
causal_recall.attach_causal_recall_pipeline (cognitive 27) core_memory/retrieval/causal_recall.py:521— causal_recall.attach_causal_recall_pipeline has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 10, 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.
roadmap_planner._shortest_stitched_path (cognitive 27) core_memory/retrieval/roadmap_planner.py:441— roadmap_planner._shortest_stitched_path has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
semantic_index.semantic_doctor (cognitive 27) REDACTED:452— semantic_index.semantic_doctor has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 15, if/else 8, error handling 1 (2 pts), ternaries 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
visible_corpus.build_visible_corpus (cognitive 27) core_memory/retrieval/visible_corpus.py:64— visible_corpus.build_visible_corpus has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, loops 3 (4 pts), error handling 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
convergence.detect_worldline_convergence (cognitive 27) core_memory/runtime/dreamer/convergence.py:46— convergence.detect_worldline_convergence has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 7 (10 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
eval._label_summary (cognitive 27) core_memory/runtime/dreamer/eval.py:204— eval._label_summary has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 18, if/else 4 (7 pts), loops 2 (nesting depth added 3). 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.
projection.compute_future_projections (cognitive 27) core_memory/runtime/dreamer/projection.py:159— projection.compute_future_projections has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (8 pts), loops 4 (6 pts) (nesting depth added 5). 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.
semantic_state.mark_semantic_write_state (cognitive 27) core_memory/runtime/turn/semantic_state.py:85— semantic_state.mark_semantic_write_state has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 22, if/else 4, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
slo.association_slo_report (cognitive 26) core_memory/association/slo.py:65— slo.association_slo_report has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 15, if/else 7 (9 pts), loops 1, ternaries 1 (nesting depth added 2). 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.
CoreMemoryRetriever._get_relevant_documents (cognitive 26) core_memory/integrations/langchain/retriever.py:67— CoreMemoryRetriever._get_relevant_documents has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 10, 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.
agent._normalize_request (cognitive 26) core_memory/retrieval/agent.py:376— agent._normalize_request has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 11, ternaries 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.
rerank.rerank_candidates (cognitive 26) core_memory/retrieval/rerank.py:221— rerank.rerank_candidates has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 9, if/else 3 (5 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.
roadmap_planner._states_for_alternative (cognitive 26) core_memory/retrieval/roadmap_planner.py:306— roadmap_planner._states_for_alternative has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3, loops 2 (3 pts), ternaries 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.
jobs.run_async_jobs (cognitive 26) core_memory/runtime/queue/jobs.py:287— jobs.run_async_jobs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5, error handling 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.
resolver.resolve_all_current_state (cognitive 25) core_memory/claim/resolver.py:17— resolver.resolve_all_current_state has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (6 pts), boolean chains 5, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diagnostics.simple_recall_fallback (cognitive 25) core_memory/cli/diagnostics.py:170— diagnostics.simple_recall_fallback has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 17, if/else 3 (4 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 3). 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.
retrieval.infer_query_entity_context (cognitive 25) core_memory/entity/retrieval.py:17— retrieval.infer_query_entity_context has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 7, loops 4 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_management_ops.remove_source_beads_for_store (cognitive 25) core_memory/persistence/store_management_ops.py:474— store_management_ops.remove_source_beads_for_store has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (11 pts), ternaries 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.
store_projection_ops.rebuild_index_projection_from_sessions_for_store (cognitive 25) core_memory/persistence/store_projection_ops.py:11— store_projection_ops.rebuild_index_projection_from_sessions_for_store has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 7, loops 3 (5 pts), error handling 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.
bead_judge._normalize_judged_fields (cognitive 25) core_memory/policy/bead_judge.py:371— bead_judge._normalize_judged_fields has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, if/else 6 (9 pts), loops 1, ternaries 1 (nesting depth added 3). 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.
pipeline._normalize_search_request (cognitive 25) core_memory/retrieval/pipeline/__init__.py:25— pipeline._normalize_search_request has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 22, ternaries 3. 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.
canonical._to_anchor (cognitive 25) core_memory/retrieval/pipeline/canonical.py:596— canonical._to_anchor has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 24, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
query_norm.resolve_query_anchors (cognitive 25) core_memory/retrieval/query_norm.py:106— query_norm.resolve_query_anchors has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 9, 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.
roadmap_planner._fallback (cognitive 25) core_memory/retrieval/roadmap_planner.py:511— roadmap_planner._fallback has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 11, ternaries 6, if/else 3 (5 pts), loops 2 (3 pts) (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.
seed_backfill.run_seed_quality_backfill (cognitive 25) core_memory/runtime/hygiene/seed_backfill.py:96— seed_backfill.run_seed_quality_backfill has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, loops 2 (3 pts), error handling 1, ternaries 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.
roadmap.edge_cost_row (cognitive 24) core_memory/graph/roadmap.py:229— roadmap.edge_cost_row has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 19, if/else 4, loops 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
typed_read.query_contradictions (cognitive 24) core_memory/integrations/mcp/typed_read.py:288— typed_read.query_contradictions has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 15, if/else 5 (8 pts), loops 1 (nesting depth added 3). 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.
migration.backfill_bead_session_ids (cognitive 24) core_memory/integrations/migration.py:14— migration.backfill_bead_session_ids has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 5, 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.
onboard.harden_openclaw_plugin_config (cognitive 24) core_memory/integrations/openclaw/onboard.py:39— onboard.harden_openclaw_plugin_config has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 6, error handling 2 (3 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
promotion_service.decide_session_promotion_states_for_store (cognitive 24) core_memory/persistence/promotion_service.py:454— promotion_service.decide_session_promotion_states_for_store has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts), ternaries 2 (6 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.
store_reporting.metrics_report_for_store (cognitive 24) core_memory/persistence/store_reporting.py:22— store_reporting.metrics_report_for_store has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (8 pts), error handling 1 (3 pts), ternaries 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
snap.snap_form (cognitive 24) core_memory/retrieval/pipeline/snap.py:43— snap.snap_form has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (8 pts), loops 3 (nesting depth added 3). 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.
memory_reason._chain_coherence (cognitive 24) core_memory/retrieval/tools/memory_reason.py:121— memory_reason._chain_coherence has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10, loops 2 (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.
external_evidence._bead_payload (cognitive 24) core_memory/runtime/ingest/external_evidence.py:417— external_evidence._bead_payload has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (7 pts), ternaries 3, loops 2 (nesting depth added 2). 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.
external_evidence._run_semantic_enrichment (cognitive 24) core_memory/runtime/ingest/external_evidence.py:591— external_evidence._run_semantic_enrichment has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 8, error handling 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.
retrieval_value_overrides.apply_retrieval_value_override_for_index (cognitive 24) REDACTED:55— retrieval_value_overrides.apply_retrieval_value_override_for_index has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 20, if/else 4. 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.
session_enrichment_delta.write_delta_quarantine (cognitive 24) core_memory/runtime/session/session_enrichment_delta.py:333— session_enrichment_delta.write_delta_quarantine has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, error handling 1 (3 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.
session_enrichment_delta.delta_to_crawler_updates (cognitive 24) core_memory/runtime/session/session_enrichment_delta.py:740— session_enrichment_delta.delta_to_crawler_updates has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 8, loops 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tension_signals.detect_goal_conflicts (cognitive 24) core_memory/soul/tension_signals.py:43— tension_signals.detect_goal_conflicts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 10, 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.
junctions._worldline_identities (cognitive 23) core_memory/graph/junctions.py:277— junctions._worldline_identities has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (11 pts), loops 1 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
entity_merge_flow.suggest_entity_merge_proposals_for_index (cognitive 23) REDACTED:60— entity_merge_flow.suggest_entity_merge_proposals_for_index has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 9, 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.
myelination_rewards.reward_claim_conflict_resolution (cognitive 23) core_memory/persistence/myelination_rewards.py:527— myelination_rewards.reward_claim_conflict_resolution has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 10, 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.
store_claim_ops._claim_update_evidence_bead_ids (cognitive 23) core_memory/persistence/store_claim_ops.py:179— store_claim_ops._claim_update_evidence_bead_ids has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_failure_ops.find_failure_signature_matches_for_store (cognitive 23) core_memory/persistence/store_failure_ops.py:16— store_failure_ops.find_failure_signature_matches_for_store has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 8, loops 1 (2 pts), ternaries 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.
coverage.on_bead_committed (cognitive 23) core_memory/runtime/associations/coverage.py:2410— coverage.on_bead_committed has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (10 pts), boolean chains 8, if/else 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.
external_evidence.ingest_external_evidence (cognitive 23) core_memory/runtime/ingest/external_evidence.py:684— external_evidence.ingest_external_evidence has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8, ternaries 2 (4 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jobs.enqueue_async_job (cognitive 23) core_memory/runtime/queue/jobs.py:192— jobs.enqueue_async_job has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (10 pts), ternaries 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.
semantic_state.semantic_write_health (cognitive 23) core_memory/runtime/turn/semantic_state.py:201— semantic_state.semantic_write_health has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts), ternaries 4 (5 pts), loops 1 (nesting depth added 2). 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.
store._current_entries (cognitive 23) core_memory/soul/store.py:101— store._current_entries has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (10 pts), loops 1 (nesting depth added 5). 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.
crawler_contract._maybe_upgrade_context_to_reflection (cognitive 22) core_memory/association/crawler_contract.py:697— crawler_contract._maybe_upgrade_context_to_reflection has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 2, error handling 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.
update_policy._normalize_explicit_updates (cognitive 22) core_memory/claim/update_policy.py:75— update_policy._normalize_explicit_updates has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 4 (8 pts), loops 1 (nesting depth added 4). 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.
junctions._embedding_neighbors (cognitive 22) core_memory/graph/junctions.py:143— junctions._embedding_neighbors has cognitive complexity 22 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 4 (9 pts), boolean chains 3 (nesting depth added 10). 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.
promotion_service.evaluate_candidates_for_store (cognitive 22) core_memory/persistence/promotion_service.py:77— promotion_service.evaluate_candidates_for_store has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 3 (5 pts), ternaries 2 (4 pts), error handling 1 (3 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.
promotion_service.resolve_goal_candidate_for_store (cognitive 22) core_memory/persistence/promotion_service.py:288— promotion_service.resolve_goal_candidate_for_store has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 14, if/else 7, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
store_add_helpers.resolve_bead_session_id_for_store (cognitive 22) core_memory/persistence/store_add_helpers.py:9— store_add_helpers.resolve_bead_session_id_for_store has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pipehouse_adapter.retrieve (cognitive 22) REDACTED:30— pipehouse_adapter.retrieve has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 4). 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.
causal_recall._claims_for_paths (cognitive 22) core_memory/retrieval/causal_recall.py:208— causal_recall._claims_for_paths has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (5 pts), boolean chains 3, ternaries 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.
TurnEnvelope.finalize_hashes (cognitive 22) core_memory/runtime/state.py:79— TurnEnvelope.finalize_hashes has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), loops 2 (4 pts), ternaries 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.
reauthoring._v1_bead_ids (cognitive 22) core_memory/runtime/turn/reauthoring.py:153— reauthoring._v1_bead_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
semantic_state.latest_finalized_turn (cognitive 22) core_memory/runtime/turn/semantic_state.py:250— semantic_state.latest_finalized_turn has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (9 pts), error handling 1 (2 pts), loops 1 (nesting depth added 5). 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.
dreamer_bridge._normalize_drafts (cognitive 22) core_memory/soul/dreamer_bridge.py:380— dreamer_bridge._normalize_drafts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 10, 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.
rolling_window._select_beads_for_budget (cognitive 22) core_memory/write_pipeline/rolling_window.py:188— rolling_window._select_beads_for_budget has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, loops 1, ternaries 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.
answer_policy.explain_answer_outcome (cognitive 21) core_memory/claim/answer_policy.py:77— answer_policy.explain_answer_outcome has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 15, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ops.handle_ops_commands (cognitive 21) core_memory/cli/handlers/ops.py:46— ops.handle_ops_commands has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (19 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.
roadmap._candidate_pairs (cognitive 21) core_memory/graph/roadmap.py:164— roadmap._candidate_pairs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ingest_zoom._parse_vtt (cognitive 21) core_memory/integrations/mcp/tools/ingest_zoom.py:37— ingest_zoom._parse_vtt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript_snapshot_state.reserve_transcript_snapshot (cognitive 21) core_memory/integrations/mcp/tools/transcript_snapshot_state.py:92— transcript_snapshot_state.reserve_transcript_snapshot has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (8 pts), ternaries 2 (nesting depth added 3). 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.
agent_end_bridge._fallback_text (cognitive 21) core_memory/integrations/openclaw/agent_end_bridge.py:59— agent_end_bridge._fallback_text has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (7 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.
memory_tools.continuity_prompt (cognitive 21) core_memory/integrations/pydanticai/memory_tools.py:102— memory_tools.continuity_prompt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, error handling 3 (4 pts), loops 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.
semantic_tasks._result_from_payload (cognitive 21) REDACTED:137— semantic_tasks._result_from_payload has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 17, ternaries 4. 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.
store_constraints.check_plan_constraints_for_store (cognitive 21) core_memory/persistence/store_constraints.py:52— store_constraints.check_plan_constraints_for_store has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), ternaries 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.
association_inference_v21._association_evidence_bead_ids (cognitive 21) core_memory/policy/association_inference_v21.py:77— association_inference_v21._association_evidence_bead_ids has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, 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.
semantic_index._external_backend_connectivity (cognitive 21) REDACTED:535— semantic_index._external_backend_connectivity has cognitive complexity 21 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 5 (7 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.
assembly_depth._raw_factors (cognitive 21) core_memory/soul/assembly_depth.py:76— assembly_depth._raw_factors has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 5, ternaries 2, loops 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dreamer_bridge._enrich_findings_with_signals (cognitive 21) core_memory/soul/dreamer_bridge.py:191— dreamer_bridge._enrich_findings_with_signals has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), ternaries 3 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
register::emitFallbackTurn (cognitive 21) plugins/openclaw-core-memory-bridge/index.js:446— register::emitFallbackTurn has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (8 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
preview.compute_preview_association_candidates (cognitive 20) core_memory/association/preview.py:138— preview.compute_preview_association_candidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 8, 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.
root_cause._path_record (cognitive 20) core_memory/graph/root_cause.py:480— root_cause._path_record has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 2 (4 pts), loops 3 (4 pts), ternaries 2 (nesting depth added 3). 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.
root_cause._rank_influence (cognitive 20) core_memory/graph/root_cause.py:741— root_cause._rank_influence has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
root_cause._dynamic_cost_signature (cognitive 20) core_memory/graph/root_cause.py:911— root_cause._dynamic_cost_signature has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 6, loops 4 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
root_cause.root_cause_trace (cognitive 20) core_memory/graph/root_cause.py:1277— root_cause.root_cause_trace has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 7, ternaries 2 (3 pts), loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
typed_read.query_current_state (cognitive 20) core_memory/integrations/mcp/typed_read.py:168— typed_read.query_current_state has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 17, ternaries 2, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
KuzuGraphBackend._traverse_hops (cognitive 20) core_memory/persistence/graph/kuzu_backend.py:158— KuzuGraphBackend._traverse_hops has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
myelination_rewards.reward_bonus_by_edge_key (cognitive 20) core_memory/persistence/myelination_rewards.py:630— myelination_rewards.reward_bonus_by_edge_key has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
retrieval_feedback._collect_edges (cognitive 20) core_memory/persistence/retrieval_feedback.py:54— retrieval_feedback._collect_edges has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 6, 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.
store_claim_ops._slot_highwater (cognitive 20) core_memory/persistence/store_claim_ops.py:288— store_claim_ops._slot_highwater has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 6, error handling 1 (3 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.
store_claim_ops._all_claim_rows (cognitive 20) core_memory/persistence/store_claim_ops.py:409— store_claim_ops._all_claim_rows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 6, loops 3 (5 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.
causal_recall._url_from_value (cognitive 20) core_memory/retrieval/causal_recall.py:80— causal_recall._url_from_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rerank._chain_features (cognitive 20) core_memory/retrieval/rerank.py:177— rerank._chain_features has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, ternaries 6, if/else 1 (3 pts), loops 2 (3 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
roadmap_planner._goal_advancing_terminals (cognitive 20) core_memory/retrieval/roadmap_planner.py:110— roadmap_planner._goal_advancing_terminals has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (8 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_reason._collect_citations_from_chains (cognitive 20) core_memory/retrieval/tools/memory_reason.py:342— memory_reason._collect_citations_from_chains has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 2 (4 pts), loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 5). 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.
memory_reason._plan_changed (cognitive 20) core_memory/retrieval/tools/memory_reason.py:676— memory_reason._plan_changed has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), loops 2 (3 pts), ternaries 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.
reviewer_quick_value._find_bead_id_by_turn_and_title (cognitive 20) core_memory/runtime/observability/reviewer_quick_value.py:28— reviewer_quick_value._find_bead_id_by_turn_and_title has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 8, error handling 1, loops 1, ternaries 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.
side_effect_queue.side_effect_queue_status (cognitive 20) core_memory/runtime/queue/side_effect_queue.py:67— side_effect_queue.side_effect_queue_status has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 8, ternaries 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.
agent_authored_updates._drop_unknown_json_value (cognitive 20) core_memory/schema/agent_authored_updates.py:568— agent_authored_updates._drop_unknown_json_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
promotion.get_recommendation_rows (cognitive 20) core_memory/schema/promotion.py:218— promotion.get_recommendation_rows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9, 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.
dreamer_bridge.dreamer_soul_findings (cognitive 20) core_memory/soul/dreamer_bridge.py:729— dreamer_bridge.dreamer_soul_findings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
injection.soul_injection_text (cognitive 20) core_memory/soul/injection.py:74— injection.soul_injection_text has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 5, loops 2 (3 pts), ternaries 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.
store.propose_soul_update (cognitive 20) core_memory/soul/store.py:201— store.propose_soul_update has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 2. 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.
semantic.handle_semantic_command (cognitive 19) core_memory/cli/handlers/semantic.py:46— semantic.handle_semantic_command has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
junctions.resolve_junction_matches (cognitive 19) core_memory/graph/junctions.py:437— junctions.resolve_junction_matches has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 2, loops 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
worldlines._claim_worldlines (cognitive 19) core_memory/graph/worldlines.py:68— worldlines._claim_worldlines has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 6, 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.
server.turn_finalized (cognitive 19) core_memory/integrations/http/server.py:801— server.turn_finalized has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (5 pts), error handling 3 (4 pts), ternaries 1 (nesting depth added 2). 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.
entity_merge_flow.decide_entity_merge_proposal_for_index (cognitive 19) REDACTED:204— entity_merge_flow.decide_entity_merge_proposal_for_index has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, if/else 3, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
factory.create_graph_backend (cognitive 19) core_memory/persistence/graph/factory.py:34— factory.create_graph_backend has cognitive complexity 19 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 5, boolean chains 2, ternaries 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.
store_metrics_runtime.append_metric_for_store (cognitive 19) core_memory/persistence/store_metrics_runtime.py:81— store_metrics_runtime.append_metric_for_store has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 2 (3 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
bead_judge._heuristic_entities (cognitive 19) core_memory/policy/bead_judge.py:148— bead_judge._heuristic_entities has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
causal_recall.causal_edge_pressure (cognitive 19) core_memory/retrieval/causal_recall.py:477— causal_recall.causal_edge_pressure has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, 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.
coverage._candidate_status_updates (cognitive 19) core_memory/runtime/associations/coverage.py:455— coverage._candidate_status_updates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
candidates._entity_similarity (cognitive 19) core_memory/runtime/dreamer/candidates.py:60— candidates._entity_similarity has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
candidates.submit_entity_merge_candidate (cognitive 19) core_memory/runtime/dreamer/candidates.py:1112— candidates.submit_entity_merge_candidate has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 16, if/else 3. 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.
longitudinal.longitudinal_benchmark_v2 (cognitive 19) core_memory/runtime/dreamer/longitudinal.py:178— longitudinal.longitudinal_benchmark_v2 has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (8 pts), loops 1 (nesting depth added 3). 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.
engine._default_entities_from_text (cognitive 19) core_memory/runtime/engine.py:246— engine._default_entities_from_text has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 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.
progress.process_goal_progress_event (cognitive 19) core_memory/runtime/goals/progress.py:804— progress.process_goal_progress_event has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (8 pts) (nesting depth added 3). 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.
bead_commit._mirror_bead_to_backends (cognitive 19) core_memory/runtime/post_write/bead_commit.py:35— bead_commit._mirror_bead_to_backends has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 3 (6 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reauthoring._select_reauthor_sources (cognitive 19) core_memory/runtime/turn/reauthoring.py:358— reauthoring._select_reauthor_sources has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, 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.
semantic_state.event_for_turn (cognitive 19) core_memory/runtime/turn/semantic_state.py:285— semantic_state.event_for_turn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
promotion.compute_promotion_score (cognitive 19) core_memory/schema/promotion.py:129— promotion.compute_promotion_score has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, boolean chains 7, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
rolling_window._ensure_type_diversity (cognitive 19) core_memory/write_pipeline/rolling_window.py:100— rolling_window._ensure_type_diversity has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, 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.
check_architecture_guards.check_upward_imports (cognitive 19) scripts/check_architecture_guards.py:407— check_architecture_guards.check_upward_imports has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
conflict_review.resolution_to_claim_updates (cognitive 18) core_memory/claim/conflict_review.py:170— conflict_review.resolution_to_claim_updates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
setup.config_validate_command (cognitive 18) core_memory/cli/handlers/setup.py:811— setup.config_validate_command has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
roadmap.sample_junction_identities (cognitive 18) core_memory/graph/roadmap.py:104— roadmap.sample_junction_identities has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
root_cause.segment_between (cognitive 18) core_memory/graph/root_cause.py:1104— root_cause.segment_between has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
server.memory_association_candidate_decide (cognitive 18) core_memory/integrations/http/server.py:2000— server.memory_association_candidate_decide has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
capture.capture_handler (cognitive 18) core_memory/integrations/mcp/tools/capture.py:35— capture.capture_handler has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 5, error handling 2. 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.
mapper.bead_to_node (cognitive 18) REDACTED:23— mapper.bead_to_node has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
promotion_service.apply_agent_promotion_reviews_for_store (cognitive 18) core_memory/persistence/promotion_service.py:394— promotion_service.apply_agent_promotion_reviews_for_store has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), loops 1 (nesting depth added 2). 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.
semantic_task_receipts.summarize_semantic_task_runs (cognitive 18) core_memory/persistence/semantic_task_receipts.py:204— semantic_task_receipts.summarize_semantic_task_runs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 5, boolean chains 4, loops 2 (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.
store_claim_ops._append_claim_update_rows (cognitive 18) core_memory/persistence/store_claim_ops.py:305— store_claim_ops._append_claim_update_rows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 8, 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.
store_constraints.active_constraints_for_store (cognitive 18) core_memory/persistence/store_constraints.py:8— store_constraints.active_constraints_for_store has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, 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.
store_text_hygiene_ops.extract_constraints_for_store (cognitive 18) core_memory/persistence/store_text_hygiene_ops.py:94— store_text_hygiene_ops.extract_constraints_for_store has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hygiene.extract_constraints (cognitive 18) core_memory/policy/hygiene.py:139— hygiene.extract_constraints has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
incidents.incident_match_strength (cognitive 18) core_memory/policy/incidents.py:36— incidents.incident_match_strength has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 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.
semantic_task_verifier._deterministic_checks (cognitive 18) core_memory/policy/semantic_task_verifier.py:84— semantic_task_verifier._deterministic_checks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, ternaries 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
causal_recall.execute_state_packet (cognitive 18) core_memory/retrieval/causal_recall.py:387— causal_recall.execute_state_packet has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 2, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
pipeline._append_structural_chains (cognitive 18) core_memory/retrieval/pipeline/__init__.py:80— pipeline._append_structural_chains has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, ternaries 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.
QdrantBackend.search (cognitive 18) core_memory/retrieval/vector_backend.py:187— QdrantBackend.search has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
goal_decay.detect_goal_decay (cognitive 18) core_memory/runtime/dreamer/goal_decay.py:72— goal_decay.detect_goal_decay has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 2, error handling 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.
goal_discovery.detect_latent_goals (cognitive 18) core_memory/runtime/dreamer/goal_discovery.py:86— goal_discovery.detect_latent_goals has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 4 (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.
flush_state.upsert_process_flush_checkpoint_bead (cognitive 18) core_memory/runtime/flush/flush_state.py:34— flush_state.upsert_process_flush_checkpoint_bead has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, if/else 2 (4 pts), loops 1 (nesting depth added 2). 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.
myelination.apply_contradiction_decay (cognitive 18) core_memory/runtime/observability/myelination.py:206— myelination.apply_contradiction_decay has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ingress._normalize_mesh_trace (cognitive 18) core_memory/runtime/turn/ingress.py:53— ingress._normalize_mesh_trace has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 3 (6 pts), loops 1 (nesting depth added 3). 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.
reauthoring.semantic_backfill_report (cognitive 18) core_memory/runtime/turn/reauthoring.py:304— reauthoring.semantic_backfill_report has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, error handling 1 (3 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.
storyline_overlay.validate_storyline_overlay (cognitive 18) core_memory/schema/storyline_overlay.py:40— storyline_overlay.validate_storyline_overlay has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 8, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
goals.list_goals (cognitive 18) core_memory/soul/goals.py:152— goals.list_goals has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), loops 1 (nesting depth added 4). 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.
transcript_ingest._associations_created_summary (cognitive 18) core_memory/transcript_ingest.py:429— transcript_ingest._associations_created_summary has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (6 pts), loops 2, error handling 1, ternaries 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paraphrase_eval._anchor_hit (cognitive 18) eval/paraphrase_eval.py:36— paraphrase_eval._anchor_hit has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), loops 1 (nesting depth added 2). 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.
retrieval_eval.main (cognitive 18) eval/retrieval_eval.py:73— retrieval_eval.main has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 4, if/else 1 (3 pts), loops 2 (3 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.
migrate._iter_all_beads (cognitive 17) core_memory/cli/handlers/migrate.py:12— migrate._iter_all_beads has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
setup._storage_probe (cognitive 17) core_memory/cli/handlers/setup.py:287— setup._storage_probe has cognitive complexity 17 (threshold 15). Drivers by points: error handling 4 (7 pts), if/else 5 (6 pts), boolean chains 3, ternaries 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.
root_cause._source_tokens (cognitive 17) core_memory/graph/root_cause.py:346— root_cause._source_tokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts), ternaries 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.
traversal.causal_traverse (cognitive 17) core_memory/graph/traversal.py:167— traversal.causal_traverse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 2 (3 pts), ternaries 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.
server.memory_association_runs (cognitive 17) core_memory/integrations/http/server.py:2034— server.memory_association_runs has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 15, if/else 2. 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.
ingest_zoom._parse_otter (cognitive 17) core_memory/integrations/mcp/tools/ingest_zoom.py:86— ingest_zoom._parse_otter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
management._resolve_rereview_beads (cognitive 17) core_memory/management/__init__.py:668— management._resolve_rereview_beads has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 2 (3 pts), error handling 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.
JsonFileBackend.query_beads (cognitive 17) core_memory/persistence/backend.py:158— JsonFileBackend.query_beads has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 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.
dreamer_candidate_store.make_candidate_row (cognitive 17) core_memory/persistence/dreamer_candidate_store.py:102— dreamer_candidate_store.make_candidate_row has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 15, if/else 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
myelination_rewards.read_reward_events (cognitive 17) core_memory/persistence/myelination_rewards.py:600— myelination_rewards.read_reward_events has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_add_helpers.detect_decision_conflicts_for_store (cognitive 17) core_memory/persistence/store_add_helpers.py:63— store_add_helpers.detect_decision_conflicts_for_store has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store_claim_ops._normalize_claim_update_rows (cognitive 17) core_memory/persistence/store_claim_ops.py:150— store_claim_ops._normalize_claim_update_rows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 5, error handling 2 (5 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.
store_reporting.autonomy_report_for_store (cognitive 17) core_memory/persistence/store_reporting.py:77— store_reporting.autonomy_report_for_store has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, error handling 1 (3 pts), loops 1, ternaries 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.
causal_recall._source_tokens (cognitive 17) core_memory/retrieval/causal_recall.py:101— causal_recall._source_tokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts), ternaries 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.
evidence_scoring._temporal_fit (cognitive 17) core_memory/retrieval/evidence_scoring.py:68— evidence_scoring._temporal_fit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, ternaries 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.
canonical._normalize_public_hydration_request (cognitive 17) core_memory/retrieval/pipeline/canonical.py:380— canonical._normalize_public_hydration_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 1 (2 pts) (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.
canonical._metadata_filter_matches (cognitive 17) core_memory/retrieval/pipeline/canonical.py:682— canonical._metadata_filter_matches has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
coverage._dedupe_candidate_rows (cognitive 17) core_memory/runtime/associations/coverage.py:1208— coverage._dedupe_candidate_rows has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 3 (6 pts), loops 1 (nesting depth added 3). 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.
coverage.association_judge_readiness (cognitive 17) core_memory/runtime/associations/coverage.py:1525— coverage.association_judge_readiness has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 1 (2 pts) (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.
coverage._build_judge_context (cognitive 17) core_memory/runtime/associations/coverage.py:1708— coverage._build_judge_context has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), loops 3 (4 pts) (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.
progress._pair_rows (cognitive 17) core_memory/runtime/goals/progress.py:138— progress._pair_rows has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4, loops 2 (3 pts), ternaries 1 (3 pts) (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.
progress._process_goal_progress_pair_page (cognitive 17) core_memory/runtime/goals/progress.py:743— progress._process_goal_progress_pair_page has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 13, if/else 3, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
source_envelope.normalize_source_ingest_envelope (cognitive 17) core_memory/runtime/ingest/source_envelope.py:111— source_envelope.normalize_source_ingest_envelope has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), loops 1, ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
reauthoring._attach_maintenance_provenance (cognitive 17) core_memory/runtime/turn/reauthoring.py:412— reauthoring._attach_maintenance_provenance has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, ternaries 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
receipt._queue_receipt (cognitive 17) core_memory/runtime/turn/receipt.py:76— receipt._queue_receipt has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (7 pts), loops 1 (nesting depth added 2). 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.
turn_quality.emit_agent_turn_quality_metric (cognitive 17) core_memory/runtime/turn/turn_quality.py:34— turn_quality.emit_agent_turn_quality_metric has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 16, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
integrity.soul_integrity_repair (cognitive 17) core_memory/soul/integrity.py:140— integrity.soul_integrity_repair has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.apply_soul_update (cognitive 17) core_memory/soul/store.py:306— store.apply_soul_update has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (7 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
retrieval_planner.boost_claim_results (cognitive 16) core_memory/claim/retrieval_planner.py:135— retrieval_planner.boost_claim_results has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), loops 1 (nesting depth added 2). 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.
root_cause.normalize_causal_hints (cognitive 16) core_memory/graph/root_cause.py:98— root_cause.normalize_causal_hints has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. 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.
root_cause._trace_package (cognitive 16) core_memory/graph/root_cause.py:788— root_cause._trace_package has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
root_cause._junction_members (cognitive 16) core_memory/graph/root_cause.py:836— root_cause._junction_members has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ingest_discord._parse_message (cognitive 16) core_memory/integrations/mcp/tools/ingest_discord.py:25— ingest_discord._parse_message has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
status.status_handler (cognitive 16) core_memory/integrations/mcp/tools/status.py:40— status.status_handler has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 2 (3 pts), error handling 1, ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Neo4jClient._prune_scope (cognitive 16) core_memory/integrations/neo4j/client.py:305— Neo4jClient._prune_scope has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 14, if/else 2. 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.
agent_end_bridge._extract_trace_list (cognitive 16) core_memory/integrations/openclaw/agent_end_bridge.py:134— agent_end_bridge._extract_trace_list has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (7 pts), if/else 3 (6 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.
archive_index.rebuild_archive_index (cognitive 16) core_memory/persistence/archive_index.py:90— archive_index.rebuild_archive_index has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 1 (3 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.
calibration._judge_prior_by_edge_key (cognitive 16) core_memory/persistence/calibration.py:56— calibration._judge_prior_by_edge_key has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 3 (5 pts), error handling 2 (3 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
entity_merge_flow._entity_similarity (cognitive 16) REDACTED:24— entity_merge_flow._entity_similarity has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
myelination_rewards.reward_dreamer_candidate_decision (cognitive 16) core_memory/persistence/myelination_rewards.py:427— myelination_rewards.reward_dreamer_candidate_decision has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 5, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
myelination_rewards.reward_soul_authoring_decision (cognitive 16) core_memory/persistence/myelination_rewards.py:473— myelination_rewards.reward_soul_authoring_decision has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 5, loops 2 (3 pts), ternaries 2 (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.
retrieval_feedback.read_retrieval_feedback (cognitive 16) core_memory/persistence/retrieval_feedback.py:148— retrieval_feedback.read_retrieval_feedback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
semantic_task_receipts._compact_run (cognitive 16) core_memory/persistence/semantic_task_receipts.py:161— semantic_task_receipts._compact_run has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProviderSemanticTaskRuntime.run (cognitive 16) core_memory/policy/semantic_task_runtime.py:254— ProviderSemanticTaskRuntime.run has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 2, error handling 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
lexical._field_tokens (cognitive 16) core_memory/retrieval/lexical.py:84— lexical._field_tokens has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 2 (5 pts), loops 2 (nesting depth added 3). 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.
memory_reason._synthesize_why_answer_from_chains (cognitive 16) core_memory/retrieval/tools/memory_reason.py:318— memory_reason._synthesize_why_answer_from_chains has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 1, ternaries 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.
PgvectorBackend.search (cognitive 16) core_memory/retrieval/vector_backend.py:463— PgvectorBackend.search has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
coverage._normalized_string_set (cognitive 16) core_memory/runtime/associations/coverage.py:913— coverage._normalized_string_set 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.
coverage._candidate_association_payload (cognitive 16) core_memory/runtime/associations/coverage.py:1808— coverage._candidate_association_payload has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 3, ternaries 2. 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.
coverage._select_sweep_bead_ids (cognitive 16) core_memory/runtime/associations/coverage.py:2138— coverage._select_sweep_bead_ids has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, loops 1 (2 pts), ternaries 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.
convergence.enqueue_narrative_candidates (cognitive 16) core_memory/runtime/dreamer/convergence.py:140— convergence.enqueue_narrative_candidates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 5, loops 3 (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.
dreamer_bridge._maybe_auto_endorse_goal (cognitive 16) core_memory/soul/dreamer_bridge.py:277— dreamer_bridge._maybe_auto_endorse_goal has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 6, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
transcript_ingest.ingest_transcript (cognitive 16) core_memory/transcript_ingest.py:545— transcript_ingest.ingest_transcript has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 14, if/else 2. 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.
check_architecture_guards.check_markdown_links (cognitive 16) scripts/check_architecture_guards.py:528— check_architecture_guards.check_markdown_links has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (10 pts), error handling 1 (3 pts), 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.
TooManyMethods: MemoryStore core_memory/persistence/store.py:41— TooManyMethods — 89 methods. The bar is 30 methods; this is 59 over it, 2.97× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Near-duplicate member pair (115 shared lines) core_memory/runtime/turn/reauthoring.py:634— core_memory/runtime/turn/reauthoring.py:634-900 | core_memory/runtime/turn/reauthoring.py:935-1146 — These two members are variants of one another: 115 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×1
Edited copy of a member (22 corresponding lines) core_memory/persistence/store_validation_helpers.py:7— core_memory/persistence/store_validation_helpers.py:7-31 | core_memory/schema/promotion.py:54-78 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) core_memory/persistence/myelination_rewards.py:147— core_memory/persistence/myelination_rewards.py:147-161 | core_memory/persistence/myelination_rewards.py:601-627 | core_memory/persistence/retrieval_feedback.py:149-177 | core_memory/runtime/dreamer/eval.py:132-147 | core_memory/runtime/dreamer/projection.py:270-285 | core_memory/soul/store.py:83-98 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Duplicated block (33–64 lines × 2) core_memory/runtime/turn/reauthoring.py:645— core_memory/runtime/turn/reauthoring.py:645-708 | core_memory/runtime/turn/reauthoring.py:945-977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/turn/reauthoring.py:645` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (44–59 lines × 2) core_memory/runtime/turn/reauthoring.py:816— core_memory/runtime/turn/reauthoring.py:816-874 | core_memory/runtime/turn/reauthoring.py:1077-1120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/turn/reauthoring.py:816` it begins part-way through the construct above it, so those 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 (36–43 lines × 2) core_memory/persistence/store_text_hygiene_ops.py:95— core_memory/persistence/store_text_hygiene_ops.py:95-130 | core_memory/policy/hygiene.py:140-182 — 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 (21–43 lines × 2) core_memory/runtime/turn/reauthoring.py:678— core_memory/runtime/turn/reauthoring.py:678-720 | core_memory/runtime/turn/reauthoring.py:1002-1022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/turn/reauthoring.py:1002` it begins part-way through the construct above it, so those 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–37 lines × 3) core_memory/runtime/dreamer/goal_decay.py:139— core_memory/runtime/dreamer/goal_decay.py:139-175 | core_memory/runtime/dreamer/goal_discovery.py:147-159 | core_memory/runtime/dreamer/tension_discovery.py:82-94 — before extracting anything, compare `core_memory/runtime/dreamer/goal_decay.py` and `core_memory/runtime/dreamer/goal_discovery.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/dreamer/goal_discovery.py:147` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (29 lines × 2) core_memory/persistence/store_autonomy_ops.py:21— core_memory/persistence/store_autonomy_ops.py:21-49 | core_memory/schema/promotion.py:98-126 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (27 lines × 2) core_memory/persistence/store_retrieval_context.py:40— core_memory/persistence/store_retrieval_context.py:40-66 | core_memory/retrieval/context_recall.py:66-92 — 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 (22 lines × 2) core_memory/policy/bead_typing.py:149— core_memory/policy/bead_typing.py:149-170 | core_memory/policy/rationale.py:200-221 — 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 `core_memory/policy/bead_typing.py:149` it begins part-way through the construct above it, so those 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, `core_memory/policy/bead_typing.py:148` calls `format` and `core_memory/policy/rationale.py:199` 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 (19–21 lines × 2) core_memory/runtime/turn/ingress.py:170— core_memory/runtime/turn/ingress.py:170-190 | core_memory/runtime/turn/ingress.py:193-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/turn/ingress.py:170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–20 lines × 2) core_memory/integrations/crewai/memory.py:87— core_memory/integrations/crewai/memory.py:87-106 | core_memory/integrations/crewai/memory.py:150-165 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15–19 lines × 2) core_memory/persistence/graph/kuzu_backend.py:240— core_memory/persistence/graph/kuzu_backend.py:240-258 | core_memory/persistence/graph/neo4j_backend.py:149-163 — 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 `core_memory/persistence/graph/kuzu_backend.py:240` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–19 lines × 2) core_memory/persistence/store_approval_ops.py:84— core_memory/persistence/store_approval_ops.py:84-102 | core_memory/persistence/store_lifecycle_ops.py:76-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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, `core_memory/persistence/store_approval_ops.py:103` calls `raise_confidence_class_for_bead` and `core_memory/persistence/store_lifecycle_ops.py:94` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–18 lines × 2) core_memory/integrations/openclaw/agent_end_bridge.py:202— core_memory/integrations/openclaw/agent_end_bridge.py:202-219 | REDACTED:78-94 — 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–18 lines × 2) core_memory/persistence/backend.py:381— core_memory/persistence/backend.py:381-391 | core_memory/retrieval/vector_backend.py:473-490 — 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 (16–17 lines × 2) core_memory/association/crawler_contract.py:545— core_memory/association/crawler_contract.py:545-561 | core_memory/association/crawler_contract.py:942-957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/association/crawler_contract.py:545` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–17 lines × 2) REDACTED:29— REDACTED:29-45 | core_memory/runtime/dreamer/candidates.py:65-78 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–16 lines × 2) core_memory/association/crawler_contract.py:1018— core_memory/association/crawler_contract.py:1018-1032 | core_memory/association/crawler_contract.py:1042-1057 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 × 4) core_memory/integrations/mcp/tools/ingest.py:282— core_memory/integrations/mcp/tools/ingest.py:282-298 | core_memory/integrations/mcp/tools/ingest_discord.py:157-172 | core_memory/integrations/mcp/tools/ingest_slack.py:139-153 | core_memory/integrations/mcp/tools/ingest_zoom.py:222-237 — before extracting anything, compare `core_memory/integrations/mcp/tools/ingest_discord.py` and `core_memory/integrations/mcp/tools/ingest_slack.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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–13 lines × 3) REDACTED:114— REDACTED:114-124 | core_memory/persistence/graph/kuzu_backend.py:241-253 | core_memory/persistence/graph/neo4j_backend.py:150-160 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (9–13 lines × 2) core_memory/soul/dreamer_bridge.py:557— core_memory/soul/dreamer_bridge.py:557-569 | core_memory/soul/dreamer_bridge.py:742-750 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `subject` to `str` in one and `str = "self"` 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) scripts/check_architecture_guards.py:605— scripts/check_architecture_guards.py:605-617 | scripts/check_architecture_guards.py:626-638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 4) core_memory/persistence/myelination_rewards.py:147— core_memory/persistence/myelination_rewards.py:147-158 | core_memory/runtime/dreamer/eval.py:133-144 | core_memory/runtime/dreamer/projection.py:271-282 | core_memory/soul/store.py:84-95 — 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 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 × 3) core_memory/persistence/semantic_task_receipts.py:96— core_memory/persistence/semantic_task_receipts.py:96-107 | core_memory/runtime/associations/coverage.py:189-200 | core_memory/runtime/associations/coverage.py:205-216 — 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 (10–11 lines × 2) REDACTED:798— REDACTED:798-807 | REDACTED:833-843 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 × 6) core_memory/persistence/myelination_rewards.py:149— core_memory/persistence/myelination_rewards.py:149-158 | core_memory/persistence/myelination_rewards.py:610-619 | core_memory/persistence/retrieval_feedback.py:158-167 | core_memory/runtime/dreamer/eval.py:135-144 | core_memory/runtime/dreamer/projection.py:273-282 | core_memory/soul/store.py:86-95 — 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. 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–10 lines × 5) core_memory/persistence/retrieval_feedback.py:18— core_memory/persistence/retrieval_feedback.py:18-26 | core_memory/runtime/dreamer/eval.py:17-26 | core_memory/runtime/dreamer/longitudinal.py:11-20 | core_memory/runtime/observability/self_model_drift.py:22-30 | core_memory/temporal/resolution.py:8-16 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `value` to `str | None` in one and `Any` 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 × 4) core_memory/runtime/dreamer/convergence.py:157— core_memory/runtime/dreamer/convergence.py:157-166 | core_memory/runtime/dreamer/goal_decay.py:134-143 | core_memory/runtime/dreamer/goal_discovery.py:142-151 | core_memory/runtime/dreamer/tension_discovery.py:77-86 — before extracting anything, compare `core_memory/runtime/dreamer/goal_decay.py` and `core_memory/runtime/dreamer/goal_discovery.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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–10 lines × 3) core_memory/integrations/openclaw/agent_end_bridge.py:328— core_memory/integrations/openclaw/agent_end_bridge.py:328-337 | core_memory/integrations/openclaw/compaction_bridge.py:63-72 | REDACTED:281-289 — 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. 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–10 lines × 2) core_memory/integrations/mcp/tools/ingest_discord.py:122— core_memory/integrations/mcp/tools/ingest_discord.py:122-131 | core_memory/integrations/mcp/tools/ingest_slack.py:112-119 — before extracting anything, compare `core_memory/integrations/mcp/tools/ingest_discord.py` and `core_memory/integrations/mcp/tools/ingest_slack.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/mcp/tools/ingest_discord.py:122` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–10 lines × 2) core_memory/policy/bead_judge.py:350— core_memory/policy/bead_judge.py:350-358 | core_memory/policy/rationale.py:214-223 — 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 `core_memory/policy/rationale.py:214` it begins part-way through the construct above it, so those 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–10 lines × 2) core_memory/runtime/observability/reviewer_quick_value.py:73— core_memory/runtime/observability/reviewer_quick_value.py:73-82 | core_memory/runtime/observability/reviewer_quick_value.py:88-94 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/runtime/observability/reviewer_quick_value.py:73` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 4) core_memory/graph/storylines.py:43— core_memory/graph/storylines.py:43-51 | core_memory/persistence/semantic_task_receipts.py:96-104 | core_memory/runtime/associations/coverage.py:189-197 | core_memory/runtime/associations/coverage.py:205-213 — 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 transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–9 lines × 4) core_memory/integrations/openclaw/agent_end_bridge.py:327— core_memory/integrations/openclaw/agent_end_bridge.py:327-334 | core_memory/integrations/openclaw/compaction_bridge.py:62-70 | REDACTED:280-287 | core_memory/integrations/openclaw/read_bridge.py:138-145 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. 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) core_memory/retrieval/pipeline/snap.py:54— core_memory/retrieval/pipeline/snap.py:54-62 | core_memory/retrieval/pipeline/snap.py:65-73 | core_memory/retrieval/pipeline/snap.py:76-84 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (7–9 lines × 2) core_memory/cli/__init__.py:130— core_memory/cli/__init__.py:130-138 | core_memory/cli/__init__.py:246-252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 3) core_memory/integrations/mcp/tools/ingest_discord.py:104— core_memory/integrations/mcp/tools/ingest_discord.py:104-111 | core_memory/integrations/mcp/tools/ingest_slack.py:99-106 | core_memory/integrations/mcp/tools/ingest_zoom.py:164-171 — before extracting anything, compare `core_memory/integrations/mcp/tools/ingest_discord.py` and `core_memory/integrations/mcp/tools/ingest_slack.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `core_memory/integrations/mcp/tools/ingest_discord.py:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 3) REDACTED:143— REDACTED:143-149 | core_memory/persistence/store_validation_helpers.py:11-17 | core_memory/schema/promotion.py:58-64 — 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 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 (2–7 lines × 4) core_memory/retrieval/agent.py:207— core_memory/retrieval/agent.py:207-213 | core_memory/retrieval/agent.py:216-217 | core_memory/retrieval/agent.py:249-255 | core_memory/retrieval/agent.py:258-259 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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, `core_memory/retrieval/agent.py:213` calls `get` and `core_memory/retrieval/agent.py:217` 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 (3–5 lines × 3) core_memory/runtime/dreamer/goal_discovery.py:87— core_memory/runtime/dreamer/goal_discovery.py:87-92 | core_memory/soul/assembly_depth.py:143-145 | core_memory/soul/identity_value_signals.py:75-79 — 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. 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, `core_memory/runtime/dreamer/goal_discovery.py:92` calls `_read_index`, `str`, `get` and `core_memory/soul/assembly_depth.py:145` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 4) core_memory/persistence/side_effect_outbox.py:29— core_memory/persistence/side_effect_outbox.py:29-34 | core_memory/runtime/dreamer/eval.py:48-53 | core_memory/runtime/dreamer/longitudinal.py:42-47 | core_memory/runtime/queue/compaction_queue.py:33-38 — before extracting anything, compare `core_memory/runtime/dreamer/eval.py` and `core_memory/runtime/dreamer/longitudinal.py` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 5) core_memory/retrieval/pipeline/canonical.py:633— core_memory/retrieval/pipeline/canonical.py:633-641 | core_memory/retrieval/pipeline/search.py:15-23 | REDACTED:662-670 | core_memory/retrieval/tools/memory_reason.py:99-107 | core_memory/schema/promotion.py:321-329 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `ts` to `str` in one and `str | None` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (7 lines × 4) core_memory/runtime/associations/coverage.py:91— core_memory/runtime/associations/coverage.py:91-97 | core_memory/runtime/ingest/external_evidence.py:53-59 | core_memory/runtime/ingest/source_envelope.py:22-28 | core_memory/schema/models.py:295-301 — 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 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 × 7) core_memory/runtime/dreamer/goal_decay.py:37— core_memory/runtime/dreamer/goal_decay.py:37-43 | core_memory/runtime/dreamer/goal_discovery.py:34-40 | core_memory/runtime/dreamer/projection.py:45-51 | core_memory/runtime/dreamer/tension_discovery.py:36-42 | core_memory/soul/assembly_depth.py:45-51 | core_memory/soul/identity_value_signals.py:27-33 | core_memory/soul/tension_signals.py:19-25 — before extracting anything, compare `core_memory/runtime/dreamer/goal_decay.py` and `core_memory/runtime/dreamer/goal_discovery.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 84 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. 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 (23 lines × 3) examples/claim_layer_demo.py:47— examples/claim_layer_demo.py:47-69 | examples/claim_layer_demo.py:86-108 | examples/claim_layer_demo.py:151-173 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
SC1 · Supply-chain hygiene· JavaScript dependencies are not locked · ×1
JavaScript dependencies are not locked — No package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock — JS installs aren't reproducible (SSDF PW.4.4). Commit your package manager's lockfile and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
Documentation: no installation or build instructions README.md— The README lacks installation, build, or setup instructions for the main Core Memory package. Add an install section covering pip requirements and any prerequisites.
Documentation: no usage examples README.md— There are no usage examples in the README describing how to run the server or invoke the demo. Provide a short 'How to run it' example for the main server and the Core Memory demo.
Documentation: written for insiders docs/integrations/springai/README.md— The SpringAI integration docs describe a runtime bridge entrypoint (`core_memory.integrations.springai.get_app()`) but the document is written for an internal audience and contains no context tying this to the broader causal memory thesis. Add a brief rationale or ticket reference that maps the runtime bridge to the project's main causal-memory layer.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 152 significant file(s) lose their only recent owner: core_memory/runtime/associations/coverage.py, core_memory/retrieval/pipeline/canonical.py, core_memory/management/__init__.py, core_memory/graph/root_cause.py, core_memory/runtime/dreamer/candidates.py, scripts/check_architecture_guards.py, core_memory/soul/summary.py, core_memory/retrieval/agent.py (+144 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 5 significant file(s) lose their only recent owner: core_memory/retrieval/tools/memory_reason.py, eval/paraphrase_eval.py, eval/retrieval_eval.py, eval/memory_execute_eval.py, core_memory/policy/incidents.py. Pair on, review, or document these before any departure.
D30 · Dependency Vulnerabilities· Scanner failed to run · ×1
REDACTED
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 4 of 273 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 273 of the 400 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: core_memory/persistence/metrics_ops.py, core_memory/runtime/observability/observability.py, core_memory/config/loader.py, core_memory/persistence/encryption.py. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D43 · Malicious Dependencies· Scanner failed to run · ×1
REDACTED
M2 · Architecture documentation· ADRs not easily discoverable · ×1
ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `docs/design/F-W1-write-pipeline.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
No SAST — No static application security testing detected. For this repository's stack, add bandit, `semgrep --config=p/python`, or CodeQL's python pack as a CI step. What was searched, so you can tell an absence from a miss: the 8259 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
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.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
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.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a0c0cc-8dd3-7ea4-9148-e1dab553cf00 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 27 · Warnings: 1129 · Recommendations: 22 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 20-09-2026 @ 21:50 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.